pub fn input<P: AsRef<Path> + ?Sized>(path: &P) -> Result<Input, Error>Expand description
Opens a media file for reading (demuxing).
This is the primary function for opening input files. It automatically detects the container format and probes all streams to gather codec information.
§Parameters
path- Path to the media file (supports various protocols: file://, http://, rtsp://, etc.)
§Returns
An context::Input that can be used to access streams and read packets.
§Errors
- File not found or inaccessible
- Unsupported or corrupted format
- Permission denied
§Example
ⓘ
let mut input = ffmpeg::format::input(&"video.mp4")?;
// Find the best video stream
let stream = input.streams().best(Type::Video).ok_or(Error::StreamNotFound)?;
let stream_index = stream.index();
// Create decoder for this stream
let decoder = stream.codec().decoder().video()?;