1
0
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:
laurentalacoque 2018-09-07 10:53:50 +02:00 committed by GitHub
parent b6f150c4c3
commit 5acc6da7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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: