* Fixed scd/ranges detection added : --scenes the fast_av1an_command to generate scenes.json moved get_ranges() to after fast_pass() occurrences * Refactor calculate_zones() - Replaced "--metrics" and "--zones" arguments with "--method" - Reorganized argument parsing - Renamed "zones" variable to less ambiguous "method" - Changed tqdm unit from "iterations" to "frames" - Updated get_xpsnr() to return "skip" like get_ssimu2() (Note: not used by XPSNR, so skip is set to 1) * Changed output paths ssimu2.log, xpsnr.log & fast_pass output in tmp_dir added compile_latest.py. Uses pyinstaller * Changed temporary files output paths * Added a tqdm progressbar for XPSNR calculation Added smoothing for SSIMU2 tqdm progressbar * Fixed a wrong output path for ssimu2.log and xpsnr.log * Fixed xpsnr.log file path error * Fixed the xpsnr.log file path fix
Auto-boost Algorithm
Auto-Boost-Next:
Soon™️
Version 2.5: SSIMULACRA2&XPSNR-based
The requirements are Vapoursynth, LSMASHSource, Av1an, vszip and a few python library libraries. Optionally: ffmpeg built with XPSNR support, turbo-metrics.
Refined 2.0 with the following additions & changes:
- Proper argument parsing, more control over the script
- Separated the fast encode, metric calculation and zone creation into three independant, callable stages
- Replaced the deprecated
vapoursynth-ssimulacra2byvszip - Added
turbo-metricsfor GPU-accelerated metrics measurement (Nvidia only) - Added XPSNR metric and a few zones calculation methods
- Taking advantage of SVT-AV1-PSY quarter-step CRF feature for more granular control
- Possibility to use a more aggressive boosting curve
- And a few other smaller changes...
Many thanks to R1chterScale, Yiss and Kosaka for iterating on auto-boost and making these amazing contributions!
Version 2.0: SSIMULACRA2-based
Does a fast encode of the provided file, calculates SSIMULACRA2 scores of each chunks and adjusts CRF per-scene to be closer to the average total score, in a zones.txt file to feed Av1an. The requirements are Vapoursynth, LSMASHSource, fmtconv, Av1an and vapoursynth-ssimulacra2.
Usage:
python auto-boost_2.0.py "{animu.mkv}" {base CQ/CRF/Q}
Example:
python auto-boost_2.0.py "path/to/nice_boat.mkv" 30
Advantages:
- Lower quality deviation of individual scenes in regards to the entire stream
- Better allocates bitrate in more complex scenes and compensates by giving less bitrate to scenes presenting some headroom for further compression
Known limitations:
- Slow process
- No bitrate cap in place so the size of complex scenes can go out of hand
- The SSIMULACRA2 metric is not ideal, plus the score alone is not representative enough of if a CRF adjustement is relevant in the context of that scene (AI will save)
Borrowed some code from Sav1or's SSIMULACRA2 script
Version 1.0: brightness-based
Gets the average brightness of a scene and lowers CQ/CRF/Q the darker the scene is, in a zones.txt file to feed Av1an. The requirements are Vapoursynth, vstools and LSMASHSource.
Usage:
python auto-boost_1.0.py "{animu.mkv}" "{scenes.json}" {base CQ/CRF/Q} "{encoder: aom/svt-av1/rav1e (optional)}"
Example:
python auto-boost_1.0.py "path/to/nice_boat.mkv" "path/to/scenes.json" 30
Advantages:
- Fast
- No bs
- Solves one long-lasting issue of AV1 encoders: low bitrate allocation in dark scenes
Known limitations:
- Not every dark scene is made equal, brightness is not a great enough metric to determine whether CRF should be decreased or not
- CRF is boosted to the max during credits
- Script now entirely irrelevant with SVT-AV1-PSY's new frame-luma-bias feature
Inspiration was drawn from the original Av1an (python) boosting code