[gst-devel] How do get the number of frames in a video file?

Wim Taymans wim.taymans at gmail.com
Wed Feb 20 12:07:44 CET 2008


On Tue, 2008-02-19 at 16:48 -0500, Nick Haddad wrote:
> I want to retrieve the duration of a video file in frames, but can't  
> figure out the best way to do this.
> 
> Calling...
> 
> GstFormat fmt = GST_FORMAT_DEFAULT;
> gst_element_query_duration( _pipeline, &fm, &numFrames)
> 
> ...doesn't work.  I'm assuming because the pipeline doesn't know about  
> the "default format" (GST_FORMAT_TIME works fine).
> 
> Which element in my pipeline should I query for the number of video  
> frames?  Is this even possible.  Currently I am building a pipeline  
> using decodebin.
> 

You could probably get the time duration and then use the framerate to
get the number of frames. This only works if the file has a constant
framerate, of course. A better alternative it to just implement the
DEFAULT query in the relevant elements (quite trivial for avi/qt
demuxers).

Wim 

> Thanks,
> -Nick
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel





More information about the gstreamer-devel mailing list