[Ffmpeg-devel] av_seek_frame() units

Andy Parkins andyparkins
Tue Jul 5 12:36:31 CEST 2005


On Tuesday 2005 July 05 10:14, Michael Niedermayer wrote:

> > av_seek_frame( fmtCtx, -1, TARGET_PTS, AVSEEK_FLAG_BACKWARD );
> > CodecCtx->hurry_up = 1;
> > do {
> >     av_read_frame( fmtCtx, &Packet );
> >     // should really be checking that this is a video packet
> >     MyPts = Packet.pts / Packet.duration *
> > 	AV_TIME_BASE / av_q2d( Stream->r_frame_rate);
>
> this is completely wrong, the division by Packet.duration makes no sens and
> its 1/Stream.time_base not Stream->r_frame_rate which should be used

How's this?

   MyPts = av_rescale( Packet.pts,
        AV_TIME_BASE * (int64_t) Stream->time_base.num,
        Stream->time_base.den );

Which seems to work as well (although going by my earlier performance, that is 
no reccommendation :-))

Andy

-- 
Dr Andrew Parkins, M Eng (hons), AMIEE

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20050705/991bc410/attachment.pgp>



More information about the ffmpeg-devel mailing list