mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-06 04:15:44 +08:00
Added ffmpeg.probe 'cmd' argument
ffmpeg.<stream>.run() method has a `cmd` argument for selecting `ffmpeg` executable. This simple hack adds this feature to the probe command
This commit is contained in:
parent
b6f150c4c3
commit
5acc6da7ab
@ -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