Skip to main content

EncoderConfig

Struct EncoderConfig 

Source
pub struct EncoderConfig { /* private fields */ }
Expand description

Configuration for the Encoder.

Setting missing? Please file a PR!

Implementations§

Source§

impl EncoderConfig

Source

pub const fn new() -> Self

Creates a new default encoder config.

Source

pub const fn bitrate(self, bps: BitRate) -> Self

Sets the requested bit rate in bits per second.

Source

pub const fn debug(self, value: bool) -> Self

Enables detailed console logging inside OpenH264.

Source

pub const fn skip_frames(self, value: bool) -> Self

Set whether frames can be skipped to meet desired rate control target.

Source

pub const fn max_frame_rate(self, value: FrameRate) -> Self

Sets the requested maximum frame rate in Hz.

Source

pub const fn usage_type(self, value: UsageType) -> Self

Sets the usage type (e.g, screen vs. camera recording).

Source

pub const fn rate_control_mode(self, value: RateControlMode) -> Self

Sets the requested rate control mode.

Source

pub const fn sps_pps_strategy(self, value: SpsPpsStrategy) -> Self

Set the SPS/PPS behavior.

Source

pub const fn max_slice_len(self, max_slice_len: u32) -> Self

Set the maximum slice length

Source

pub const fn profile(self, profile: Profile) -> Self

Set the encoding profile

Source

pub const fn level(self, level: Level) -> Self

Set the encoding profile level

Source

pub const fn complexity(self, complexity: Complexity) -> Self

Set the complexity

Source

pub const fn qp(self, value: QpRange) -> Self

Set the balance between compression and size

Source

pub const fn scene_change_detect(self, value: bool) -> Self

Set scene change detect (on by default)

Source

pub const fn adaptive_quantization(self, value: bool) -> Self

Set adaptive quantization control (on by default)

Source

pub const fn background_detection(self, value: bool) -> Self

Set background detection (on by default)

Source

pub const fn long_term_reference(self, value: bool) -> Self

Set use of long term reference (off by default)

Source

pub const fn intra_frame_period(self, value: IntraFramePeriod) -> Self

Set the interval of intra frames (0 by default, disabling periodic intra frames)

Source

pub const fn num_threads(self, threads: u16) -> Self

Sets the number of internal encoder threads.

  • 0 - auto mode
  • 1 - single threaded operation
  • >1 - fixed number of threads

Defaults to 0 (auto mode).

Source

pub const fn vui(self, config: VuiConfig) -> Self

Sets the VUI (Video Usability Information) parameters.

VUI parameters are written into the H.264 SPS NAL unit and tell decoders how to interpret the color space of the video data. This is essential for correct color reproduction.

§Example
use openh264::encoder::{EncoderConfig, VuiConfig};

let config = EncoderConfig::new()
    .vui(VuiConfig::bt709());  // HD content with BT.709 color space

See VuiConfig for common presets like bt709(), srgb(), and bt601().

Trait Implementations§

Source§

impl Clone for EncoderConfig

Source§

fn clone(&self) -> EncoderConfig

Returns a duplicate 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

Source§

fn default() -> EncoderConfig

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

impl Copy for EncoderConfig

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

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.