Skip to main content

OutputSpec

Struct OutputSpec 

Source
pub struct OutputSpec {
Show 13 fields pub mode: OutputMode, pub video_codec: VideoCodec, pub audio: AudioPolicy, pub container: Container, pub muxer: Muxer, pub rungs: Vec<Rung>, pub max_frame_rate: Option<f64>, pub gpu_index: Option<u32>, pub encode_policy: EncodePolicy, pub decode_gpu: Option<u32>, pub color: ColorPolicy, pub bit_depth: BitDepth, pub chunk_seam_mode: ChunkSeamMode,
}
Expand description

Full output specification for a transcode job.

Fields§

§mode: OutputMode

Output shape.

§video_codec: VideoCodec

Video codec (AV1 only today).

§audio: AudioPolicy

Audio handling.

§container: Container

Container format.

§muxer: Muxer

Muxer.

§rungs: Vec<Rung>

The ladder. Order is preserved; the first rung is treated as the “primary” for single-file callers that only want one output.

§max_frame_rate: Option<f64>

Cap the output frame rate (the encoder’s signalled fps is clamped to this; the source cadence is otherwise preserved). None = source fps.

§gpu_index: Option<u32>

Pin hardware encode/decode to this GPU index on multi-GPU hosts. Kept in sync with encode_policy (SingleGpu(idx)gpu_index = idx).

§encode_policy: EncodePolicy

How to spread encode work across GPUs. See EncodePolicy.

§decode_gpu: Option<u32>

Decode-pump GPU override. None (default) pins the decode pump to a GPU consistent with encode_policy (the first device of the selected family/set, round-robin for per-rung pumps). Some(i) forces decode onto GPU i — e.g. decode on an iGPU while the dGPUs encode.

§color: ColorPolicy

Output color / tonemap policy. See ColorPolicy.

§bit_depth: BitDepth

Output bit depth. See BitDepth.

§chunk_seam_mode: ChunkSeamMode

How the multi-GPU single-file path keeps quality consistent across the chunk seams it stitches. See ChunkSeamMode.

Implementations§

Source§

impl OutputSpec

Source

pub fn single_file(rungs: Vec<Rung>) -> Self

One self-contained MP4 per rung (AV1 + Opus/passthrough audio).

Source

pub fn hls(rungs: Vec<Rung>, segment_seconds: f32) -> Self

A segmented CMAF + HLS package with the given rungs and segment length.

Source

pub fn with_audio(self, audio: AudioPolicy) -> Self

Set the audio policy.

Source

pub fn with_max_frame_rate(self, fps: f64) -> Self

Cap output frame rate.

Source

pub fn with_gpu_index(self, idx: u32) -> Self

Pin to a GPU index. Implies EncodePolicy::SingleGpu(Some(idx)).

Source

pub fn encode_policy(self, policy: EncodePolicy) -> Self

Select the GPU encode policy: a single (optionally pinned) GPU, or all GPUs (the multi-GPU engine).

// chunk-encode across every GPU and stitch:
let _ = OutputSpec::single_file(rungs.clone()).encode_policy(EncodePolicy::AllGpus);
// serial encode, pinned to GPU 1:
let _ = OutputSpec::single_file(rungs).encode_policy(EncodePolicy::SingleGpu(Some(1)));
Source

pub fn decode_gpu(self, idx: Option<u32>) -> Self

Pin the decode pump to a specific GPU index, independent of the encode policy. None (the default) follows encode_policy. Useful to decode on an integrated GPU while discrete GPUs encode, or to keep decode on one device while encode chunks across several.

Source

pub fn with_color(self, color: ColorPolicy) -> Self

Set the output color / tonemap policy (SDR tonemap vs HDR passthrough).

Source

pub fn with_bit_depth(self, depth: BitDepth) -> Self

Set the output bit depth (Auto / EightBit / TenBit). Sets bits per sample only — the gamut/SDR-HDR choice is Self::with_color. For HDR you usually don’t need this (the HDR ColorPolicy implies 10-bit).

Source

pub fn web_sdr(self) -> Self

Web-safe SDR (the default): BT.709 8-bit, tonemapping any HDR source down. Plays everywhere. Same as .with_color(TonemapToSdr) .with_bit_depth(EightBit).

Source

pub fn hdr10(self) -> Self

HDR10: BT.2020 wide gamut + PQ transfer, 10-bit, no tonemap. Needs a 10-bit HDR encoder (nvidia / amd / qsv / ffmpeg). Same as .with_color(Hdr10) — the policy already implies 10-bit.

Source

pub fn hlg(self) -> Self

HLG: BT.2020 wide gamut + HLG transfer, 10-bit, no tonemap. Same as .with_color(Hlg).

Source

pub fn passthrough(self) -> Self

Passthrough: keep the source’s gamut, transfer, and bit depth verbatim. Same as .with_color(Passthrough).

Source

pub fn chunk_seam_mode(self, mode: ChunkSeamMode) -> Self

Set how the multi-GPU single-file path handles chunk seams (Parallel fastest / ParallelConstQp seam-flat / Serial seam-free).

Source

pub fn tonemaps(&self) -> bool

Whether the decode pump tonemaps HDR→SDR for this spec (policy-driven — the pump never decides on its own).

Source

pub fn resolve_output( &self, source_color: ColorMetadata, source_pixel_format: PixelFormat, ) -> (ColorMetadata, PixelFormat)

Resolve the encoder’s input (color_metadata, pixel_format) for a given source. The default (TonemapToSdr + Auto) reproduces the legacy source-driven fold: HDR sources collapse to 8-bit SDR; SDR sources keep their own bit depth and color. Hdr10/Hlg force BT.2020 10-bit; Passthrough keeps the source; pixel_format overrides the bit depth.

Source

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

Reject incoherent specifications.

Trait Implementations§

Source§

impl Clone for OutputSpec

Source§

fn clone(&self) -> OutputSpec

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 OutputSpec

Source§

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

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

impl Default for OutputSpec

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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