Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement alternate input for scene detection V2 #814

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion av1an-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the two inputs don't have the same frame count?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the two inputs don't have the same frame count?

This needs a check, With at least a warning to prevent future hair pulling.

Copy link
Contributor Author

@BlueSwordM BlueSwordM Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed something that should be added to prevent... annoying reports in the future.
I still haven't tested what happens if the inputs don't have the same frame counts.

I'll do that over the weekend.

#[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
Loading