video path added

This commit is contained in:
2024-07-08 18:28:05 +02:00
parent 91051a82be
commit 763c82a89e
3 changed files with 13 additions and 3 deletions

View File

@@ -74,6 +74,9 @@ pub enum Subcommands {
},
Vid {
#[arg(short, long, default_value_t = String::from(""))]
input: String,
#[arg(long, default_value_t = false)]
invert: bool,

View File

@@ -9,6 +9,7 @@ use ffmpeg_next::software::scaling::{context::Context, flag::Flags};
use ffmpeg_next::util::frame::video::Video;
pub fn video(
input_path: String,
invert: bool,
colorful: bool,
width: usize,
@@ -21,12 +22,17 @@ pub fn video(
) {
ffmpeg_next::init().unwrap();
if let Ok(mut ictx) = input("bad_apple.webm") {
if input_path.is_empty() {
eprintln!("Error: No input path provided");
std::process::exit(1);
}
if let Ok(mut ictx) = input(&input_path) {
let input = ictx
.streams()
.best(Type::Video)
.ok_or(ffmpeg_next::Error::StreamNotFound)
.unwrap();
.expect("Failed to find video stream");
let video_stream_index = input.index();
let context_decoder =

View File

@@ -42,6 +42,7 @@ fn main() {
);
}
Some(libs::args::Subcommands::Vid {
input,
invert,
colorful,
width,
@@ -53,7 +54,7 @@ fn main() {
lightmap,
}) => {
libs::vid_handler::video(
invert, colorful, width, height, pixel, noresize, matrix, nofill, lightmap,
input, invert, colorful, width, height, pixel, noresize, matrix, nofill, lightmap,
);
}
None => {