diff --git a/ffmpeg/_probe.py b/ffmpeg/_probe.py index 41e8168..3b8e3a6 100644 --- a/ffmpeg/_probe.py +++ b/ffmpeg/_probe.py @@ -4,7 +4,7 @@ from ._run import Error from ._utils import convert_kwargs_to_cmd_line_args -def probe(filename, cmd='ffprobe', **kwargs): +def probe(filename, cmd='ffprobe', timeout=None, **kwargs): """Run ffprobe on the specified file and return a JSON representation of the output. Raises: @@ -18,7 +18,7 @@ def probe(filename, cmd='ffprobe', **kwargs): args += [filename] p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() + out, err = p.communicate(timeout=timeout) if p.returncode != 0: raise Error('ffprobe', out, err) return json.loads(out.decode('utf-8'))