I am recording the MJPEG video from an IP camera and saving it to a file but the problem is that file's duration is way smaller than the actual recording time. Its around 9 seconds video for 2 minutes recording. I tried following commands in order
ffmpeg -f mjpeg -r 8 -i http://c-cam.uchicago.edu/mjpg/video.mjpg -vcodec mpeg4 -b 1000000 -r 8 video_file.avi
Then I omitted the most of the flags and tried like this
ffmpeg -f mjpeg -i http://c-cam.uchicago.edu/mjpg/video.mjpg video_file.avi
But the problem is that the duration of recorded file is 9 seconds where as the actual recording time is around 2 minutes. I finally tried setpts filter that is supposed to insert the timestamps. The command is as follows
ffmpeg -f mjpeg -i http://c-cam.uchicago.edu/mjpg/video.mjpg -vf "setpts=1*PTS" video_file.avi
But result was still the same. Recording time was way more than video duration.