Page 1 of 1

Bash scripting - VLC to reconnect or retry after HTTP error

Posted: 01 Sep 2011 10:27
by khumash
VLC to reconnect or retry after getting HTTP 500/502 error from streaming video/audio

I was trying to write a bash script to have VLC automatically streaming an online audio and observed that 20% of chances vlc gets HTTP 500/502 error from the streaming audio server. This may be a network latency issue or the streaming server doesn't handle huge traffics well.

Anyways, while using browser (Chrome/IE) to open the streaming audio and monitoring the responses with Fiddler, it seems the browser can reconnect/resend the request to the server if getting HTTP 500/502 error. However, vlc doesn't reconnect. Sometimes my scheduled recording doesn't just skip due to this issue.

Command:

Code: Select all

cvlc -v --http-reconnect --run-time=30 $INSTREAM ':sout=#transcode{acodec=mp3,channels=2}:duplicate{dst=display,dst=std{access=file,mux=raw,dst="'$OUTFILE'"}}' vlc://quit ;

Log:

Code: Select all

[0x8590cdc] asf stream warning: unknown asf object 0x26f18b5d-0x4584-0x47ec-0x9f5f0e651f0452c9 [0x8590cdc] asf stream warning: unknown asf object 0x1806d474-0xcadf-0x4509-0xa4ba9aabcb96aae8 [0x9cd6714] mux_dummy mux: Open [0x9cc1c44] access_mms access error: error: HTTP/1.0 500 Internal Server Error [0x9cb5d7c] main input error: open of `mmsh://bcr.media.hinet.net/ra000009?MSWMExt=.asf' failed: (null) [0x9cb5d7c] main input error: Your input can't be opened [0x9cb5d7c] main input error: VLC is unable to open the MRL 'mmsh://bcr.media.hinet.net/ra000009?MSWMExt=.asf'. Check the log for details. [0x858b4f4] mux_dummy mux: Open [0x8579c9c] access_mms access error: error: HTTP/1.0 502 Bad Gateway [0x857f1f4] main input error: open of `mmsh://202.39.43.193:80/ra000009?MSWMExt=.asf' failed: (null) [0x857f1f4] main input error: Your input can't be opened [0x857f1f4] main input error: VLC is unable to open the MRL 'mmsh://202.39.43.193:80/ra000009?MSWMExt=.asf'. Check the log for details. [0x857cd7c] dummy demux: command `quit'

Looking into VLC command-line help, I tried to enable --http-reconnect flag but still no luck. Is there any way to let vlc retry until get success response?