Probe#
Local media inspection through ffprobe.
- class remote_compression.probe.MediaInfo(width: int, height: int, codec_name: str, subtitles: tuple[SubtitleStream, ...] = (), duration: float | None = None, field_order: str | None = None)[source]#
Result of a successful probe: the first genuine video stream plus subtitles.
- subtitles#
Subtitle streams, in order of appearance.
- Type:
- class remote_compression.probe.SubtitleStream(index: int, codec_name: str)[source]#
A subtitle stream as reported by ffprobe.
- index#
Index of the stream among subtitle streams (0-based, order of appearance), i.e. the
iof ffmpeg specifiers like0:s:i.- Type:
- remote_compression.probe.probe(file)[source]#
Inspect a local media file with ffprobe.
- Parameters:
- Returns:
Extracted information, or None whenever the file cannot be probed: ffprobe missing, non-zero exit, empty or invalid JSON output, or no genuine video stream (cover art, aka
attached_pic, does not count).- Return type:
MediaInfoor None
Notes
The command is passed as an argument list (never through a shell), so this works identically on Windows and POSIX.
Width and height are display dimensions: when the stream carries a display-matrix rotation of +/-90 degrees (phone videos), the coded dimensions are swapped accordingly.