[FFmpeg-user] FFMPEG dynamic FrameRate Parameter with -c copy option

Carl Eugen Hoyos ceffmpeg at gmail.com
Fri Sep 7 17:55:49 EEST 2018

2018-09-07 7:36 GMT+02:00, Axit Soni <aksprince2111 at gmail.com>:

> I am converting my H264 data into MP4 file using -c copy option without
> re-encoding.
> "*ffmpeg -i <H264_input_fifo> -c copy temp.mp4*"
> I don't know on which FrameRate my input "H264_input_fifo" is giving me data
> means its varying based on some different condition over different time
> period.
> If I don't provide "-r" parameter with temp.mp4, it will generate temp.mp4
> with 25 fps.
> If I provide "-r 30" parameter with temp.mp4, it will generate temp.mp4 with
> 30 fps.

Yes, this is - if it works, the input parameter -r is a bit of a hack and
fails for some usecases - the expected behaviour.

> Is there a way by which I can generate temp.mp4 file with Same FrameRate as
> my input H264_input_fifo with Dynamic Input FrameRate Parameter. For
> Example, if for 10 seconds my input has 30 fps than output should also have
> 30 fps... On 11th Seconds on wards if my input has 22 fps than output should
> also have 22 fps.

Please explain where the input file comes from:
Variable frame rate raw H.264 seems strange to me and I am not sure
if there is any possibility of reading this input correctly. The "real" input,
whatever it is, should provide usable timestamps.

This is apart from the fact that FFmpeg is not good at writing
variable frame rate mp4 files (and this is not recommended), you
could use another container, mkv comes to mind.

Carl Eugen

More information about the ffmpeg-user mailing list