6

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.

2 Answers2

9

I know this is an old question, however, this worked for me as an option to ffmpeg: -use_wallclock_as_timestamps 1

Jann
  • 191
  • 1
  • 3
4

I had a similar problem and the -re option resolved it for me. This tells ffmpeg to act as a frame grabber would act.

BenjiWiebe
  • 9,173