Is there any simple way to find the fps of a video in ubuntu? In windows I use Gspot to find out all the information about a video file. But in ubuntu I find it very difficult to find out this basic information. Any help is appreciated.
Here is a python function based on Steven Penny's answer using ffprobe that gives exact frame rate
ffprobe 'Upstream Color 2013 1080p x264.mkv' -v 0 -select_streams v -print_format flat -show_entries stream=r_frame_rate
import sys
import os
import subprocess
def get_frame_rate(filename):
if not os.path.exists(filename):
sys.stderr.write("ERROR: filename %r was not found!" % (filename,))
return -1
out = subprocess.check_output(["ffprobe",filename,"-v","0","-select_streams","v","-print_format","flat","-show_entries","stream=r_frame_rate"])
rate = out.split('=')[1].strip()[1:-1].split('/')
if len(rate)==1:
return float(rate[0])
if len(rate)==2:
return float(rate[0])/float(rate[1])
return -1
The alternative to command line, is looking at the properties of your file via context menu in Nautilus (graphical file manager). For audio/video files you get an additional tab there with extra informations.
I usually use exiftool to get info of any file type...
For example with command exiftool file.swf I can know the framerate of any swf file, something I cannot achieve with ffmpeg
You can right click the target file, Properties, Audio/Video but you will not get the exact framerate. To get a precise framerate you can install MediaInfo.
This will tell you the framerate if it's not variable framerate:
Sample output with filename obscured:
Someone edited with one that didn't quite work the way I wanted. It's referenced here
Additional edit...If you want the tbr value this sed line works
Result:
Here is a python function based on Steven Penny's answer using ffprobe that gives exact frame rate
Retrieve the average frame-rate, given as a fraction:
Then divide it by rounding to the nearest integer:
The alternative to command line, is looking at the properties of your file via context menu in Nautilus (graphical file manager). For audio/video files you get an additional tab there with extra informations.
This is a python script to do this using mplayer, in case anyone is interested. It is used
path/to/script path/to/movie_name1 path/to/movie/name2
etcI usually use
exiftool
to get info of any file type... For example with commandexiftool file.swf
I can know the framerate of any swf file, something I cannot achieve withffmpeg
Uses the stats script bundled by default with MPV. So just play the file with MPV and press
i
. A bunch of statistics including framerate will appear.You can right click the target file, Properties, Audio/Video but you will not get the exact framerate. To get a precise framerate you can install MediaInfo.