Skip to content

Commit

Permalink
Implement alternate input for scene detection V3
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSwordM committed Feb 25, 2024
1 parent ff3009f commit 8bdc13d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion av1an-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl Av1anContext {

Ok(match self.args.split_method {
SplitMethod::AvScenechange => av_scenechange_detect(
&self.args.input,
self.args.input_sc.as_ref().unwrap_or(&self.args.input),
self.args.encoder,
self.frames,
self.args.min_scene_len,
Expand Down
1 change: 1 addition & 0 deletions av1an-core/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum InputPixelFormat {
#[allow(clippy::struct_excessive_bools)]
pub struct EncodeArgs {
pub input: Input,
pub input_sc: Option<Input>,
pub temp: String,
pub output_file: String,

Expand Down
6 changes: 6 additions & 0 deletions av1an/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ pub struct CliOpts {
#[clap(short, required = true)]
pub input: Vec<PathBuf>,

/// Alternate input for scene detection (must have the same frame count)
#[clap(short = 'I')]
pub input_sc: Option<PathBuf>,

/// Video output file
#[clap(short)]
pub output_file: Option<PathBuf>,
Expand Down Expand Up @@ -634,6 +638,7 @@ pub fn parse_cli(args: CliOpts) -> anyhow::Result<Vec<EncodeArgs>> {
};

let input = Input::from(input);
let input_sc = args.input_sc.as_ref().map(Input::from);

let video_params = if let Some(args) = args.video_params.as_ref() {
shlex::split(args).ok_or_else(|| anyhow!("Failed to split video encoder arguments"))?
Expand Down Expand Up @@ -731,6 +736,7 @@ pub fn parse_cli(args: CliOpts) -> anyhow::Result<Vec<EncodeArgs>> {
}
},
input,
input_sc,
output_pix_format,
resume: args.resume,
scenes: args.scenes.clone(),
Expand Down

0 comments on commit 8bdc13d

Please sign in to comment.