pub fn output<P: AsRef<Path> + ?Sized>(path: &P) -> Result<Output, Error>Expand description
Opens a media file for writing (muxing).
Creates a new output file with format auto-detected from the file extension. The file is created/truncated and ready for writing after adding streams.
§Parameters
path- Path to the output file
§Returns
An context::Output that can be used to add streams and write packets.
§Errors
- File cannot be created (permission denied, invalid path)
- Format cannot be determined from extension
- Unsupported format
§Example
ⓘ
let mut output = ffmpeg::format::output(&"output.mp4")?;
// Add video stream
let mut stream = output.add_stream(encoder)?;
stream.set_parameters(&encoder);
// Write header
output.write_header()?;
// Write packets...
output.write_packet(&packet)?;
// Finalize
output.write_trailer()?;