Skip to content

FFmpeg AV1

holzkohlengrill edited this page Dec 15, 2023 · 3 revisions

AV1 encoding with ffmpeg >=4.1 using libaom reference encoder, use e.g. a static build for ffmpeg (see https://johnvansickle.com/ffmpeg/)

one pass fixed bitrate encoding:

ffmpeg -y -i "$infile" -vf scale=-2:"$res" \
    -pix_fmt yuv420p \
    -c:v libaom-av1 \
    -b:v "$bitrate" \
    -cpu-used 4 \
    -an -strict -2 "$outfile".mkv

$infile=input file, $res=height of video, $bitrate=bitrate, e.g. 1M, $outfile=output file

two pass fixed bitrate encoding:

# first pass
./ffmpeg -y -i "$infile" -vf scale=-2:"$res" \
    -pix_fmt yuv420p \
    -c:v libaom-av1 \
    -b:v "$bitrate" \
    -cpu-used 4 \
    -pass 1 \
    -passlogfile "$infile"_pass1_av1_"$res"p_"$bitrate" \
    -an -strict -2 "$infile"_pass1_av1_"$res"p_"$bitrate".mkv

# second pass
./ffmpeg -y -i "$infile" -vf scale=-2:"$res" \
    -pix_fmt yuv420p \
    -c:v libaom-av1 \
    -b:v "$bitrate" \
    -cpu-used 4 \
    -pass 2 \
    -passlogfile "$infile"_pass1_av1_"$res"p_"$bitrate" \
    -an -strict -2 "$infile"_pass2_av1_"$res"p_"$bitrate".mkv

similar input values like in one pass, outputfilename is automatically generated.

To slow down or speed up calculations change the -cpu-used 4 parameter, a low value means longer calculations with a higher quality and a 8 means ultra fast and low quality, this is similar to presets in HEVC/AVC.

Python 3

(un)fold
Snippets
General
Libs

Linux/bash

(un)fold
Guides
Scripts

Git

(un)fold

C/C++

(un)fold

Video

(un)fold

Databases

(un)fold

Misc

(un)fold

Windows

(un)fold

Mac

(un)fold

SW recommendations

(un)fold

(Angular) Dart

(un)fold
Clone this wiki locally