pub struct VideoParams {
pub width: u32,
pub height: u32,
pub frame_rate: Rational,
pub pixel_format: PixelFormat,
pub color_space: ColorSpace,
pub chroma_location: ChromaLocation,
pub display_aspect_ratio: Option<Rational>,
pub bit_depth: u8,
pub bitrate_bps: Option<u64>,
}Expand description
Video stream encoding / decoding parameters.
Fields§
§width: u32Frame width in pixels.
height: u32Frame height in pixels.
frame_rate: RationalFrame rate as a rational number (e.g. Rational::new(30, 1) for 30 fps,
Rational::new(30000, 1001) for ≈29.97 fps).
pixel_format: PixelFormatPixel format (default: PixelFormat::Yuv420p).
color_space: ColorSpaceColour space (default: ColorSpace::Bt709).
chroma_location: ChromaLocationChroma sample location (default: ChromaLocation::Left).
display_aspect_ratio: Option<Rational>Display aspect ratio, if different from the storage aspect ratio.
bit_depth: u8Bit depth per colour component (8 for standard, 10 or 12 for HDR).
bitrate_bps: Option<u64>Target or measured peak bitrate in bits per second, if known.
Implementations§
Source§impl VideoParams
impl VideoParams
Sourcepub fn new(width: u32, height: u32, frame_rate: Rational) -> Self
pub fn new(width: u32, height: u32, frame_rate: Rational) -> Self
Creates minimal VideoParams with width, height, and frame_rate.
All other fields receive sensible defaults:
pixel_format=PixelFormat::Yuv420pcolor_space=ColorSpace::Bt709bit_depth= 8
Sourcepub fn storage_aspect_ratio(&self) -> Rational
pub fn storage_aspect_ratio(&self) -> Rational
Returns the storage aspect ratio width / height as a Rational.
Sourcepub fn effective_aspect_ratio(&self) -> Rational
pub fn effective_aspect_ratio(&self) -> Rational
Returns the display aspect ratio, falling back to the storage aspect ratio when not explicitly set.
Sourcepub fn pixel_count(&self) -> u64
pub fn pixel_count(&self) -> u64
Returns the total number of pixels per frame.
Sourcepub fn with_pixel_format(self, fmt: PixelFormat) -> Self
pub fn with_pixel_format(self, fmt: PixelFormat) -> Self
Builder-style setter for pixel format.
Sourcepub fn with_color_space(self, cs: ColorSpace) -> Self
pub fn with_color_space(self, cs: ColorSpace) -> Self
Builder-style setter for colour space.
Sourcepub fn with_bit_depth(self, depth: u8) -> Self
pub fn with_bit_depth(self, depth: u8) -> Self
Builder-style setter for bit depth.
Sourcepub fn with_bitrate(self, bps: u64) -> Self
pub fn with_bitrate(self, bps: u64) -> Self
Builder-style setter for bitrate.
Trait Implementations§
Source§impl Clone for VideoParams
impl Clone for VideoParams
Source§fn clone(&self) -> VideoParams
fn clone(&self) -> VideoParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more