mirror of
https://github.com/eRgo35/ascii.git
synced 2026-02-03 20:36:10 +01:00
video path added
This commit is contained in:
@@ -74,6 +74,9 @@ pub enum Subcommands {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Vid {
|
Vid {
|
||||||
|
#[arg(short, long, default_value_t = String::from(""))]
|
||||||
|
input: String,
|
||||||
|
|
||||||
#[arg(long, default_value_t = false)]
|
#[arg(long, default_value_t = false)]
|
||||||
invert: bool,
|
invert: bool,
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use ffmpeg_next::software::scaling::{context::Context, flag::Flags};
|
|||||||
use ffmpeg_next::util::frame::video::Video;
|
use ffmpeg_next::util::frame::video::Video;
|
||||||
|
|
||||||
pub fn video(
|
pub fn video(
|
||||||
|
input_path: String,
|
||||||
invert: bool,
|
invert: bool,
|
||||||
colorful: bool,
|
colorful: bool,
|
||||||
width: usize,
|
width: usize,
|
||||||
@@ -21,12 +22,17 @@ pub fn video(
|
|||||||
) {
|
) {
|
||||||
ffmpeg_next::init().unwrap();
|
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
|
let input = ictx
|
||||||
.streams()
|
.streams()
|
||||||
.best(Type::Video)
|
.best(Type::Video)
|
||||||
.ok_or(ffmpeg_next::Error::StreamNotFound)
|
.ok_or(ffmpeg_next::Error::StreamNotFound)
|
||||||
.unwrap();
|
.expect("Failed to find video stream");
|
||||||
let video_stream_index = input.index();
|
let video_stream_index = input.index();
|
||||||
|
|
||||||
let context_decoder =
|
let context_decoder =
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ fn main() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Some(libs::args::Subcommands::Vid {
|
Some(libs::args::Subcommands::Vid {
|
||||||
|
input,
|
||||||
invert,
|
invert,
|
||||||
colorful,
|
colorful,
|
||||||
width,
|
width,
|
||||||
@@ -53,7 +54,7 @@ fn main() {
|
|||||||
lightmap,
|
lightmap,
|
||||||
}) => {
|
}) => {
|
||||||
libs::vid_handler::video(
|
libs::vid_handler::video(
|
||||||
invert, colorful, width, height, pixel, noresize, matrix, nofill, lightmap,
|
input, invert, colorful, width, height, pixel, noresize, matrix, nofill, lightmap,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|||||||
Reference in New Issue
Block a user