How to find frames per second of any video file?
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.
video framerate
add a comment |
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.
video framerate
This is not possible, because not all video files have a "fps" (because VFR encoding exists).
– fkraiem
Oct 17 '17 at 1:58
VFR videos still have an average frame rate - whether or not this is useful depends on the application.
– thomasrutter
Dec 12 '17 at 0:56
add a comment |
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.
video framerate
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.
video framerate
video framerate
asked Mar 5 '12 at 18:12
Vivek
1,33991930
1,33991930
This is not possible, because not all video files have a "fps" (because VFR encoding exists).
– fkraiem
Oct 17 '17 at 1:58
VFR videos still have an average frame rate - whether or not this is useful depends on the application.
– thomasrutter
Dec 12 '17 at 0:56
add a comment |
This is not possible, because not all video files have a "fps" (because VFR encoding exists).
– fkraiem
Oct 17 '17 at 1:58
VFR videos still have an average frame rate - whether or not this is useful depends on the application.
– thomasrutter
Dec 12 '17 at 0:56
This is not possible, because not all video files have a "fps" (because VFR encoding exists).
– fkraiem
Oct 17 '17 at 1:58
This is not possible, because not all video files have a "fps" (because VFR encoding exists).
– fkraiem
Oct 17 '17 at 1:58
VFR videos still have an average frame rate - whether or not this is useful depends on the application.
– thomasrutter
Dec 12 '17 at 0:56
VFR videos still have an average frame rate - whether or not this is useful depends on the application.
– thomasrutter
Dec 12 '17 at 0:56
add a comment |
9 Answers
9
active
oldest
votes
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"
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.
– RobotHumans
Mar 11 '12 at 20:10
I thinksed -n "s/.*, (.*) tbr.*/1/pmisses"in the end, no?
– sup
Mar 12 '12 at 19:24
6
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
1
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
|
show 1 more comment
ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate infile
Result:
24000/1001
1
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
1
sometimes i get0/0depending on the format
– Daniel_L
Feb 13 '17 at 21:53
1
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
5
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put-select_streams V:0, which will select the first moving video stream.
– Sam Watkins
Sep 21 '17 at 6:44
1
@SamWatkins's complement is important. Without it, the command given output0/0.
– jdhao
Jun 6 '18 at 5:12
add a comment |
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
Just in case someone stumbles upon this... you can of course use input arg as the path ;)
import numpy as np
import os
import subprocess
def getFramerate():
con = "ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 D:\Uni\Seminar\leecher\Ninja\stream1.mp4"
proc = subprocess.Popen(con, stdout=subprocess.PIPE, shell=True)
framerateString = str(proc.stdout.read())[2:-5]
a = int(framerateString.split('/')[0])
b = int(framerateString.split('/')[1])
return int(np.round(np.divide(a,b)))
add a comment |
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
add a comment |
ffprobe <media> 2>&1| grep ",* fps" | cut -d "," -f 5 | cut -d " " -f 2
1
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f110264%2fhow-to-find-frames-per-second-of-any-video-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
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"
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.
– RobotHumans
Mar 11 '12 at 20:10
I thinksed -n "s/.*, (.*) tbr.*/1/pmisses"in the end, no?
– sup
Mar 12 '12 at 19:24
6
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
1
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
|
show 1 more comment
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"
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.
– RobotHumans
Mar 11 '12 at 20:10
I thinksed -n "s/.*, (.*) tbr.*/1/pmisses"in the end, no?
– sup
Mar 12 '12 at 19:24
6
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
1
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
|
show 1 more comment
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"
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"
edited Mar 20 '17 at 10:04
Community♦
1
1
answered Mar 5 '12 at 18:31
RobotHumans
22.8k362103
22.8k362103
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.
– RobotHumans
Mar 11 '12 at 20:10
I thinksed -n "s/.*, (.*) tbr.*/1/pmisses"in the end, no?
– sup
Mar 12 '12 at 19:24
6
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
1
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
|
show 1 more comment
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.
– RobotHumans
Mar 11 '12 at 20:10
I thinksed -n "s/.*, (.*) tbr.*/1/pmisses"in the end, no?
– sup
Mar 12 '12 at 19:24
6
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
1
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
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
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.
– RobotHumans
Mar 11 '12 at 20:10
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.
– RobotHumans
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
I think
sed -n "s/.*, (.*) tbr.*/1/p misses " in the end, no?– sup
Mar 12 '12 at 19:24
6
6
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
ffmpeg is not deprecated, avconv came from a branch of ffmpeg and to avoid confusion for those using the ffmpeg alternative the fake branch was marked as deprecated to let those users know that the version they were using was changing. your comment is misleading and could cause users to waste time researching this
– Chris
Apr 20 '16 at 14:07
1
1
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
What if it is variable frame rate?
– 0xcaff
Dec 24 '16 at 0:28
|
show 1 more comment
ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate infile
Result:
24000/1001
1
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
1
sometimes i get0/0depending on the format
– Daniel_L
Feb 13 '17 at 21:53
1
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
5
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put-select_streams V:0, which will select the first moving video stream.
– Sam Watkins
Sep 21 '17 at 6:44
1
@SamWatkins's complement is important. Without it, the command given output0/0.
– jdhao
Jun 6 '18 at 5:12
add a comment |
ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate infile
Result:
24000/1001
1
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
1
sometimes i get0/0depending on the format
– Daniel_L
Feb 13 '17 at 21:53
1
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
5
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put-select_streams V:0, which will select the first moving video stream.
– Sam Watkins
Sep 21 '17 at 6:44
1
@SamWatkins's complement is important. Without it, the command given output0/0.
– jdhao
Jun 6 '18 at 5:12
add a comment |
ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate infile
Result:
24000/1001
ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate infile
Result:
24000/1001
edited Oct 17 '17 at 1:35
answered May 16 '14 at 22:46
Steven Penny
1
1
1
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
1
sometimes i get0/0depending on the format
– Daniel_L
Feb 13 '17 at 21:53
1
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
5
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put-select_streams V:0, which will select the first moving video stream.
– Sam Watkins
Sep 21 '17 at 6:44
1
@SamWatkins's complement is important. Without it, the command given output0/0.
– jdhao
Jun 6 '18 at 5:12
add a comment |
1
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
1
sometimes i get0/0depending on the format
– Daniel_L
Feb 13 '17 at 21:53
1
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
5
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put-select_streams V:0, which will select the first moving video stream.
– Sam Watkins
Sep 21 '17 at 6:44
1
@SamWatkins's complement is important. Without it, the command given output0/0.
– jdhao
Jun 6 '18 at 5:12
1
1
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
This is probably the best answer in that it gives the EXACT frame rate (in the example 24000/1001 = 23.976023976)
– ntg
Jan 20 '16 at 12:30
1
1
sometimes i get
0/0 depending on the format– Daniel_L
Feb 13 '17 at 21:53
sometimes i get
0/0 depending on the format– Daniel_L
Feb 13 '17 at 21:53
1
1
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
Depending on what you want, this either works or doesn't. It reports the framerate of the encoding, but not the actual framerate of the video. For example, a 30fps video encoded into 60fps will report 60fps but will still be 30fps in actual output.
– Harvey
Jul 20 '17 at 17:16
5
5
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put
-select_streams V:0, which will select the first moving video stream.– Sam Watkins
Sep 21 '17 at 6:44
This didn't work if the video stream is not the first stream, you will get 0/0 if it looks at an audio stream. I will edit to put
-select_streams V:0, which will select the first moving video stream.– Sam Watkins
Sep 21 '17 at 6:44
1
1
@SamWatkins's complement is important. Without it, the command given output
0/0.– jdhao
Jun 6 '18 at 5:12
@SamWatkins's complement is important. Without it, the command given output
0/0.– jdhao
Jun 6 '18 at 5:12
add a comment |
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
add a comment |
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
add a comment |
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
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
edited Oct 17 '17 at 1:47
muru
1
1
answered Jan 20 '16 at 13:18
ntg
27336
27336
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
edited Oct 17 '17 at 1:47
muru
1
1
answered Mar 13 '12 at 10:47
sup
2,11722036
2,11722036
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 6 '12 at 8:09
user32288
311
311
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Jan 6 '15 at 20:01
answered Jan 6 '15 at 18:35
vladmateinfo
5652811
5652811
add a comment |
add a comment |
Just in case someone stumbles upon this... you can of course use input arg as the path ;)
import numpy as np
import os
import subprocess
def getFramerate():
con = "ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 D:\Uni\Seminar\leecher\Ninja\stream1.mp4"
proc = subprocess.Popen(con, stdout=subprocess.PIPE, shell=True)
framerateString = str(proc.stdout.read())[2:-5]
a = int(framerateString.split('/')[0])
b = int(framerateString.split('/')[1])
return int(np.round(np.divide(a,b)))
add a comment |
Just in case someone stumbles upon this... you can of course use input arg as the path ;)
import numpy as np
import os
import subprocess
def getFramerate():
con = "ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 D:\Uni\Seminar\leecher\Ninja\stream1.mp4"
proc = subprocess.Popen(con, stdout=subprocess.PIPE, shell=True)
framerateString = str(proc.stdout.read())[2:-5]
a = int(framerateString.split('/')[0])
b = int(framerateString.split('/')[1])
return int(np.round(np.divide(a,b)))
add a comment |
Just in case someone stumbles upon this... you can of course use input arg as the path ;)
import numpy as np
import os
import subprocess
def getFramerate():
con = "ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 D:\Uni\Seminar\leecher\Ninja\stream1.mp4"
proc = subprocess.Popen(con, stdout=subprocess.PIPE, shell=True)
framerateString = str(proc.stdout.read())[2:-5]
a = int(framerateString.split('/')[0])
b = int(framerateString.split('/')[1])
return int(np.round(np.divide(a,b)))
Just in case someone stumbles upon this... you can of course use input arg as the path ;)
import numpy as np
import os
import subprocess
def getFramerate():
con = "ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 D:\Uni\Seminar\leecher\Ninja\stream1.mp4"
proc = subprocess.Popen(con, stdout=subprocess.PIPE, shell=True)
framerateString = str(proc.stdout.read())[2:-5]
a = int(framerateString.split('/')[0])
b = int(framerateString.split('/')[1])
return int(np.round(np.divide(a,b)))
answered May 3 '18 at 15:35
WhatAMesh
1012
1012
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Dec 28 '18 at 1:48
aesede
1213
1213
add a comment |
add a comment |
ffprobe <media> 2>&1| grep ",* fps" | cut -d "," -f 5 | cut -d " " -f 2
1
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
add a comment |
ffprobe <media> 2>&1| grep ",* fps" | cut -d "," -f 5 | cut -d " " -f 2
1
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
add a comment |
ffprobe <media> 2>&1| grep ",* fps" | cut -d "," -f 5 | cut -d " " -f 2
ffprobe <media> 2>&1| grep ",* fps" | cut -d "," -f 5 | cut -d " " -f 2
edited Aug 16 '13 at 12:56
rɑːdʒɑ
56.9k84216301
56.9k84216301
answered Aug 16 '13 at 10:53
Daya
1
1
1
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
add a comment |
1
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
1
1
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
explain what it will do ?
– rɑːdʒɑ
Aug 16 '13 at 12:56
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f110264%2fhow-to-find-frames-per-second-of-any-video-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This is not possible, because not all video files have a "fps" (because VFR encoding exists).
– fkraiem
Oct 17 '17 at 1:58
VFR videos still have an average frame rate - whether or not this is useful depends on the application.
– thomasrutter
Dec 12 '17 at 0:56