[FFmpeg-devel] [PATCH] AVPacket.display_duration

Uoti Urpala uoti.urpala
Tue Sep 9 02:09:32 CEST 2008

On Tue, 2008-09-09 at 01:41 +0200, Aurelien Jacobs wrote:
> Uoti Urpala wrote:
> > A video frame implicitly lasts until the next frame overwrites it,
> That's where you're wrong. The next frame *don't* overwrites the previous
> one. It only modify it (in case of predictive frames).

A frame lasts until the next one overwrites it; whether the decoder
internally uses data from the earlier frames while preparing the next
one is irrelevant here.

> And the exact same situation happens with subtitles. Let's see the
> following example with subtitles A and B:
>   A - start: 2 - end: 8
>   B - start: 6 - end: 10
> Here, subtitle B don't "overwrite previous frame", it only modify it
> (by adding one more subtitle line on the screen...).
> Now, the display duration of subtitle A is exactly comparable to
> the duration a video frame has effect on the following frames
> (ie. until further frame don't reuse any data derived from the
> original frame, which is often until next key frame).
> And this duration is never stored in container for video frames,
> it's stored in the video bitstream itself. So it don't sound
> very strange to do the same thing for subtitle streams.

No, there is an important difference that you're failing to understand.

That the content from A still affects the result at time 6 when B
appears is not that different from video (except that there are no
explicit key frames unlike most video formats, but that distinction
isn't too important here). What IS different from video is what happens
at times 8 and 10. The displayed content changes even though no new
packet appears at those times.

You won't see the screen going black because the duration of the
previous video frame ended; it'll only happen if there's a new video
packet saying "display a new frame showing a black screen here". But you
DO have subtitles disappearing because their duration ended, with no new
subtitle packet at that point.

More information about the ffmpeg-devel mailing list