MCPcopy Create free account
hub / github.com/kkroening/ffmpeg-python / probe

Function probe

ffmpeg/_probe.py:7–24  ·  view source on GitHub ↗

Run ffprobe on the specified file and return a JSON representation of the output. Raises: :class:`ffmpeg.Error`: if ffprobe returns a non-zero exit code, an :class:`Error` is returned with a generic error message. The stderr output can be retrieved by accessing t

(filename, cmd='ffprobe', **kwargs)

Source from the content-addressed store, hash-verified

5
6
7def probe(filename, cmd='ffprobe', **kwargs):
8 """Run ffprobe on the specified file and return a JSON representation of the output.
9
10 Raises:
11 :class:`ffmpeg.Error`: if ffprobe returns a non-zero exit code,
12 an :class:`Error` is returned with a generic error message.
13 The stderr output can be retrieved by accessing the
14 ``stderr`` property of the exception.
15 """
16 args = [cmd, '-show_format', '-show_streams', '-of', 'json']
17 args += convert_kwargs_to_cmd_line_args(kwargs)
18 args += [filename]
19
20 p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
21 out, err = p.communicate()
22 if p.returncode != 0:
23 raise Error('ffprobe', out, err)
24 return json.loads(out.decode('utf-8'))
25
26
27__all__ = ['probe']

Callers

nothing calls this directly

Calls 2

ErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…