Answer the question
In order to leave comments, you need to log in
FFMPEG and incoming HTTP (mjpeg) stream break?
Can you please tell me how to implement an exit from ffmpeg when the incoming http stream from the ip-camera breaks?
Those. there is, say, the concept of a session: the camera turned on -> recording started, the camera turned off -> recording stopped, went into standby mode.
Now implemented like this:
#!/bin/bash
while true; do
while true; do
ping -c1 -o -n -W 1 192.168.1.4 > /dev/null 2>&1 && break;.
sleep 5s;
done
now=`date +"%Y-%m-%d-%H-%M-%S"`
ffmpeg -f mjpeg -shortest -i "http://192.168.1.4/stream.cgi" -timeout 30 cam1-${now}.avi
done
Answer the question
In order to leave comments, you need to log in
hm. strange situation. Literally a month ago, I wrote from the camera just mjpeg, which stably fell off as soon as the connection was lost.
ffmpeg version 0.8.2.git, Copyright © 2000-2011 the FFmpeg developers
built on Sep 14 2011 18:29:34 with gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
Maybe the following information will help you
FreeBSD 9.1 ffmpeg 0.7.15,1 I
recently played ffmpeg with writing to a file. ffmpeg, like ffmpeg1, when an rtsp stream disappears for less than about 25 seconds, it resumes operation when it appears. The stream is interrupted by a reconnection of a non-PoE ethernet tail. If more than about 25 seconds pass with no communication with the camera, then ffmpeg exits on its own.
If ffmpeg is terminated not by pressing 'q', but by pressing 'ctrl+z', then it remains running and its subsequent launches with exits by 'ctrl+z' produce hanging ffmpeg processes. To get rid of them I use:
# killall -9 ffmpeg
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question