Expand description
The codec module provides helpers for enumerating and querying FFmpeg’s available audio/video encoders and decoders. This can be useful for discovering which codecs are supported in your current FFmpeg build, along with their core attributes.
§Public API
get_encoders(): Returns a list ofCodecInforepresenting all encoders (e.g., H.264, AAC) recognized by FFmpeg.get_decoders(): Returns a list ofCodecInforepresenting all decoders (e.g., H.264, AAC) recognized by FFmpeg.
§Example
// List all available encoders
let encoders = get_encoders();
for enc in &encoders {
println!("Encoder: {} - {}", enc.codec_name, enc.codec_long_name);
}
// List all available decoders
let decoders = get_decoders();
for dec in &decoders {
println!("Decoder: {} - {}", dec.codec_name, dec.codec_long_name);
}§Data Structures
CodecInfo: Contains user-friendly fields such as:codec_name/codec_long_namedesc_name: The descriptor name from FFmpeg.media_type(audio/video/subtitle, etc.)codec_id(internal FFmpeg ID)codec_capabilities(bitmask indicating codec features)
§Notes
- The underlying [
Codec] struct is for internal usage only, bridging to the raw FFmpeg APIs. In most cases, you only need the higher-levelCodecInfodata from the public functions above. - The available encoders/decoders can vary depending on your FFmpeg build and any external libraries installed on the system.
Structs§
- Codec
Info - Holds metadata about a specific codec recognized by FFmpeg.
Functions§
- get_
decoders - Retrieves a list of all decoders (e.g., for H.264, AAC, etc.) recognized by FFmpeg.
- get_
encoders - Retrieves a list of all encoders (e.g., for H.264, AAC, etc.) recognized by FFmpeg.