cutcutcodec.core.analysis.ffprobe.get_metadata
- cutcutcodec.core.analysis.ffprobe.get_metadata(filename: Path | str | bytes, ignore_errors=False) dict[str][source]
Call
ffprobeand parse the result as a dictionary.Parameters
- filenamepathlike
The pathlike of the file containing streams.
- ignore_errorsboolean, default=False
If True, returns an empty dict rather than throwing an exception if invalid data are detected.
Returns
- metadatadict
All the metadata containing in the container and each streams.
Examples
>>> from pprint import pprint >>> from cutcutcodec.core.analysis.ffprobe import get_metadata >>> pprint(get_metadata("cutcutcodec/examples/audio_5.1_narration.oga")) {'format': {'bit_rate': '34982', 'duration': '8.000000', 'filename': 'cutcutcodec/examples/audio_5.1_narration.oga', 'format_long_name': 'Ogg', 'format_name': 'ogg', ... 'nb_streams': 1, 'probe_score': 100, 'size': '34982', 'start_time': '0.000000'}, 'streams': [{'avg_frame_rate': '0/0', 'bit_rate': '96000', 'bits_per_sample': 0, 'channel_layout': '5.1', 'channels': 6, 'codec_long_name': 'Vorbis', 'codec_name': 'vorbis', 'codec_tag': '0x0000', 'codec_tag_string': '[0][0][0][0]', 'codec_type': 'audio', 'disposition': {'attached_pic': 0, ... 'visual_impaired': 0}, 'duration': '8.000000', ... 'sample_rate': '16000', 'start_pts': 0, 'start_time': '0.000000', 'tags': {'encoder': 'Lavc59.37.100 libvorbis'}, 'time_base': '1/16000'}]} >>>