Struct rav1e::EncoderConfig

source ·
pub struct EncoderConfig {
Show 29 fields pub width: usize, pub height: usize, pub sample_aspect_ratio: Rational, pub time_base: Rational, pub bit_depth: usize, pub chroma_sampling: ChromaSampling, pub chroma_sample_position: ChromaSamplePosition, pub pixel_range: PixelRange, pub color_description: Option<ColorDescription>, pub mastering_display: Option<MasteringDisplay>, pub content_light: Option<ContentLight>, pub level_idx: Option<u8>, pub enable_timing_info: bool, pub still_picture: bool, pub error_resilient: bool, pub switch_frame_interval: u64, pub min_key_frame_interval: u64, pub max_key_frame_interval: u64, pub reservoir_frame_delay: Option<i32>, pub low_latency: bool, pub quantizer: usize, pub min_quantizer: u8, pub bitrate: i32, pub tune: Tune, pub film_grain_params: Option<Vec<GrainTableSegment>>, pub tile_cols: usize, pub tile_rows: usize, pub tiles: usize, pub speed_settings: SpeedSettings,
}
Expand description

Encoder settings which impact the produced bitstream.

Fields§

§width: usize

Width of the frames in pixels.

§height: usize

Height of the frames in pixels.

§sample_aspect_ratio: Rational

Sample aspect ratio (for anamorphic video).

§time_base: Rational

Video time base.

§bit_depth: usize

Bit depth.

§chroma_sampling: ChromaSampling

Chroma subsampling.

§chroma_sample_position: ChromaSamplePosition

Chroma sample position.

§pixel_range: PixelRange

Pixel value range.

§color_description: Option<ColorDescription>

Content color description (primaries, transfer characteristics, matrix).

§mastering_display: Option<MasteringDisplay>

HDR mastering display parameters.

§content_light: Option<ContentLight>

HDR content light parameters.

§level_idx: Option<u8>

AV1 level index to target (0-31). If None, allow the encoder to decide. Currently, rav1e is unable to guarantee that the output bitstream meets the rate limitations of the specified level.

§enable_timing_info: bool

Enable signaling timing info in the bitstream.

§still_picture: bool

Still picture mode flag.

§error_resilient: bool

Flag to force all frames to be error resilient.

§switch_frame_interval: u64

Interval between switch frames (0 to disable)

§min_key_frame_interval: u64

The minimum interval between two keyframes

§max_key_frame_interval: u64

The maximum interval between two keyframes

§reservoir_frame_delay: Option<i32>

The number of temporal units over which to distribute the reservoir usage.

§low_latency: bool

Flag to enable low latency mode.

In this mode the frame reordering is disabled.

§quantizer: usize

The base quantizer to use.

§min_quantizer: u8

The minimum allowed base quantizer to use in bitrate mode.

§bitrate: i32

The target bitrate for the bitrate mode.

§tune: Tune

Metric to tune the quality for.

§film_grain_params: Option<Vec<GrainTableSegment>>

Parameters for grain synthesis.

§tile_cols: usize

Number of tiles horizontally. Must be a power of two.

Overridden by tiles, if present.

§tile_rows: usize

Number of tiles vertically. Must be a power of two.

Overridden by tiles, if present.

§tiles: usize

Total number of tiles desired.

Encoder will try to optimally split to reach this number of tiles, rounded up. Overrides tile_cols and tile_rows.

§speed_settings: SpeedSettings

Settings which affect the encoding speed vs. quality trade-off.

Implementations§

source§

impl EncoderConfig

source

pub fn with_speed_preset(speed: u8) -> Self

This is a preset which provides default settings according to a speed value in the specific range 0–10. Each speed value corresponds to a different preset. See from_preset(). If the input value is greater than 10, it will result in the same settings as 10.

source

pub fn set_key_frame_interval(&mut self, min_interval: u64, max_interval: u64)

Sets the minimum and maximum keyframe interval, handling special cases as needed.

source

pub fn frame_rate(&self) -> f64

Returns the video frame rate computed from time_base.

source

pub fn render_size(&self) -> (usize, usize)

Computes the render width and height of the stream based on width, height, and sample_aspect_ratio.

source

pub const fn temporal_rdo(&self) -> bool

Is temporal RDO enabled ?

source

pub fn is_hdr(&self) -> bool

Describes whether the output is targeted as HDR

Trait Implementations§

source§

impl Clone for EncoderConfig

source§

fn clone(&self) -> EncoderConfig

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for EncoderConfig

source§

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

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

impl Default for EncoderConfig

Default preset for EncoderConfig: it is a balance between quality and speed. See with_speed_preset().

source§

fn default() -> Self

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

impl Display for EncoderConfig

source§

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

Formats the value using the given formatter. Read more

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> 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,

§

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§

default 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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.