[gst-devel] Trying to find the fps of an MPEG file using gstreamer or gstreamer-plugins

Gergely Nagy algernon at bonehunter.rulez.org
Tue Apr 26 04:21:49 CEST 2005


>    I am trying to find the fps or frame rate of a MPEG video stream 
> without actually playing the file. Is there any tool or option in 
> gstreamer or gstreamer-plugins through which the above process can be 
> done successfully?

I'd suggest writing a small program, that creates a pipeline of filesrc
linked to decodebin, binds a callback to decodebin's new-decoded-pad
signal, and starts to iterate. In the callback, check if the pad is a
video pad, and if it is, get its caps, print the framerate, and exit the
program.

Another option is a quick hack with gst-launch:

gst-launch -v -i=100 \
	filesrc location=$FILE ! \
	decodebin ! video/x-raw-yuv ! fakesink | \
	\
	grep "fakesink0.sink: caps = video" | \
	sed -e "s,^.*framerate=(double)\([0-9]\+\).*,\1,"   

Cheers,
-- 
Gergely Nagy





More information about the gstreamer-devel mailing list