#[non_exhaustive]pub enum CodecId {
Show 20 variants
None,
H264,
Hevc,
Opus,
Avif,
Png,
Jpeg,
Gif,
Webp,
Pcm,
Vorbis,
Flac,
Jxl,
Aac,
Vp9,
Av2,
Mp3,
RawVideo,
Subrip,
WebVtt,
}Expand description
Identifier for a specific codec (the what, independent of any particular encoder/decoder implementation).
Marked #[non_exhaustive]: we add codecs over time, and external matchers
must handle the open-ended set.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
Sentinel for “no/unknown codec”.
H264
H.264 / AVC video.
Hevc
H.265 / HEVC video. Decode only.
Opus
Opus audio.
Avif
AVIF still image (an AV1 intra frame in a HEIF box).
Png
PNG still image (DEFLATE-compressed RGB/RGBA).
Jpeg
JPEG still image (a.k.a. MJPEG).
Gif
GIF image (first frame; palette-based).
Webp
WebP image (VP8 / VP8L).
Pcm
Linear PCM audio (uncompressed; layout in the stream’s sample format).
Vorbis
Vorbis audio (Ogg Vorbis).
Flac
FLAC lossless audio.
Jxl
JPEG XL image.
Aac
AAC audio (Advanced Audio Coding).
Vp9
VP9 video.
Av2
AV2 video (AOMedia’s successor to AV1). Decode only.
Mp3
MP3 audio (MPEG-1/2 Audio Layer III).
RawVideo
Raw uncompressed video (planar/packed pixels; layout in the stream’s
pixel format). The video analog of CodecId::Pcm.
Subrip
SubRip subtitle (.srt): plain-text cues with HH:MM:SS,mmm timing.
WebVtt
WebVTT subtitle (.vtt): plain-text cues with HH:MM:SS.mmm timing.
Implementations§
Source§impl CodecId
impl CodecId
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
Short canonical name, matching the token used on the ffmpeg command
line (-c:v h264, -c:a opus, …).
Sourcepub fn media_type(self) -> MediaType
pub fn media_type(self) -> MediaType
The media category this codec produces.
Sourcepub fn sample_format_from_name(name: &str) -> Option<SampleFormat>
pub fn sample_format_from_name(name: &str) -> Option<SampleFormat>
The sample format a codec NAME pins, when the name carries one.
CodecId is deliberately format-agnostic — pcm_s16le and pcm_f32le
are both CodecId::Pcm — but for raw PCM the name IS the format, and
dropping it means -c:a pcm_s16le silently writes whatever the decoder
happened to emit. Compressed codecs return None: their sample format is
an internal detail, not something the CLI name selects.