Skip to main content

output_to_stream

Function output_to_stream 

Source
pub fn output_to_stream(
    custom_io: StreamIo,
    filename: Option<&str>,
    format: Option<&str>,
) -> Result<Output, Error>
Expand description

Creates an output context that writes to a writable context::StreamIo (created with StreamIo::from_write or StreamIo::from_write_seek).

The output format is inferred from filename or given explicitly via format; most muxers need a seekable stream for well-formed output. Call write_trailer before dropping the returned context — dropping only flushes what the muxer already emitted, it cannot finalize the file. Fails with EINVAL if custom_io is not a write context, if filename / format contain an interior NUL byte, or if the resolved muxer does its own I/O and would never write to the stream (AVFMT_NOFILE formats like image2 or output devices).