#[non_exhaustive]pub struct EncoderConfig {
pub codec: VideoCodec,
pub width: u32,
pub height: u32,
pub input_format: PixelFormat,
pub frame_rate: f64,
pub bitrate: Bitrate,
pub gop: Option<u32>,
pub repeat_headers: bool,
pub profile: Option<H264Profile>,
pub level: Option<H264Level>,
}Expand description
Configuration of a VideoEncoder.
Start from EncoderConfig::h264 and set the fields to change.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.codec: VideoCodecOutput codec.
width: u32Width of the encoded picture in pixels.
height: u32Height of the encoded picture in pixels.
input_format: PixelFormatPixel format of the source tensors.
frame_rate: f64Nominal frame rate, for rate control.
bitrate: BitrateTarget bitrate.
gop: Option<u32>Frames from one key frame to the next. None keeps the device
default.
repeat_headers: boolEmit the SPS and PPS with every key frame, so a receiver can start decoding at any key frame.
profile: Option<H264Profile>Profile. None selects High where the device offers it, and keeps
the device default where it does not. See
EncoderConfig::target_profile.
level: Option<H264Level>Level. None selects the lowest level that covers the stream where
the device offers it, and keeps the device default where it does not.
See EncoderConfig::target_level.
Implementations§
Source§impl EncoderConfig
impl EncoderConfig
Sourcepub fn h264(
width: u32,
height: u32,
input_format: PixelFormat,
frame_rate: f64,
) -> Self
pub fn h264( width: u32, height: u32, input_format: PixelFormat, frame_rate: f64, ) -> Self
An H.264 configuration with an automatic bitrate, profile and level, the device’s default GOP, and headers repeated on every key frame.
Sourcepub fn target_bitrate(&self) -> u32
pub fn target_bitrate(&self) -> u32
The target bitrate in bits per second: the Bitrate::Bps value, or
for Bitrate::Auto one derived from the frame size and rate.
Sourcepub fn target_profile(&self) -> H264Profile
pub fn target_profile(&self) -> H264Profile
The profile to request: EncoderConfig::profile, or High.
Sourcepub fn target_level(&self) -> Option<H264Level>
pub fn target_level(&self) -> Option<H264Level>
The level to request: EncoderConfig::level, or the lowest that
covers the size, frame rate and target bitrate
in the target profile. None when no level
covers them.