master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.4k stars 147 forks source link

--vmaf-filter fails #747

Closed mr44er closed 8 months ago

mr44er commented 1 year ago

av1an -i vid.mkv -o outtest.mkv --verbose --ffmpeg "-vf crop=1280:532:0:94" works as intended

av1an -i vid.mkv -o outtest.mkv --verbose --ffmpeg "-vf crop=1280:532:0:94" --vmaf-filter "crop=1280:532:0:94" --vmaf-res "1280x532" --target-quality 89 crashed after scene detection with:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: encoder crashed: exit status: 1
stdout:

stderr:
        [Parsed_libvmaf_5 @ 0x85a865140] input width must match.
        [Parsed_libvmaf_5 @ 0x85a865140] Failed to configure input pad on Parsed_libvmaf_5
        Error reinitializing filters!
        Failed to inject frame into filter network: Invalid argument
        Error while processing the decoded data for stream #1:0

source pipe stderr:
', av1an-core/src/settings.rs:1050:12
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

log.log:

DEBUG [av1an_core::settings] temporary directory: .1588a7b
INFO [av1an_core::settings] Input: 1280x720 @ 23.976 fps, YUV420P, SDR
INFO [av1an_core::settings] scenecut: found 752 scene(s) [with extra_splits (239 frames): 1009 scene(s)]
DEBUG [av1an_core::settings] Segmenting video
DEBUG [av1an_core::settings] Segment done

Same error with av1an -i vid.mkv -o outtest.mkv --verbose --ffmpeg "-vf crop=1280:532:0:94" --vmaf-filter "crop=1280:532:0:94" --target-quality 89 av1an -i vid.mkv -o outtest.mkv --verbose --ffmpeg " -vf crop=1280:532:0:94 " --vmaf-filter " crop=1280:532:0:94 " --target-quality 89

I'm out of ideas :)

Ravice commented 1 year ago

seems like the crop filter is not being injected into the probe encoder's ffmpeg arguments and is instead being overwritten by a select filter (i guess it's the probe rate filter to decimate fps, as it selects modN)

amusingly, this means if you simply remove the --vmaf-filter and --vmaf-res arguments as though you weren't cropping, it will work fine, as it just compares the uncropped probe to the uncropped original.

the vmaf analysis will be based on the uncropped video, and then encoded with your cropped range just fine.

mr44er commented 1 year ago

So the manual is outdated? https://github.com/master-of-zen/Av1an/blob/master/docs/TargetQuality.md

mr44er commented 8 months ago

Closing, everything works after testing again with new version yesterday.