Fast & practical AV1 video encoding using ffmpeg
This command allows you to encode videos as AVI with near-realtime speed on commodity computers.
On a more modern AMD server, this works with a AMD Ryzen 5 3600, this works at up to 0.4x speed (~10..15 encode frames per second) for phone video up to ~2.5x for webinar-like video. However, some movies such as shaky phone video, will only work at 0.05x speed = 0.8 encoded frames per second. It really depends on many factors, and also will change a lot during encoding. You need to encode the entire video to judge both the speed and the resulting file size. On older computers, or for certain movie clips, this can still be horribly slow (Down to ~0.3 encoded frames per second). Consider using H.265 as an alternative, but keep in mind that it’s much, much less space-efficient.
ffmpeg -i input.mp4 -crf 35 -c:v libaom-av1 -usage realtime -tune 0 -c:a libopus -b:a 64k av1.mkv
The most important flag here is -usage realtime
which configures the encoder to use fast (as opposed to slow and more efficient) encoding.
-c:a libopus -b:a 64k
is optional here but if you’re investing the computing time into re-encoding your video, you might as well re-encode the audio to use a proper codec.
-tune 0
configures the encoder to optimize for visual quality.
See the ffmpeg info page on AV1 for more info. Note that at least on Ubuntu 22.04, only theĀ libaom-av1
encoder is included in the standardĀ ffmpeg
version.