====== ffmpeg - Conversions - Convert H264 to AV1 ======
While AV1 is used to create video files, it is not a file format.
* Rather, it is a compression format that any program that saves video files can use to compress videos.
* AV1 videos are most commonly saved using one of several more common video container formats, such as MP4, MKV, and WEBM.
* However, in rare circumstances, you may encounter an AV1 video saved with the **.av1** extension.
There are various methods to convert to AV1.
AV1 is implemented in **libaom** and **svt-av1**.
* [[ffmpeg:Conversions:Convert H264 to AV1:libaom|libaom]]
* [[ffmpeg:Conversions:Convert H264 to AV1:svt-av1|svt-av1]]
----
ffmpeg -y -i a.mp4 -c:v libaom-av1 -strict -2 -b:v 3000K -maxrate 6000K -cpu-used 8 -pass 2 out.mp4
ffmpeg -i input.mp4 -c:v av1 output.av1
ffmpeg -y -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 3000K -maxrate 6000K -cpu-used 8 -pass 1 -f matroska NUL & \
ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 3000K -maxrate 6000K -cpu-used 0 -pass 2 output_AV1.mkv
**NOTE:** This is extremely slow!
* This uses the **libaom-av1** encoder.
**NOTE:** AV1 is implemented in **libaom** and **svt-av1**.
* Libaom is the reference codec, it produces smaller files than svt-av1 but it is slow.
* The svt-av1 encoder is optimized for speed and produces bigger files than libaom.
----
===== Simple method, with Quality/Speed ratio modifier =====
ffmpeg -y -i a.mp4 -c:v libaom-av1 -cpu-used 8 -f mp4 out.mp4
**NOTE:** The **-cpu-used 8** option sets the quality to the higher.
----
===== Simple usage =====
ffmpeg -y -i a.mp4 -c:v libaom-av1 -f mp4 out.mp4
**NOTE:** It is extremely slow.
----
===== References =====
https://trac.ffmpeg.org/wiki/Encode/AV1