[FFmpeg-devel] [PATCH 25/29] fftools/ffmpeg_demux: set the timebase on demuxed packets

Anton Khirnov anton at khirnov.net
Wed Apr 12 08:59:40 EEST 2023


Quoting James Almer (2023-04-12 04:49:00)
> On 4/9/2023 11:08 AM, Anton Khirnov wrote:
> > Simplifies tracking what timebase are the timestamps in. Will be useful
> > in following commits.
> > ---
> >   fftools/ffmpeg_demux.c | 16 +++++++++-------
> >   1 file changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
> > index f2da0826ad..7ff57273c9 100644
> > --- a/fftools/ffmpeg_demux.c
> > +++ b/fftools/ffmpeg_demux.c
> > @@ -194,15 +194,17 @@ static void ts_fixup(Demuxer *d, AVPacket *pkt, int *repeat_pict)
> >       const int64_t start_time = ifile->start_time_effective;
> >       int64_t duration;
> >   
> > +    pkt->time_base = ist->st->time_base;
> 
> Might be a good future-proof idea to check first if pkt->time_base is 
> already set or not. The doxy says demuxers themselves may start doing so 
> at some point.

Why would that make any difference? The timestamps have to be in the
stream timebase, anything else would be an API break. So whatever value
is or is not written there by the demuxer, we can always overwrite it by
what we know has to be the corect timebase.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list