Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

5 Answers 5

up vote 10 down vote accepted

This will tell you the framerate if it's not variable framerate:

ffmpeg -i filename

Sample output with filename obscured:

Input #0, matroska,webm, from 'somerandom.mkv':
  Duration: 01:16:10.90, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (High), yuv420p, 720x344 [PAR 1:1 DAR 90:43], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0.1: Audio: aac, 48000 Hz, stereo, s16 (default)
ffmpeg -i filename 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p"

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

sed -n "s/.*, \(.*\) tbr.*/\1/p"
share|improve this answer
    
I needed to use tb instead of fp in the one-liner. Seems not all video files report fps but all autput something like tbr tbc which has the same value. –  sup Mar 11 '12 at 17:28
    
valid, but the one-liner from the edit output-ed the tbc value not the tbr value in this particular set of output. something to consider on why i changed it...I'ld rather it fail in a really noticeable way than a way that isn't noticed at all. –  hbdgaf Mar 11 '12 at 20:10
    
I think sed -n "s/.*, \(.*\) tbr.*/\1/p misses " in the end, no? –  sup Mar 12 '12 at 19:24

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 etc

#!/usr/bin/python
# -*- coding: utf-8 -*-

import subprocess
import re
import sys

pattern = re.compile(r'(\d{2}.\d{3}) fps')
for moviePath in sys.argv[1:]:
    mplayerOutput = subprocess.Popen(("mplayer", "-identify", "-frames", "0", "o-ao", "null", moviePath), stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
    fps = pattern.search(mplayerOutput).groups()[0]
    print fps
share|improve this answer

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.

share|improve this answer
ffprobe 'Upstream Color 2013 1080p x264.mkv' -v 0 -select_streams v \
  -print_format flat -show_entries stream=r_frame_rate

Result

streams.stream.0.r_frame_rate="24000/1001"

How could I get fps number of the video only?

share|improve this answer
ffprobe <media> 2>&1| grep ",* fps" | cut -d "," -f 5 | cut -d " " -f 2
share|improve this answer
    
explain what it will do ? –  AgentCool Aug 16 '13 at 12:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.