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

Lynne dev at lynne.ee
Fri Sep 10 00:45:46 EEST 2021


9 Sept 2021, 22:18 by andreas.rheinhardt at outlook.com:

> Lynne:
>
>> 9 Sept 2021, 21:15 by george at nsup.org:
>>
>>> Lynne (12021-09-09):
>>>
>>>> No, you don't, there's nothing special about this!
>>>>
>>>
>>> There is no need for something special, it is an universal fact of
>>> programming that if several redundant pieces of information are supposed
>>> to be in sync, unless there are strong systems to keep them in sync,
>>> they will eventually get out of sync because of a code inconsistency.
>>>
>>> Avoiding redundancy is one of the most important principles of code
>>> hygiene.
>>>
>>> This is why I oppose this change, and this is why I propose to remove
>>> the time_base field in AVPacket.
>>>
>>
>> It's a necessary piece of information pertinent to the correct
>> presenting of each frame. Moreover, it simplifies the API,
>> which new users are still finding difficult to use. Like for example
>> timebase negotiation in lavf, which requires a complicated dance
>> to perform, and is not documented anywhere. And which
>>
>
> What is undocumented?
>

Muxing's timebase selection. Yes, it's documented. No, it __really__ doesn't help.
I got utterly confused, and other API users have felt the same way about it.
Populate timebase with your stream's input timebase. Initialize the muxer.
That field then gets overwritten with the timebase lavf wants. Then you
have to change all packet timebases to it.
It's by far the most insane API we have, and the most insane API I've ever seen.


>> timebase field are you supposed to use from lavf? The global
>> context's? The stream's? The codecparameter's? This
>>
>
> Global context? You mean AVFormatContext? It does not contain a timebase
> at all; the timestamps and durations contained in it are in
> microseconds. And AVCodecParameters also hasn't a timebase either. Only
> the stream has one.
>

Yes, I forgot about that. Still, chapters have their own timebase,
packets have their own timebase now, no reason why frames shouldn't
get one too.


More information about the ffmpeg-devel mailing list