Encoding to AV1 with ffmpeg
4mon 18d ago by programming.dev/u/Rick_C137 in ffmpegHi,
I have videos that are encoded with H265 (1920x1080), I would like to encode them with AV1
So I'm running some benchmark from a 10sec extract.
That weight 24MB
I tested so far libaom-av1 and libsvtav1 both on CPU.
| Encoder | FPS | output MB |
|---|---|---|
| H265 extract | 24 | |
| Libaom-av1 | 2.2 | 15.4 |
| libsvtav1 | 53 | 33 |
Libaom-av1 commands
# new lines for readability
ffmpeg
-i extract10sec.mp4
-c:v libaom-av1
-crf 39
-c:a libopus
-compression_level 6
-cpu-used 6
-tile-columns 3
-tile-rows 1
-color_range pc
output_aom.mp4
libsvtav1 commands
ffmpeg
-i extract10sec.mp4
-c:v libsvtav1
-preset 12
-qp 32
-row-mt 1
-tile_columns 2
-threads 0
-c:a libopus
-compression_level 6
output_svt.mp4
With Libaom-av1 the file size is lower that the original H265
24 -> 15MB 👍
but the FPS is way too low ! 2.2 FPS 😭
with libsvtav1 the FPS is great ! 53 👍 but the file size suck, it's even bigger than the original :/ 24 -> 33MB
Unfortunately it seem that my GPU
NVIDIA GM204 [GeForce GTX 970]
Do not support AV1 encoding...
Any recommendations ? What are yours FPS to encode into AV1 ? with which setup ?
Thanks.
The encoding settings you’ve given for AOM and SVT don’t appear equivalent, so the speed, file-size and probably the ‘perceptual’ picture quality will be different. It’s probably possible to make the AOM encoder much faster, or the SVT encoder output smaller, just by adjusting a few key settings. You’ll need to fine-tune these to your own preferences based on your source video.
For the SVT-AV1 encode, you’re using “-preset 12”. That preset is a combination of settings designed to focus on encoding speed instead of quality. If you changed to “-preset 0” or “-preset 1”, the encoder would be considerably slower, but would give you better picture quality and probably better file-size. The equivalent for AOM encoder is “cpu-used” (0 = slowest but high quality; 8 = fastest but low quality). This page shows what each preset does in SVT, but there’s probably an equivalent page for the AOM encoder.
In your SVT settings, you’re using “-qp 32” and “-crf 39” for AOM. These settings are for defining the desired picture quality and bit-rate trade-off, but they work in different ways. For each, a higher number means lower-quality & file-size. When using ‘QP’ mode, the encoder usually applies the same quality setting for every frame of video. That means parts of your video will sometimes get more (or less) compression than they need, and the output could look uneven. ‘CRF’ mode lets the encoder vary the quality for each frame, trying to account for human perception, and making the output appear more even. Depending on how the encoder works internally, CRF is probably slower than QP, but it’s what I normally choose for archiving.
Your other settings (“tile-columns”, “tile-rows”, “threads”, “row-mt”) are more specific to the way the encoders work internally, and how they spread the processing load on your CPU. They could be useful if you need to limit the amount of cores/threads used, or ensure more are used, but I’d suggest adjusting those kinds of settings later on, after you find your desired quality/file-size/speed preference.
I’m more familiar with SVT-AV1, but my recommendation is to try benchmarking your settings with just one encoder at a time, focus on the presets first (maybe start around 4-6 if using SVT), then try different CRF values until you see the difference.
As for hardware encoding, your GTX 970 sadly can’t help. For AV1 encoding on consumer-level graphics cards, you’d need Nvidia 40 series, AMD 7000 series, Intel Arc/Xe2, or higher. Encoding with them is usually faster and more efficient, but I’ve found the quality is usually lower, even when requesting the highest-quality modes available. The options available also depend on chip maker – I can use QP quality mode with my AMD card, but not CRF, for example.
TLDR: try different presets to alter the speed, and then CRF values to determine your preferred quality/file-size trade-off.