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)
| 5 | |
| 6 | |
| 7 | def 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'] |
nothing calls this directly
no test coverage detected
searching dependent graphs…