mendevi.decode.get_decode_cmd

mendevi.decode.get_decode_cmd(video: Path, additional_filter: str, resolution: tuple[int, int] | None = None, family: str | None = None) CmdFFMPEG[source]

Return the ffmpeg decode cmd.

Parameters

videopathlib.Path

The video to be decoded. It is required to know the resolution in order to adapt the filter.

additional_filterstr

The additional video filter, (can be an empty string).

resolutiontuple[int, int], optional

The new (heigh, width) video shape.

familystr, optional

If provided, force to use a specific decoder type.

Returns

filterstr

The full ffmpeg decode bash command arguments.

Examples

>>> import cutcutcodec
>>> from mendevi.decode import get_decode_cmd
>>> video = cutcutcodec.utils.get_project_root() / "media" / "video" / "intro.webm"
>>> print(get_decode_cmd(video, additional_filter="", resolution=None))
ffmpeg -hide_banner -y -loglevel verbose -threads 1 -i /...intro.webm -vf format=rgb24 -f null -
>>> print(get_decode_cmd(video, additional_filter="", resolution=(480, 720)))
ffmpeg ... -i ...intro.webm -vf scale=h=480:w=720:sws_flags=bicubic,format=rgb24 -f null -
>>>