[FFmpeg-devel] [PATCH] lavc: add duration field to AVFrame

Stefano Sabatini stefasab at gmail.com
Tue Sep 4 14:13:07 CEST 2012


On date Sunday 2012-08-26 05:22:39 +0200, Michael Niedermayer encoded:
> On Thu, Aug 02, 2012 at 05:32:23PM +0200, Stefano Sabatini wrote:
> > On date Thursday 2012-08-02 12:17:48 +0200, Stefano Sabatini encoded:
> >  avcodec.h |   12 ++++++++++++
> >  utils.c   |    5 +++++
> >  2 files changed, 17 insertions(+)
> > 91ac00288f8063d65db98fed503f2c73850956a6  0006-lavc-add-duration-field-to-AVFrame.patch
> > From dffa5ba28c9c9d9510bcfbe8bcb576e895e59c2e Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Thu, 2 Aug 2012 13:12:28 +0200
> > Subject: [PATCH] lavc: add duration field to AVFrame
> 
> LGTM

The main problem I see with this patch, is that the
avcodec_decode_video2() can't set this value in a sane value (assuming
pkt_duration if not specified and rescaling), since the pkt/stream
time base is not known at the decoder level.

With audio this is not a problem, since we can deduce the frame
duration from the number of samples.

As a consequence, if frame.duration is not set by the video decoder,
the only possible way to set it, it is to do that at the application
level, which I'd like to avoid.

Other possible solutions:
- set the stream/packet timebase in the decoder context
- set the stream/packet timebase in the packet
-- 
FFmpeg = Faithless and Fostering Mournful Perfectionist Enhanced God


More information about the ffmpeg-devel mailing list