[Ffmpeg-devel] av_seek_frame() units

Andy Parkins andyparkins
Wed Jul 6 13:52:38 CEST 2005

On Wednesday 2005 July 06 07:10, Ian Gowen wrote:

> Thus, time = frame_number / frame_rate. However, what I don't understand is
> how to put that into AVStream.time_base units, as the docs say to do. Do I
> multiply it by
> the time_base? Divide? I don't get it, and I'm pretty sure this is
> where I'm screwing
> up.

I'm not sure why you would need to do this.  What source for frame_number are 
you using - it's not in any of the AV structures.  If you want the time 
simply read Packet.pts; why calculate it when it's already there?

If you are trying to seek, you would want to seek a time anyway.  Maybe a 
percentage through the file?  ffplay does this like this:

seekPoint = (int64_t)(formatContext->start_time+frac*formatContext->duration);


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/20050706/60b7a4e6/attachment.pgp>

More information about the ffmpeg-devel mailing list