[FFmpeg-devel] [PATCH 3/9] lavfi: use AVFrame.duration instead of AVFrame.pkt_duration

Anton Khirnov anton at khirnov.net
Thu Jul 14 11:46:52 EEST 2022


Quoting Nicolas George (2022-07-13 17:02:04)
> Anton Khirnov (12022-07-13):
> > ---
> >  doc/filters.texi                |  2 +-
> >  libavfilter/buffersrc.c         |  7 +++++++
> >  libavfilter/f_loop.c            | 14 ++++++++++++++
> >  libavfilter/vf_deshake_opencl.c |  7 +++++++
> >  libavfilter/vf_drawtext.c       | 16 ++++++++++++++++
> >  5 files changed, 45 insertions(+), 1 deletion(-)
> 
> No objection from me.
> 
> But pkt_duration is mostly unused in libavfilter: the authoritative
> information about a packet duration is given by the timestamp of the
> next packet. What f_loop and vf_deshake_opencl currently do is slightly
> bogus.

I am aware.

Timestamp of the next packet requires you to have the next packet, which
means extra latency, so using durations is better. My plan for the
future is to handle durations in all filters that may modify timestamps,
so durations propagate through lavfi properly. Later on, some mechanism
could be added to automatically compute durations when they are not
available on input, so that filters may rely on the duration being
known and don't need to buffer frames themselves.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list