[Ffmpeg-devel] av_seek_frame() units
Andy Parkins
andyparkins
Tue Jul 5 12:25:05 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
Yep; I kind of knew that. However, this is the only method I could find to do
this. While it is completely wrong, it is working - how should I be
calculating a PTS from the packet that is comparable with a real time code?
I got the calculation of frame period from the email that Kenneth Aafl?y sent
on Saturday, "Re: [Ffmpeg-devel] Frame count/seeking". In light of your
comments would the following be more correct?
MyPts = Packet.pts / Packet.duration * Stream.time_base;
This obviously still contains the dodgy " / Packet.duration"; which I'm using
to create a frame counter - is there a frame count already in the packet?
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/8f72edd5/attachment.pgp>
More information about the ffmpeg-devel
mailing list