https://www.ffmpeg.org/doxygen/trunk/dump_8c_source.html#l00454
- fps =
st->avg_frame_rate
- tbr =
st->r_frame_rate
- tbn =
st->time_base
- tbc =
st->codec->time_base
Average framerate.
- demuxing: May be set by libavformat when creating the stream or in
avformat_find_stream_info()
. - muxing: May be set by the caller before
avformat_write_header()
.
Real base framerate of the stream. This is the lowest framerate with which all timestamps can be represented accurately (it is the least common multiple of all framerates in the stream). Note, this value is just a guess! For example, if the time base is 1/90000 and all frames have either approximately 3600 or 1800 timer ticks, then r_frame_rate
will be 50/1.
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
- decoding: set by libavformat
- encoding: May be set by the caller before
avformat_write_header()
to provide a hint to the muxer about the desired timebase. Inavformat_write_header()
, the muxer will overwrite this field with the timebase that will actually be used for the timestamps written into the file (which may or may not be related to the user-provided one, depending on the format).
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be 1/framerate and timestamp increments should be identically 1.
- encoding: MUST be set by user.
- decoding: Set by libavcodec.
I'd suggest you add
if the time base is 1/90000 and all frames have either approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
if the time base is 1/90000 and all frames have either approximately 3600 for a real frame rate of 25/1 or 1800 for an r_frame_rate of 50/1.
And also:
timebase should be 1/framerate and timestamp increments should be identically 1
timebase should be divisible by the framerate (ie: 1/framerate) and timestamp increments should be identically timebase.numerator/framerate (ie: 1)
For a 25 FPS we could use a timebase of 1/75 and increase each timestamp in order of 75/25 = 3 or we could use a 1/25 timebase increasing each timestamp in order of 1.