[Ffmpeg-devel] Frame count/seeking

Ian Gowen ian.gowen
Sat Jul 2 18:36:06 CEST 2005


OK, thanks. Now given the frame rate and the number of frames into the video 
I want to seek, what do I pass as the timestamp to av_seek_frame()?

--Ian

On 7/1/05, Todd Kirby <ffmpeg.php at gmail.com> wrote:
> On 7/1/05, Kenneth Aafl?y <kenneth at aafloy.net> wrote:
> > l?rdag 2. juli 2005, 01:47, skrev Ian Gowen:
> > > Is there an easy way to determine the frame count of a file?
> > > Right now what I'm doing is reading the whole file and keeping
> > > a counter but needless to say that's slow; is there a better way?
> >
> > If the format you are reading from has a parser that would be quicker!
> > Still you
> >
> > > Also, I'm a little fuzzy on how to interpret AVStream.time_base. How
> > > do I get that in frames per second?
> >
> > Let me see if I can figure out this:
> >
> >  double rate = av_q2d(stream->r_frame_rate);
> 
> This has recently changed so If you need to be compatible with older
> versions of ffmpeg do this:
> 
> #if LIBAVCODEC_BUILD > 4753
>     rate = av_q2d(stream->r_frame_rate);
> #else
>     rate = stream->r_frame_rate / stream->r_frame_rate_base;
> #endif
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>





More information about the ffmpeg-devel mailing list