ffmpeg
- exception mautrix.util.ffmpeg.ConverterError
Bases:
ChildProcessError
- exception mautrix.util.ffmpeg.NotInstalledError
Bases:
ConverterError
- __init__()
- Return type:
None
- async mautrix.util.ffmpeg.convert_bytes(data, output_extension, input_args=None, output_args=None, input_mime=None, logger=None)
Convert media file data using ffmpeg.
- Parameters:
data (bytes) – The bytes of the file to convert.
output_extension (str) – The extension that the output file should be.
input_args (Iterable[str] | None) – Arguments to tell ffmpeg how to parse the input file.
output_args (Iterable[str] | None) – Arguments to tell ffmpeg how to convert the file to reach the wanted output.
input_mime (str | None) – The mime type of the input data. If not specified, will be guessed using magic.
logger (Logger | None)
- Returns:
The converted file as bytes.
- Raises:
ConverterError – if ffmpeg returns a non-zero exit code.
- Return type:
- async mautrix.util.ffmpeg.convert_path(input_file, output_extension, input_args=None, output_args=None, remove_input=False, output_path_override=None, logger=None)
Convert a media file on the disk using ffmpeg.
- Parameters:
input_file (PathLike[str] | str) – The full path to the file.
output_extension (str | None) – The extension that the output file should be.
input_args (Iterable[str] | None) – Arguments to tell ffmpeg how to parse the input file.
output_args (Iterable[str] | None) – Arguments to tell ffmpeg how to convert the file to reach the wanted output.
remove_input (bool) – Whether the input file should be removed after converting. Not compatible with
output_path_override
.output_path_override (PathLike[str] | str | None) – A custom output path to use (instead of using the input path with a different extension).
logger (Logger | None)
- Returns:
The path to the converted file, or the stdout if
output_path_override
was set to-
.- Raises:
ConverterError – if ffmpeg returns a non-zero exit code.
- Return type:
- async mautrix.util.ffmpeg.probe_bytes(data, input_mime=None, logger=None)
Probe media file data using ffprobe.
- Parameters:
- Returns:
A Python object containing the parsed JSON response from ffprobe
- Raises:
ConverterError – if ffprobe returns a non-zero exit code.
- Return type:
- async mautrix.util.ffmpeg.probe_path(input_file, logger=None)
Probes a media file on the disk using ffprobe.