Skip to main content

CodecId

Enum CodecId 

Source
#[non_exhaustive]
pub enum CodecId {
Show 34 variants None, H264, Hevc, Opus, Avif, Png, Jpeg, Gif, Webp, Pcm, Vorbis, Flac, Jxl, Aac, Vp9, Av2, Mp3, RawVideo, Subrip, WebVtt, ProRes, DnxHd, Apv, Vp8, Alac, Ac3, Eac3, PcmAlaw, PcmMulaw, AdpcmMs, AdpcmImaWav, AdpcmImaQt, Mp2, Mp1,
}
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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

§

ProRes

Apple ProRes video (422 Proxy/LT/standard/HQ, 4444, 4444 XQ). Stream copy only; the profile travels as the stream’s codec_tag.

§

DnxHd

Avid DNxHD / DNxHR video. Stream copy only.

§

Apv

APV (Advanced Professional Video). Stream copy only.

§

Vp8

VP8 video. Stream copy only.

§

Alac

Apple Lossless (ALAC) audio. Stream copy only.

§

Ac3

Dolby Digital (AC-3) audio. Stream copy only.

§

Eac3

Dolby Digital Plus (E-AC-3) audio. Stream copy only.

§

PcmAlaw

G.711 A-law audio (WAV format 0x0006, AIFF-C/CAF alaw).

§

PcmMulaw

G.711 µ-law audio (WAV format 0x0007, AIFF-C/CAF ulaw).

§

AdpcmMs

Microsoft ADPCM (WAV format 0x0002). One block per packet.

§

AdpcmImaWav

IMA/DVI ADPCM as WAV stores it (format 0x0011). One block per packet.

§

AdpcmImaQt

IMA ADPCM as QuickTime stores it (ima4: 34-byte blocks of 64 samples per channel), in AIFF-C, CAF and MOV.

§

Mp2

MPEG-1/2 Audio Layer II (MP2). Decode only.

§

Mp1

MPEG-1/2 Audio Layer I (MP1). Decode only.

Implementations§

Source§

impl CodecId

Source

pub fn name(self) -> &'static str

Short canonical name, matching the token used on the ffmpeg command line (-c:v h264, -c:a opus, …).

Source

pub fn media_type(self) -> MediaType

The media category this codec produces.

Source

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.

Source

pub fn from_name(name: &str) -> Option<CodecId>

Look up a codec id from its canonical CLI name.

Trait Implementations§

Source§

impl Clone for CodecId

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CodecId

Source§

impl Debug for CodecId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodecId

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for CodecId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CodecId

Source§

impl Hash for CodecId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CodecId

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CodecId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.