AV2, the AOMedia codec that follows AV1, already has a software decoder in VideoLAN's dav2d, but FFmpeg's main branch had no AV2 decoder at the end of October, so mpv and the players built on libmpv cannot open AV2 files on their own.
I wrote a small program for the desktop version of my open source player, Immuch360, that closes that gap without touching the player: it decodes with dav2d and serves the pictures as a raw y4m stream over HTTP, on 127.0.0.1 only. mpv opens that address like a file, seeks included. It now has a repository of its own, under the MIT licence: https://github.com/immuch360/av2-companion
What it is:
- one program of about 2 MB for Windows x64, Linux x64 and macOS (Apple silicon and Intel), with dav2d linked statically
- the Windows program is signed since 1.0.1; the macOS one is signed ad hoc, so a copy downloaded by a browser needs its quarantine removed, as the README shows
- AV2 in IVF files and plain OBU streams, 4:2:0, 8 and 10 bits
- seeks to any picture: it starts again at the random access point before it
- a paused player costs no processor time
With Python 3.9 or later and mpv, unzip the archive of your system from the latest release, clone the repository, then:
python3 av2-companion/tools/feed_ivf.py video.ivf --program av2/immuch360-av2 --play
Without --play it prints the address and the mpv command, for any other player. The README describes the protocol for a player that wants to drive the program itself.
What it is not:
- not a decoder of its own: the decoding is dav2d's, the program is a thin layer around it
- not hardware decoding: dav2d runs on the processor, with its SIMD code
- no audio, and one video per program
- 4:0:0, 4:2:2, 4:4:4 and 12-bit are refused; dav2d is pinned at a commit of 2 November that decodes the final v1.0.0 bitstream, so streams from encoders older than AVM v1.0.0 may not decode
Speed is the real limit. Measured with dav2d alone, in multiples of real time:
| CPU |
1080p30 8-bit |
4K30 8-bit |
1080p30 10-bit |
4K24 10-bit |
| Intel Core i5-1145G7, 4 cores |
4.0x |
1.24x |
1.20x |
0.31x |
| Intel Core i9-13980HX, 24 cores |
7.7x |
|
|
0.99x |
8-bit plays up to 4K30 on a recent 4 core laptop. 10-bit is three to four times slower, because the SIMD code of dav2d's loop filters exists in 8 bits only for now, so 10-bit 4K needs a high end processor and is at its limit even there. Below 1.0x the video stalls.
If you only want to check a clip, dav2d's own command line tool can already write y4m to standard output. This program is for players: seeks, and an address they can open without any change to their decoding.
The test streams decode bit for bit like the reference decoder of AVM v1.0.0. Reports on other streams and other CPUs are welcome.