tool for taking a folder of videos and converting them to av1! best used with nekotrix's SVT-AV1-Essential
Files
README.md

auto-av1 #

Recursive AV1 re-encoder for a folder tree. Pipes ffmpeg into nekotrix's SVT-AV1-Essential fork of SvtAv1EncApp, copies audio/subtitles untouched, and writes a new file next to each source.

Features #

  • Walks a folder (and all subfolders) for video files
  • Encodes with ffmpeg | SvtAv1EncApp using a 10-bit yuv4mpegpipe bridge
  • Keeps audio and subtitles untouched (-c copy)
  • Defaults to .webm output; falls back to .mkv when audio/subs aren't WebM-compatible (non Opus/Vorbis audio, or non-WebVTT subs)
  • Output is named [original].av1.[webm|mkv] and placed next to the source
  • Optional in-place replacement: delete source and drop the .av1 suffix when the new file is smaller
  • Resume-friendly: skip sources that already have an AV1 sibling

Requirements #

  • ffmpeg and ffprobe in $PATH
  • SvtAv1EncApp in $PATH (stock svt-av1, or the nekotrix SVT-AV1-Essential fork — recommended)
  • Python 3.10+ (if running the script directly)

Install #

Arch Linux (AUR) #

paru -S auto-av1-folder-git   # or yay, etc.

From source (script) #

git clone https://tangled.org/aria.pds.witchcraft.systems/auto-av1
cd auto-av1
./auto-av1.py --help

Build a single-file binary (Nuitka) #

# deps: python, python-nuitka, gcc, patchelf
./build.sh
./auto-av1 --help

Produces a ~8 MB self-contained ELF executable (glibc-linked).

Usage #

auto-av1 [-h] [--crf CRF] [--preset PRESET] [--replace] [--resume] [--skip-av1] folder
Flag Description
folder Root directory to scan recursively
--crf CRF Constant Rate Factor, 1-70 in 0.25 steps (default 30)
--preset PRESET Preset 0-13 (→ --preset) or speed name slower/slow/medium/fast/faster (→ --speed). Default 4
--replace When the new AV1 file is smaller, delete the source and rename the output, dropping the .av1 suffix
--resume Skip any source that already has a .av1.{webm,mkv} sibling. Cheap filename check — avoids re-probing files from a previous run
--skip-av1 Skip sources whose video stream is already AV1 (requires an ffprobe call per file)
--progress {0,1,2} Forward --progress to SvtAv1EncApp (0=none, 1=basic, 2=detailed). Omit to use encoder default
--log-sizes Print a one-line before/after size summary per encoded file (and a grand total at the end)
--csv PATH Append per-file results to a CSV at PATH (creates header if new). Columns: source,output,action,source_bytes,output_bytes,delta_bytes,ratio_pct

Examples #

Encode a library at CRF 28, preset 4:

auto-av1 /media/videos --crf 28 --preset 4

Slow, high-quality re-encode with named speed:

auto-av1 /media/videos --crf 26 --preset slow

Batch re-encode with resume, replacing smaller originals, skipping already-AV1 files:

auto-av1 /media/videos --crf 28 --preset 4 --resume --skip-av1 --replace

How it works #

For each video file:

  1. ffprobe reads streams. Skip if there's no video stream. If --skip-av1 is set, also skip when the video stream is already AV1.
  2. Pick container: .webm if all audio is Opus/Vorbis and all subtitles are WebVTT; otherwise .mkv.
  3. Decode with ffmpeg to 10-bit yuv4mpegpipe on stdout.
  4. Pipe into SvtAv1EncApp with --crf and --preset/--speed, producing a temporary .ivf.
  5. Mux the .ivf video with the original audio/subtitles/attachments (-c copy) into the final container.
  6. If --replace and the new file is smaller than the source, delete the source and rename [name].av1.[ext] → [name].[ext].

Other encoder settings (tuning, psychovisual options, film grain, etc.) are left to SVT-AV1-Essential's defaults, which are tuned for good visual quality out of the box.

Notes #

  • Only CRF and preset are exposed to keep the CLI small. If you need different flags, edit the svt list in auto-av1.py.
  • Source files that already contain .av1 in the stem are skipped during the walk so re-running against a directory of previous outputs is a no-op.
  • Temporary .av1.tmp.ivf files are cleaned up on success and on failure.

License #

zlib