[FFmpeg-devel] [PATCH] frame: add a time_base field

Lynne dev at lynne.ee
Wed Sep 8 03:13:03 EEST 2021


8 Sept 2021, 01:25 by cus at passwd.hu:

>
>
> On Tue, 7 Sep 2021, Lynne wrote:
>
>> 7 Sept 2021, 19:36 by andreas.rheinhardt at outlook.com:
>>
>>> Lynne:
>>>
>>>> This adds a time_base field (currently unused), analogue to the AVPacket.time_base field.
>>>>
>>>> Patch attached. doc/APIchanges and version bump to be done at push time.
>>>>
>>>> +    /**
>>>> +     * Time base for the timestamps in this frame. May be 0, in which case the
>>>> +     * time_base from the frame source should be used.
>>>> +     */
>>>> +    AVRational time_base;
>>>>
>
> So how this is going to work? Will e.g. avcodec_send_frame check the time base of the frame and recalculate pts/duration to the encoder time base? Same goes for every function which is receiving frames?
>

If it's zero, it'll use the initial avctx timebase. If it's non-zero and different, IMO it should
warn the user that the timebase has changed and carry on as we currently do, with the
output packets still using the initial timebase, and the input timestamps unchanged.
A new AV_CODEC_CAP_DYNAMIC_TIMEBASE and
AV_CODEC_FLAG2_DYNAMIC_TIMEBASE flags may be introduced, which if supplied,
will either adapt the timestamps to the initial timebase if the encoder does not indicate
support via the new codec cap flag (most wrappers) or proceed to generate packets
with a new timebase if the encoder supports it (most native encoders).


> Also I would like to point out that until the actual support for this is added to the libraries I don't see why we should add this, because sizeof(AVFrame) is not part of the ABI, so this can be added anytime.
>

Right, fair enough. Consider it an RFC then.


More information about the ffmpeg-devel mailing list