[Ffmpeg-devel] Timestamps on Decoding

Rich Felker dalias
Mon Oct 24 18:32:22 CEST 2005


On Mon, Oct 24, 2005 at 09:15:26AM -0400, Ronald S. Bultje wrote:
> On Mon, 2005-10-24 at 05:16 -0400, Rich Felker wrote:
> > On Sun, Oct 23, 2005 at 09:02:37PM -0400, Ronald S. Bultje wrote:
> > > On Sun, 2005-10-23 at 18:45 -0400, Paul Curtis wrote:
> > > > But the last question was never answered: when I receive a complete raw 
> > > > frame, how can I accurately tell what it is I have received? Queueing 
> > > > the frames (audio or video) and presenting them to the Helix encoder 
> > > > wouldn't be a problem IF I could determine when the frame SHOULD be 
> > > > presented. This is the crux of the problem, and even Richard has said 
> > > > it's a problem.
> > > 
> > > Depends on how you call av_decode_video(). I call it in a loop, like
> > > this (quasi-code):
> > > 
> > > for (;;) {
> > >   if (output = av_decode_video (ctx, input)) {
> > >     // do something with output
> > >   }
> > > }
> > > 
> > > 1) if it's an I frame, then output == input, roughly. Timestamps, all
> > 
> > Nope. You only have output == input for B frames. I and P frames will
> > always be delayed (if has_b_frames is true). (Work out the logic if
> > this isn't clear already..)
> 
> Only if you don't loop. I loop the decode cycle with the same input
> several times, and with no input (like as if it were end-of-stream)
> until lavc tells me there's no more delayed frames (or the I frame
> itself) left.

Huh??

> Note that "is this an I-frame" is not decided based on keyframe flags in
> the container-level or the input data; it is decided based on frame_type
> in the AVPicture structure in output. I'm pretty sure that if you do
> this correctly and input is an I-frame, the last returned output will be
> that I-frame, too.

Again I have no idea what you're saying, but the only frames that can
possibly have dts==pts are B frames.

Rich





More information about the ffmpeg-devel mailing list