Skip to content

Instantly share code, notes, and snippets.

@mrintrepide
Last active November 13, 2024 07:11
Show Gist options
  • Save mrintrepide/b3009f5d0f08d437ebbb4c17cbf36e18 to your computer and use it in GitHub Desktop.
Save mrintrepide/b3009f5d0f08d437ebbb4c17cbf36e18 to your computer and use it in GitHub Desktop.
AV1 quick encode with SVT-AV1

SVT-AV1 is the fastest multithreaded AV1 encoder
You can download up to date BtbN ffmpeg build with latest STV-AV1 code.

Aom-av1 is the official av1 decoder/encoder but it's the slowest and lacks of a real massive multithreading.
Rav1e is a xiph encoder project. It's also very slow but you can use multithreading with tiles.
Dav1d is a veryfast AV1 VLC decoder project.

Svt-av1 is an heavy multithreading intel decoder and encoder. It produce good quality but bigger file size.
It can produce 8 and 10 bit video with CRF (default), CQP, VBR and CBR (test).
Two pass are also available with standalone SvtAv1EncApp but not in ffmpeg.

Like HEVC and VP9, 8 bit low bitrate video create banding. 10 bit is prefered. Today intel/amd/nvidia/qualcomm/mediatek hardware video decoder support hevc, vp9 and now av1 10 bit. It produce better dark/black anime scene in 10 bit and smaller file size.

Base ffmpeg

Default:
ffmpeg -i "Input.mkv" -c:v libsvtav1 -crf 35 -preset 6 -c:a libopus -b:a 128k -ac 2 -c:s copy Output.mkv

Optimal 8 bit:
ffmpeg -i "Input.mkv" -c:v libsvtav1 -crf 35 -preset 6 -svtav1-params tune=0 -g 240 -c:a libopus -b:a 128k -ac 2 -c:s copy Output.mkv

Optimal with 10 bit:
ffmpeg -i "Input.mkv" -pix_fmt yuv420p10le -c:v libsvtav1 -crf 35 -preset 6 -svtav1-params tune=0 -g 240 -c:a libopus -b:a 128k -ac 2 -c:s copy Output.mkv

-pix_fmt yuv420p10le convert input video to 10 bit format
-g 240 set gop size to 10s for 24 fps video

Speed

-preset set speed (0 to 13), 13 is for test and debug.
6 for medium, 4 for slow
Lower than 3 is extremly slow, higher than 9 are too destructive.

Quality

-crf use value 35 is good, but you can use 32-35 to produce small file

Custom svt-av1 parameters

-svtav1-params specify custom svt-av1 parameters to encoder, use like this tune=0:film-grain=8:fast-decode=0

tune 0 for Visual quality, 1 for PSNR optimisation

@drizzt
Copy link

drizzt commented Jun 21, 2023

-crf use value 35 is good, but you can use 32-35 to produce small file
crf of 32 is BIGGER than 35.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment