mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-09-22 14:39:58 +08:00
Merge pull request #123 from laurentalacoque/master
Added ffmpeg.probe 'cmd' argument
This commit is contained in:
commit
d47890aebd
@ -3,7 +3,7 @@ import subprocess
|
|||||||
from ._run import Error
|
from ._run import Error
|
||||||
|
|
||||||
|
|
||||||
def probe(filename):
|
def probe(filename, cmd='ffprobe'):
|
||||||
"""Run ffprobe on the specified file and return a JSON representation of the output.
|
"""Run ffprobe on the specified file and return a JSON representation of the output.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
@ -12,7 +12,7 @@ def probe(filename):
|
|||||||
The stderr output can be retrieved by accessing the
|
The stderr output can be retrieved by accessing the
|
||||||
``stderr`` property of the exception.
|
``stderr`` property of the exception.
|
||||||
"""
|
"""
|
||||||
args = ['ffprobe', '-show_format', '-show_streams', '-of', 'json', filename]
|
args = [cmd, '-show_format', '-show_streams', '-of', 'json', filename]
|
||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user