[gst-devel] To get the fps of the Mpeg file without actually playing it.

Gergely Nagy algernon at bonehunter.rulez.org
Thu Apr 28 04:45:02 CEST 2005


> 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,"
> 
> I am getting the correct fps of the Mpeg file if its fps is an integer.
> For a particular file with fps as 29.970 i am getting the fps as 29 but
> i want either 29.970 or 30. How can this be done?

You modify the substitution in the sed command-line to something like
this:

"s,^.*framerate=(double)\([0-9\.]\+\).*,\1,"

(Untested, but should work)

-- 
Gergely Nagy





More information about the gstreamer-devel mailing list