diff --git a/av1an-core/src/context.rs b/av1an-core/src/context.rs index 770ad6a3..85ffe58a 100644 --- a/av1an-core/src/context.rs +++ b/av1an-core/src/context.rs @@ -360,17 +360,19 @@ impl Av1anContext { temp_res = tq.vmaf_res.to_string(); } - if let Err(e) = vmaf::plot( - self.args.output_file.as_ref(), - &self.args.input, - tq.model.as_deref(), - temp_res.as_str(), - tq.vmaf_scaler.as_str(), - 1, - tq.vmaf_filter.as_deref(), - tq.vmaf_threads, - ) { - error!("VMAF calculation failed with error: {}", e); + if self.args.vmaf { + if let Err(e) = vmaf::plot( + self.args.output_file.as_ref(), + &self.args.input, + tq.model.as_deref(), + temp_res.as_str(), + tq.vmaf_scaler.as_str(), + 1, + tq.vmaf_filter.as_deref(), + tq.vmaf_threads, + ) { + error!("VMAF calculation failed with error: {}", e); + } } } diff --git a/av1an-core/src/settings.rs b/av1an-core/src/settings.rs index 2a7d7727..9400409e 100644 --- a/av1an-core/src/settings.rs +++ b/av1an-core/src/settings.rs @@ -77,6 +77,7 @@ pub struct EncodeArgs { pub concat: ConcatMethod, pub target_quality: Option, + pub vmaf: bool, } impl EncodeArgs { diff --git a/av1an/src/main.rs b/av1an/src/main.rs index e649eef4..702d569c 100644 --- a/av1an/src/main.rs +++ b/av1an/src/main.rs @@ -742,6 +742,7 @@ pub fn parse_cli(args: CliOpts) -> anyhow::Result> { args.force_keyframes.as_deref().unwrap_or(""), )?, target_quality: args.target_quality_params(temp, video_params, output_pix_format.format), + vmaf: args.vmaf, verbosity: if args.quiet { Verbosity::Quiet } else if args.verbose {