Skip to content

info

Module for querying FFmpeg codec and encoder information.

This module provides functionality to query the available FFmpeg codecs, decoders, and encoders on the system. It parses the output of FFmpeg's command-line tools to extract information about supported formats and capabilities.

Classes:

Name Description
Codec

Represents an FFmpeg codec with its capabilities and description.

CodecFlags

Flag enumeration representing the capabilities of a codec.

Coder

Represents an FFmpeg encoder or decoder with its capabilities and description.

CoderFlags

Flag enumeration representing the capabilities of a coder (encoder/decoder).

Functions:

Name Description
get_codecs

Query the system for all available FFmpeg codecs.

get_coders

Parse the output of an FFmpeg encoder/decoder listing into Coder objects.

get_decoders

Query the system for all available FFmpeg decoders.

get_encoders

Query the system for all available FFmpeg encoders.

parse_codec_flags

Parse the FFmpeg codec flags string into a CodecFlags enum.

parse_coder_flags

Parse the FFmpeg coder flags string into a CoderFlags enum.

Codec dataclass

Codec(name: str, flags: CodecFlags, description: str)

Represents an FFmpeg codec with its capabilities and description.

This immutable dataclass stores information about a codec identified by the ffmpeg -codecs command, including its name, supported features (as flags), and its textual description.

Attributes:

Name Type Description
name str

The codec identifier used in FFmpeg commands

flags CodecFlags

Bitmap of capabilities supported by the codec

description str

Human-readable description of the codec

CodecFlags

Bases: Flag

Flag enumeration representing the capabilities of a codec.

These flags correspond to the character flags in FFmpeg's codec information output and indicate what features a codec supports.

Coder dataclass

Coder(name: str, flags: CoderFlags, description: str)

Represents an FFmpeg encoder or decoder with its capabilities and description.

This dataclass stores information about a coder identified by the ffmpeg -encoders or ffmpeg -decoders command, including its name, supported features (as flags), and its textual description.

Attributes:

Name Type Description
name str

The coder identifier used in FFmpeg commands

flags CoderFlags

Bitmap of capabilities supported by the coder

description str

Human-readable description of the coder

CoderFlags

Bases: Flag

Flag enumeration representing the capabilities of a coder (encoder/decoder).

These flags correspond to the character flags in FFmpeg's encoder/decoder information output and indicate what features a coder supports.

get_codecs

get_codecs() -> tuple[Codec, ...]

Query the system for all available FFmpeg codecs.

This function calls ffmpeg -codecs and parses the output to create a tuple of Codec objects representing all codecs available on the system.

Returns:

Type Description
tuple[Codec, ...]

A tuple of Codec objects with information about each codec

Raises:

Type Description
FFMpegExecuteError

If the ffmpeg command fails

get_coders

get_coders(codes: str) -> tuple[Coder, ...]

Parse the output of an FFmpeg encoder/decoder listing into Coder objects.

This function parses the text output from ffmpeg -encoders or ffmpeg -decoders commands and constructs Coder objects for each entry.

Parameters:

Name Type Description Default
codes str

String output from the FFmpeg encoders/decoders command

required

Returns:

Type Description
tuple[Coder, ...]

A tuple of Coder objects representing the available encoders/decoders

get_decoders

get_decoders() -> tuple[Coder, ...]

Query the system for all available FFmpeg decoders.

This function calls ffmpeg -decoders and parses the output to create a tuple of Coder objects representing all decoders available on the system.

Returns:

Type Description
tuple[Coder, ...]

A tuple of Coder objects with information about each decoder

Raises:

Type Description
FFMpegExecuteError

If the ffmpeg command fails

get_encoders

get_encoders() -> tuple[Coder, ...]

Query the system for all available FFmpeg encoders.

This function calls ffmpeg -encoders and parses the output to create a tuple of Coder objects representing all encoders available on the system.

Returns:

Type Description
tuple[Coder, ...]

A tuple of Coder objects with information about each encoder

Raises:

Type Description
FFMpegExecuteError

If the ffmpeg command fails

parse_codec_flags

parse_codec_flags(flags: str) -> CodecFlags

Parse the FFmpeg codec flags string into a CodecFlags enum.

This function interprets the character flags from FFmpeg's codec listing and converts them to the corresponding CodecFlags enum values.

Parameters:

Name Type Description Default
flags str

A string of flag characters from FFmpeg codec information

required

Returns:

Type Description
CodecFlags

A CodecFlags bitmap with the appropriate flags set

parse_coder_flags

parse_coder_flags(flags: str) -> CoderFlags

Parse the FFmpeg coder flags string into a CoderFlags enum.

This function interprets the character flags from FFmpeg's encoder/decoder listing and converts them to the corresponding CoderFlags enum values.

Parameters:

Name Type Description Default
flags str

A string of flag characters from FFmpeg encoder/decoder information

required

Returns:

Type Description
CoderFlags

A CoderFlags bitmap with the appropriate flags set