[FFmpeg-devel] [PATCH] lavfi: add duration field to AVFilterBufferRef

Stefano Sabatini stefasab at gmail.com
Thu Aug 2 17:32:23 CEST 2012

On date Thursday 2012-08-02 12:17:48 +0200, Stefano Sabatini encoded:
> So my proposal is to extend AVFrame with a duration field, expressed
> as a number of units in the assumed time_base, and accepting the value
> 0, and unspecified is AV_PTS_NOVALUE.

See attached patch.

Note that this approach has the following inconvenients: we could miss
the AVFrame.duration information but only pkt_duration, so we need to
decide which priority to assign to each field (and remember that
they're expressed in different time bases and with different
"undefined" semantic).

The logic to apply thus could be:
- check if AVFrame.duration is defined, and convert it to the target TB
- otherwise check if AVFrame.pkt_duration is defined, and convert it to the target TB
- otherwise return the undefined value

I'm not sure if we should rely on the AVFrame.pkt_duration for audio
frames (for example in case there is more than one frame per packet).

In the long term, we may consider to change the undefined value for
AVFrame.pkt_duration (and pkt.duration) from 0 to AV_NOPTS_VALUE for
better consistency.
FFmpeg = Fundamental and Fundamental Marvellous Programmable Ecumenical Genius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-lavc-add-duration-field-to-AVFrame.patch
Type: text/x-diff
Size: 3010 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120802/835b040e/attachment.bin>

More information about the ffmpeg-devel mailing list