-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Add audio and subtitle stream parsing
* Refactor code into common processing for all streams and spezialized functions for audio and video. * Update code examples * Change line breaks in lib.rs to LF * Add handling of streams that contain additional identifiers in square brackets such as `Stream #0:1[0x2](eng):`. These are found in mov containers.
- Loading branch information
Alexey Abel
committed
Oct 15, 2024
1 parent
701b7df
commit 3e3d3db
Showing
8 changed files
with
383 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,62 @@ | ||
//! Wrap a standalone FFmpeg binary in an intuitive Iterator interface. | ||
//! | ||
//! ## Example | ||
//! | ||
//! ```rust | ||
//! use ffmpeg_sidecar::{command::FfmpegCommand, event::FfmpegEvent}; | ||
//! | ||
//! fn main() -> anyhow::Result<()> { | ||
//! FfmpegCommand::new() // <- Builder API like `std::process::Command` | ||
//! .testsrc() // <- Discoverable aliases for FFmpeg args | ||
//! .rawvideo() // <- Convenient argument presets | ||
//! .spawn()? // <- Uses an ordinary `std::process::Child` | ||
//! .iter()? // <- Iterator over all log messages and video output | ||
//! .for_each(|event: FfmpegEvent| { | ||
//! match event { | ||
//! FfmpegEvent::OutputFrame(frame) => { | ||
//! println!("frame: {}x{}", frame.width, frame.height); | ||
//! let _pixels: Vec<u8> = frame.data; // <- raw RGB pixels! 🎨 | ||
//! } | ||
//! FfmpegEvent::Progress(progress) => { | ||
//! eprintln!("Current speed: {}x", progress.speed); // <- parsed progress updates | ||
//! } | ||
//! FfmpegEvent::Log(_level, msg) => { | ||
//! eprintln!("[ffmpeg] {}", msg); // <- granular log message from stderr | ||
//! } | ||
//! _ => {} | ||
//! } | ||
//! }); | ||
//! Ok(()) | ||
//! } | ||
//! ``` | ||
//! | ||
|
||
#[cfg(test)] | ||
mod test; | ||
|
||
pub mod child; | ||
pub mod comma_iter; | ||
pub mod command; | ||
pub mod download; | ||
pub mod event; | ||
pub mod ffprobe; | ||
pub mod iter; | ||
pub mod log_parser; | ||
pub mod metadata; | ||
pub mod paths; | ||
pub mod pix_fmt; | ||
pub mod read_until_any; | ||
pub mod version; | ||
//! Wrap a standalone FFmpeg binary in an intuitive Iterator interface. | ||
//! | ||
//! ## Example | ||
//! | ||
//! ```rust | ||
//! use ffmpeg_sidecar::{command::FfmpegCommand, event::FfmpegEvent}; | ||
//! | ||
//!fn main() -> anyhow::Result<()> { | ||
//! FfmpegCommand::new() // <- Builder API like `std::process::Command` | ||
//! .testsrc() // <- Discoverable aliases for FFmpeg args | ||
//! .rawvideo() // <- Convenient argument presets | ||
//! .spawn()? // <- Uses an ordinary `std::process::Child` | ||
//! .iter()? // <- Iterator over all log messages and video output | ||
//! .for_each(|event: FfmpegEvent| { | ||
//! match event { | ||
//! FfmpegEvent::OutputFrame(frame) => { | ||
//! println!("frame: {}x{}", frame.width, frame.height); | ||
//! let _pixels: Vec<u8> = frame.data; // <- raw RGB pixels! 🎨 | ||
//! } | ||
//! FfmpegEvent::Progress(progress) => { | ||
//! eprintln!("Current speed: {}x", progress.speed); // <- parsed progress updates | ||
//! } | ||
//! FfmpegEvent::Log(_level, msg) => { | ||
//! eprintln!("[ffmpeg] {}", msg); // <- granular log message from stderr | ||
//! } | ||
//! FfmpegEvent::ParsedInputStream(stream) => { | ||
//! if stream.is_video() { | ||
//! let video_data = stream.video_data(); | ||
//! println!( | ||
//! "Found video stream with index {} in input {} that has fps {}, width {}px, height {}px.", | ||
//! stream.stream_index, | ||
//! stream.parent_index, | ||
//! video_data.fps, | ||
//! video_data.width, | ||
//! video_data.height | ||
//! ); | ||
//! } | ||
//! } | ||
//! _ => {} | ||
//! } | ||
//! }); | ||
//! Ok(()) | ||
//! } | ||
//! ``` | ||
//! | ||
|
||
#[cfg(test)] | ||
mod test; | ||
|
||
pub mod child; | ||
pub mod comma_iter; | ||
pub mod command; | ||
pub mod download; | ||
pub mod event; | ||
pub mod ffprobe; | ||
pub mod iter; | ||
pub mod log_parser; | ||
pub mod metadata; | ||
pub mod paths; | ||
pub mod pix_fmt; | ||
pub mod read_until_any; | ||
pub mod version; |
Oops, something went wrong.