[FFmpeg-devel] [RFC] Add duration info to AVFrame

Stefano Sabatini stefasab at gmail.com
Fri Jun 1 11:14:04 CEST 2012

On date Thursday 2012-03-08 15:50:21 +0100, Stefano Sabatini encoded:
> Hi,
> the feature would be useful for different purposes, especially for
> normalization/correction timestamp filters (e.g. setpts).
> Different approaches:
> 1. I could export pkt_duration in AVFrame, like it is done with
>    pkt_pts, duration is expressed in stream time_base units.
>    This alone is not sufficient, because to decode pkt* things we need
>    to reference the AVStream, which is not always available.
> 2. I create a duration field in AVFrame, with no specified timebase,
>    which is done for passing the duration information between
>    different layers (e.g. lavc -> lavfi -> lavc), similar to what we
>    did for pts.
>    Then I could add a time_base unit in AVFrame, which is used for
>    specifying the PTS and duration timebase.
> 3. a combination of 1/2
> Comments are welcome.

Done like 1.

* as mentioned, pkt_pts alone can't be interpreted if there is no
  reference to the stream timebase.
* it is not possible to distinguish between duration=0 and
  duration=unknown, because 0 == unknown, which depends on how
  duration is defined in AVPacket.
  Otherwise: would it make sense to change the semantics in AVPacket
* how to get a frame duration from the pkt duration? I assume it is
  pkt_duration = frame_duration for video, for audio it could be
FFmpeg = Fierce & Fantastic Mega Power Enhancing Gadget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-lavc-add-pkt_duration-field-to-AVFrame.patch
Type: text/x-diff
Size: 3932 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120601/f3e3542b/attachment.bin>

More information about the ffmpeg-devel mailing list