====== ffmpeg - Conversions - Convert H264 to AV1 - libaom - Two-Pass ======
In order to create more efficient encodes when a particular target bitrate should be reached, two-pass encoding should be used.
Two-pass encoding is also beneficial for encoding efficiency when constant quality is used without a target bitrate.
* For two-pass, you need to run ffmpeg twice, with almost the same settings, except for:
* In pass 1 and 2, use the **-pass 1** and **-pass 2** options, respectively.
* In pass 1, output to a null file descriptor, not an actual file. (This will generate a logfile that ffmpeg needs for the second pass.)
* In pass 1, you can leave audio out by specifying **-an**.
time ffmpeg -i a.mp4 -c:v libaom-av1 -b:v 2M -pass 1 -an -f null /dev/null && time ffmpeg -i a.mp4 -c:v libaom-av1 -b:v 2M -pass 2 -c:a libopus -f mp4 out.mp4
time ffmpeg -i a.mp4 -c:v libaom-av1 -b:v 2000k -pass 1 -an -f null /dev/null && time ffmpeg -i a.mp4 -c:v libaom-av1 -b:v 2000k -pass 2 -ac 2 -c:a libopus -f mp4 out.mp4x
returns:
...
real 98m40.037s
user 567m32.622s
sys 0m26.253s
**NOTE:**
* Input test size: 75.5M
* Output test size: 4.2M
**NOTE:** The bitrate limit by the **-b:v** where the bitrate MUST be non-zero.
* **Opus** is a totally open, royalty-free, highly versatile audio codec.