Hey all,
Storage is crazy expensive right now! Thought I'd share a script I've been building that helps convert your Plex library to the more efficient AV1 format. The GitHub readme in the link below provides all the fine details of what the script can do. I've dropped my Plex library from 8TB to 3.5TB with no perceptible quality loss on my 65" 4K OLED TV (though 3/4 of my library was direct BD rips to H.265)
Works with H.264, H.265, HDR10, Dolby Vision, pretty much any video format FFmpeg 9.0 supports. It's highly tunable, and the Auto settings focus on keeping the conversion as close to lossless as possible while reducing file size as much as possible.
Batch your entire library or run single videos through one or two+ at a time. Maximum of four concurrent encoders is supported with the RTX 5090 (3 engines), three with the RTX 5080 and RTX 4090 (2 engines) - otherwise two (GPU + CPU+ for all other Nvidia 4/5-series cards. This means CPU + however many video encoding engines your GPU has. SVT-AV1 on CPU is the default as this provides the highest quality at the lowest file size but is 8x slower. Automation for batches can intelligently assign encoding sessions to either the CPU or Nvidia GPU depending on the video content. RTX 3000 and earlier series do not support AV1 encoding - in this case CPU is your only option. In theory, if you have a modern Core Ultra Intel CPU, you could run 1x CPU, 1x Quicksync, plus the max encoder engines your dedicated GPU has.
There's a lot of tools out there to do this already, but this script can intelligently scan your library, find eligible candidates for compression, and focus on those. Not every video benefits from the conversion in a way that makes it worth the time or quality loss from lossy compression - it works best with high-quality content, though low and medium quality content can still benefit. If a file will not benefit from conversion, it tells you and won't run the conversion.
Additionally, it performs pre-pass runs on each video file to determine the best settings for each file. Film Grain pass is particularly important as film grain is very difficult to compress - it uses AV1's built-in film grain tech to analyze grain, strip it, compress the video, and re-introduce that same grain back.
For now, this is Windows only and requires Powershell 7. I'll write it for Linux and Mac if anybody requests it, though I don't have a way to test on MacOS. I can add AMD Radeon support as well, but again, I don't have a way to test Radeon support either.
- AV1 via CPU SVT-AV1, NVIDIA NVENC or Intel Quick Sync, chosen per file, with concurrent workers
- Measured quality targeting — the CRF is searched for and verified, not guessed
- Honest about the metric's limits — where an absolute VMAF target cannot discriminate (grainy film transfers), the file is converted at the Auto CRF rather than refused, and the run says so
- HDR10 static metadata survives the re-encode — mastering display colour volume, MaxCLL/MaxFALL
- Dolby Vision converted, not skipped — Profiles 7, 8 and 10 become correct HDR10; Profile 5 is refused by design
- HDR10+ preserved where the toolchain supports it; HLG stays HLG
- Per-file Auto analysis for
CRF, Preset, FilmGrain and AutoCRFOffset - Persistent queue with live pause / resume / stop controls and crash recovery
- Seven built-in tools — diagnose the toolchain, rank conversion candidates, calibrate thresholds, normalise loudness, census a library, calibrate CPU/GPU speed or benchmark CPU threading, verify output
- CSV + session logging, and a summary at the end of every run
Check it out on my GitHub - there's far more details about what this script can do and how to use it - I think you'll be pleasantly surprised! I'm always looking for more ways to improve it, please send recommendations on the Issues tab if you have any.
https://github.com/emike09/Video-AV1-Optimizer