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

Stefano Sabatini stefasab at gmail.com
Tue Sep 11 22:45:33 CEST 2012


On date Tuesday 2012-09-04 14:13:07 +0200, Stefano Sabatini encoded:
> 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

Well that was:
- set the stream/packet timebase in the frame

Since it is useful to pass around the frame with no reference to the
codec context (e.g. lavc->lavfi) it may be preferrable to store the
timebase in the frame.

Anyone can see a problem with that solution? I'll try to work a patch
for that.
-- 
FFmpeg = Formidable and Fundamental Martial Pure Enhanced Genius


More information about the ffmpeg-devel mailing list