Is there a way to deal with ffmpeg http input losing connection?

4

1

I'm recording a stream from my IP webcam (and storing it to a server but that's not the issue right now). The command looks something like this:

ffmpeg -f mjpeg -i http://ip.ad.dd.res/videostream.cgi?user=recorder&pass=recorder …

Everything works fine, however if I lose connection to the camera the process hangs and doesn't reconnect when the connection comes back up.

Is there a way to set some "connection lost" timeout after which the ffmpeg process would die? Something along the lines "if a new frame isn't received in xy seconds then die".

ciny

Posted 2013-03-24T12:56:42.050

Reputation: 141

Answers

0

Try using the "shortest" option

-shortest (output)
    Finish encoding when the shortest input stream ends. 

Reference:

hinekyle

Posted 2013-03-24T12:56:42.050

Reputation: 290