Skip to main content

StreamInfo

Struct StreamInfo 

Source
pub struct StreamInfo {
Show 23 fields pub index: i32, pub codec_name: String, pub codec_long_name: String, pub codec_type: String, pub profile: String, pub width: i32, pub height: i32, pub pix_fmt: String, pub level: i32, pub field_order: String, pub color_range: String, pub color_space: String, pub color_transfer: String, pub color_primaries: String, pub duration: f64, pub bit_rate: i64, pub nb_frames: i32, pub r_frame_rate: String, pub avg_frame_rate: String, pub sample_rate: i32, pub channels: i32, pub channel_layout: String, pub bits_per_raw_sample: i32,
}
Expand description

Per-stream metadata reported by ffprobe.

Fields§

§index: i32

Stream index within the container.

§codec_name: String

Short codec name (e.g. "h264").

§codec_long_name: String

Human-readable codec name.

§codec_type: String

Stream type: "video", "audio", or "subtitle".

§profile: String

Codec profile (e.g. "High").

§width: i32

Pixel width (video).

§height: i32

Pixel height (video).

§pix_fmt: String

Pixel format (e.g. "yuv420p").

§level: i32

Codec level.

§field_order: String

Field/scan order (e.g. "progressive").

§color_range: String

Color range (e.g. "tv"/"pc").

§color_space: String

Color matrix / space.

§color_transfer: String

Color transfer characteristics (e.g. "smpte2084" for PQ).

§color_primaries: String

Color primaries (e.g. "bt2020").

§duration: f64

Stream duration in seconds.

§bit_rate: i64

Stream bitrate in bits per second.

§nb_frames: i32

Number of frames, when known.

§r_frame_rate: String

Raw frame rate as a rational string (e.g. "25/1").

§avg_frame_rate: String

Average frame rate as a rational string (e.g. "25/1").

§sample_rate: i32

Audio sample rate in Hz.

§channels: i32

Audio channel count.

§channel_layout: String

Audio channel layout (e.g. "stereo").

§bits_per_raw_sample: i32

Bits per raw sample (used to detect high-bit-depth/HDR content).

Implementations§

Source§

impl StreamInfo

Source

pub fn validate(&self) -> Result<()>

Returns an error unless this is a video stream with positive dimensions.

Source

pub fn fps(&self) -> f64

Frame rate parsed from r_frame_rate (e.g. “50/1” -> 50.0).

Source

pub fn resolution_str(&self) -> String

Returns "WIDTHxHEIGHT", or an empty string if dimensions are unknown.

Source

pub fn hdr_kind(&self) -> Option<&'static str>

Detects HDR type from color metadata: "PQ", "HLG", "BT.2020", or None for SDR.

Source

pub fn is_hdr(&self) -> bool

Returns true if the stream carries HDR color metadata.

Trait Implementations§

Source§

impl Clone for StreamInfo

Source§

fn clone(&self) -> StreamInfo

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 Debug for StreamInfo

Source§

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

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

impl<'de> Deserialize<'de> for StreamInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StreamInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more