[FFmpeg-devel] ffplay: Incorrect frame_delay?

Michael Niedermayer michaelni at gmx.at
Sun May 27 15:53:26 CEST 2012


On Sun, May 27, 2012 at 01:48:58PM +0200, Robert Nagy wrote:
> I believe the "frame_delay" calculation in queue_picture is incorrect,
> though I am not sure how one would fix it.
> 
> > static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos)
> > {
> >     VideoPicture *vp;
> >     double frame_delay, pts = pts1;
> >
> >     /* compute the exact PTS for the picture if it is omitted in the stream
> >      * pts1 is the dts of the pkt / pts of the frame */
> >     if (pts != 0) {
> >         /* update video clock with pts, if present */
> >         is->video_clock = pts;
> >     } else {
> >         pts = is->video_clock;
> >     }
> >     /* update video clock for next frame */
> >     frame_delay = av_q2d(is->video_st->codec->time_base);
> >     /* for MPEG2, the frame can be repeated, so we update the
> >        clock accordingly */
> >     frame_delay += src_frame->repeat_pict * (frame_delay * 0.5);
> >     is->video_clock += frame_delay;
> 
> First of all instead of av_q2d(is->video_st->codec->time_base) I think
> av_q2d(is->video_out_filter->inputs[0]->time_base) should be used.
> 
> Secondly this code seems to assume that the pts delta is always 1
> (i.e. next_pts - cur_pext == 1), which isn't always the case. One way
> to solve it I guess would be to poll the next frame as well and use
> the delta, however that assumes that the pts is correct and
> continuous.

polling the next frame could cause problems, the frame duration
may be several seconds for example (such files exist) which would
mean 10 seconds of the file has to be received and demuxed first.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120527/59ab693e/attachment.asc>


More information about the ffmpeg-devel mailing list