mendevi.decode¶
Perform decoding measures.
Functions
|
Decode an existing video. |
|
Decode a video file and store the result in the database. |
|
Return the ffmpeg decode cmd. |
|
Return the ffmpeg arguments to decode the video from an accelerated device. |
Details
- mendevi.decode.decode(vid: Path, **kwargs: dict) tuple[str, dict[str]][source]
Decode an existing video.
Parameters¶
- vidpathlib.Path
The source video file to be decoded.
- **kwargsdict
Transmitted to
get_decode_cmd().
Returns¶
- cmdstr
The ffmpeg command.
- activitydict[str]
The computeur activity during the decoding process.
- mendevi.decode.decode_and_store(database: Path, env_id: int, vid: Path, **kwargs: dict) None[source]
Decode a video file and store the result in the database.
Parameters¶
- mendevi.decode.get_decode_cmd(video: Path, additional_filter: str, resolution: tuple[int, int] | None) list[str][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.
Returns¶
- filterstr
The full ffmpeg decode bash command arguments.
Examples¶
>>> import cutcutcodec >>> from mendevi.decode import get_decode_cmd >>> media = cutcutcodec.utils.get_project_root() / "media" / "video" / "intro.webm" >>> get_decode_cmd(media, additional_filter="", resolution=None) ['ffmpeg', '-threads', '1', '-i', '.../intro.webm', '-vf', 'format=rgb24', '-f', 'null', '-'] >>> get_decode_cmd(media, additional_filter="", resolution=(480, 720)) [..., '-vf', 'scale=h=480:w=720:sws_flags=bicubic,format=rgb24', '-f', 'null', '-'] >>>