[Ffmpeg-devel] av_seek_frame() units

Michael Niedermayer michaelni
Tue Jul 5 12:50:52 CEST 2005


Hi

On Tuesday 05 July 2005 12:36, Andy Parkins wrote:
> 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 );

looks good

[...]
-- 
Michael





More information about the ffmpeg-devel mailing list