Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem

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 ...

everything works fine however if I loose 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 die". thanks for any suggestions.

share|improve this question

Try using the "shortest" option

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


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.