'FFMPEG record http video stream with normal speed

I'm recording an http stream from my IP Camera (TPLINK NC200), using this command:

ffmpeg -i http://admin:[email protected]:8080/stream/getvideo -t 30 -acodec copy -vcodec copy abc.mp4

As you can see , the video length is set to 30 seconds ( -t option ) . But it takes about 1 minute 30 seconds to record , and the video speed is very high ( the camera recording a stopwatch and a 30-second video recorded the timer to 1 minute and 11 seconds ).

Is there some ffmpeg option to get a normal speed video? Or the problem is the camera configuration?



Solution 1:[1]

Despite the declared 25 fps is your stream likely varying in framerate. I would try this

ffmpeg -use_wallclock_as_timestamps 1 -i "http://admin:[email protected]:8080/stream/getvideo" -t 30 -c copy -y output.mp4

Sometimes I get a bunch of Non-monotonous DTS in output stream warnings. There seems to be some timebase issue of the input format, and the only help for me is to force mjpeg format instead of mpjpeg.

ffmpeg -use_wallclock_as_timestamps 1 -f mjpeg -i "http://admin:[email protected]:8080/stream/getvideo" -t 30 -c copy -y output.mp4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1