Skip to content

Commit

Permalink
feat: add input argument alias
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanbabcock committed Feb 18, 2023
1 parent 8290b8b commit 40f699c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/h265_transcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main() {

// One instance decodes H265 to raw frames
let mut input = FfmpegCommand::new()
.args(&["-i", input_path])
.input(input_path)
.rawvideo()
.spawn()
.unwrap();
Expand All @@ -37,7 +37,7 @@ fn main() {
.args(&[
"-f", "rawvideo", "-pix_fmt", "rgb24", "-s", "600x800", "-r", "30",
]) // note: should be possible to infer these params from the source input stream
.args(&["-i", "-"])
.input("-")
.args(&["-c:v", "libx265"])
.args(&["-y", "output/h265_overlay.mp4"])
.spawn()
Expand Down
7 changes: 7 additions & 0 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ pub struct FfmpegCommand {
impl FfmpegCommand {
//// Argument presets

/// Alias for `-i` argument, setting the input file path or URL.
pub fn input<S: AsRef<str>>(&mut self, value: S) -> &mut Self {
self.arg("-i");
self.arg(value.as_ref());
self
}

/// Generate a procedural test video.
/// Equivalent to `ffmpeg -i lavfi -f testsrc`
///
Expand Down

0 comments on commit 40f699c

Please sign in to comment.