mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-06 04:15:44 +08:00
new param on probe to get stderr
This commit is contained in:
parent
f3079726fa
commit
6916ab2768
@ -4,7 +4,7 @@ from ._run import Error
|
|||||||
from ._utils import convert_kwargs_to_cmd_line_args
|
from ._utils import convert_kwargs_to_cmd_line_args
|
||||||
|
|
||||||
|
|
||||||
def probe(filename, cmd='ffprobe', timeout=None, **kwargs):
|
def probe(filename, cmd='ffprobe', timeout=None, capture_stderr=False, **kwargs):
|
||||||
"""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:
|
||||||
@ -24,6 +24,8 @@ def probe(filename, cmd='ffprobe', timeout=None, **kwargs):
|
|||||||
out, err = p.communicate(**communicate_kwargs)
|
out, err = p.communicate(**communicate_kwargs)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise Error('ffprobe', out, err)
|
raise Error('ffprobe', out, err)
|
||||||
|
if capture_stderr:
|
||||||
|
return json.loads(out.decode('utf-8')), err
|
||||||
return json.loads(out.decode('utf-8'))
|
return json.loads(out.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user