dav1d
37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0dav1d is the fastest AV1 decoder on all platforms :) Targeted to be small, portable and very fast.
dav1d (“dav1d is an AV1 decoder”) is the AV1 software decoder from VideoLAN, developed largely by Two Orioles and VideoLAN contributors. It supports every AV1 feature, bit depth (8, 10 and 12) and chroma subsampling, and has hand-written assembly for x86 (SSE2 up to AVX-512) and Arm, which makes it much faster than libaom’s decoder. It is BSD-2-Clause licensed so that anyone can embed it.
You rarely run it directly: it is the AV1 decoder inside FFmpeg (libdav1d), VLC, mpv, Firefox and Chromium-based browsers, so whenever you watch an AV1 encode without hardware decoding, dav1d is probably doing the work. The standalone dav1d tool is still handy for checking how hard a stream is to decode and whether two decodes are identical.
Get it
Section titled “Get it”Most Linux distributions, Homebrew and MSYS2 package it as dav1d (the library and the CLI). To build it, you need Meson, Ninja and, on x86, NASM:
git clone https://code.videolan.org/videolan/dav1d.gitcd dav1d && meson setup build && ninja -C buildThe binary is build/tools/dav1d. The canonical repository is on VideoLAN’s GitLab; the GitHub repository is a mirror.
Use the CLI
Section titled “Use the CLI”dav1d reads raw AV1 only: IVF, Annex B or Section 5 OBU streams. It cannot open MKV, WebM or MP4, so extract the track first:
mkvextract input.mkv tracks 0:video.ivfffmpeg -i input.mp4 -map 0:v:0 -c copy video.ivfThen:
dav1d -i video.ivf -o decoded.y4m # decode to Y4Mdav1d -i video.ivf --muxer null # decode and discard, printing the speeddav1d -i video.ivf --muxer null --threads 1 # single-threaded speeddav1d -i video.ivf --muxer md5 -o decoded.md5 # MD5 of the decoded frames, without grainThe --muxer null run is the quickest way to see whether an encode will play smoothly on a weak device: compare the fps with one or two threads against the video’s frame rate. Resolution, frame rate and film-grain synthesis all raise decode cost.
| Option | Default | Use |
|---|---|---|
--threads N | 0 (all cores) | Worker threads. |
--framedelay N | 0 (automatic) | Maximum frames in flight; 1 gives lowest latency at the cost of speed. |
--filmgrain 0/1 | 1 | Apply signalled film grain. An explicit --muxer md5 or xxh3, and --verify, switch it off so checksums cover the picture without grain; -o file.md5 alone still applies grain. |
--limit N | none | Stop after N frames. |
--skip N | 0 | Skip the first N frames. |
--verify MD5 | off | Decode and compare against an expected MD5; exits non-zero on a mismatch. |
--cpumask | all | Restrict SIMD (sse2, ssse3, sse41, avx2, avx512icl) to see how slower CPUs fare. |
--oppoint N, --alllayers | 0, 1 | Choose the operating point and layers of scalable streams. |
In FFmpeg
Section titled “In FFmpeg”FFmpeg uses libdav1d automatically for AV1 when the build includes it; FFmpeg’s native AV1 decoder only works with hardware acceleration. Decoder options go before -i. To decode without applying film grain, for example to look at the encoded picture before synthesis, export the grain parameters instead of applying them:
ffmpeg -export_side_data film_grain -i input.mkv -c:v ffv1 nograin.mkvThe older -filmgrain 0 option does the same but is deprecated. -threads, -max_frame_delay, -oppoint and -alllayers correspond to the CLI options above.
Related pages
Section titled “Related pages”- AV1
- FFmpeg and MKVToolNix