mendevi.encode

Perform encoding measures.

Functions

encode(src, **kwargs)

Transcode an existing video.

encode_and_store(database, env_id, src, **kwargs)

Transcode a video file and store the result in the database.

get_transcode_cmd(src, dst, **kwargs)

Return the ffmpeg encode cmd.

quality_to_rate(kwargs)

Return the absolute target bitrate in kbit/s.

Details

mendevi.encode.encode(src: Path, **kwargs: dict) tuple[Path, str, str, dict[str]][source]

Transcode an existing video.

Parameters

srcpathlib.Path

The source video file to be transcoded.

**kwargsdict

Transmitted to get_transcode_cmd().

Returns

dstpathlib.Path

The transcoded video path. The stem contains the md5 hash of the file content.

cmdstr

The ffmpeg command.

logstr

The output generated by the cmd.

activitydict[str]

The computeur activity during the transcoding process.

mendevi.encode.encode_and_store(database: Path, env_id: int, src: Path, **kwargs: dict) None[source]

Transcode a video file and store the result in the database.

Parameters

databasepathlike

The path of the existing database to be updated.

env_idint

The primary integer key of the environment.

srcpathlib.Path

The path of the video to be decoded.

**kwargs

Transmitted to encode().

mendevi.encode.get_transcode_cmd(src: Path, dst: Path, **kwargs: dict) CmdFFMPEG[source]

Return the ffmpeg encode cmd.

mendevi.encode.quality_to_rate(kwargs: dict[str]) int[source]

Return the absolute target bitrate in kbit/s.

Based on https://twitch-overlay.fr/quelle-connexion-internet-choisir-pour-streamer-sur-twitch/ and https://bitmovin.com/blog/video-bitrate-streaming-hls-dash/

You can plot the bitrate with: mendevi plot mendevi.db -x bitrate -y psnr -f ‘mode = “vbr”’

The flow margin is taken to be twice as small and twice as large as the recommendations.