mpv and ffmpeg cannot play AV1 videos

Moderator: BarryK

Post Reply
SteveS
Posts: 45
Joined: Tue Sep 24, 2024 4:00 pm
Has thanked: 1 time
Been thanked: 16 times

mpv and ffmpeg cannot play AV1 videos

Post by SteveS »

To save energy and bandwidth with yt-dlp (or youtube-dl), I use the following line in my mpv configuration file located at ~/.config/mpv/mpv.conf:

Code: Select all

ytdl-format="bestvideo[height<=?720][fps<=?30][vcodec!~='vp0?9']+bestaudio/best"

Unlike a large TV screen, I find that a PC monitor doesn't necessarily need to play heavier VP9 YouTube videos above 720p. Smaller AV1 alternatives are sufficient.

However, the issue is that by avoiding VP9 videos, mpv often cannot play any lighter alternative of a video encoded in AV1, giving this error message:

Code: Select all

[ffmpeg/video] av1: Your platform doesn't support hardware accelerated AV1 decoding.
[ffmpeg/video] av1: Failed to get pixel format.
Error while decoding frame!
[ffmpeg/video] av1: Missing Sequence Header.
Error while decoding frame!

(in the terminal, press 'Ctrl+c' to stop the repeating message and return to the prompt)

The truth is that this is not a hardware issue but a software one. It's simply that our version of ffmpeg does not support AV1 decoding.

Possible solutions:

1. As seen here: https://stackoverflow.com/a/70829069 we can install a ffmpeg build with support of an AV1 decoder such as libdav1d. Available at: https://johnvansickle.com/ffmpeg/

or:

2. As stated here: https://trac.ffmpeg.org/wiki/Compilatio ... u#libdav1d we can install libdav1d-dev and configure ffmpeg with:

Code: Select all

--enable-libdav1d
User avatar
BarryK
Posts: 2974
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 159 times
Been thanked: 825 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by BarryK »

Is this Easy Scarthgap or Daedalus?

SteveS
Posts: 45
Joined: Tue Sep 24, 2024 4:00 pm
Has thanked: 1 time
Been thanked: 16 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by SteveS »

EasyOS Scarthgap.

Here are the steps to reproduce:

1. Create the mpv.conf file. To create mine:

Code: Select all

mkdir /root/.config/mpv

then:

Code: Select all

tee /root/.config/mpv/mpv.conf <<EOF
# Video format/quality that is directly passed to yt-dlp
# yt-dlp: https://github.com/yt-dlp/yt-dlp
ytdl-format="bestvideo[height<=?720][fps<=?30][vcodec!~='vp0?9']+bestaudio/best"

# If using yt-dlp, you can add this script:
# mpv_sponsorblock_minimal: https://codeberg.org/jouni/mpv_sponsorblock_minimal

# Start in fullscreen mode by default
fs=yes

# Create a video output window even if there is no video
force-window=yes
EOF

2. Install yt-dlp:

Code: Select all

curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp

then:

Code: Select all

chmod a+rx /usr/local/bin/yt-dlp

3. Open a YouTube video encoded in VP9 and AV1 by typing the corresponding mpv command in the terminal.

For more privacy and no ads at all, we will use an Invidious instance (instead of the YouTube site) searching for example: "Linux on Asus Zenbook S 13".
We get this page of results: https://yewtu.be/search?q=Linux+on+Asus ... sort=views
Let's try playing this video entitled "Thin.... but not dumb! - ASUS Zenbook S 13 OLED":

Code: Select all

mpv https://yewtu.be/watch?v=tXWebwlfqfc

The video cannot be played at all in my case and I have to press 'Ctrl+c' to stop the repeating error messages and return to the prompt.

And of course, same result with the corresponding YouTube link:

Code: Select all

mpv https://www.youtube.com/watch?v=tXWebwlfqfc
User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

@SteveS

I was intrigued at your post and thought of possible alternative method of playback.

This has only been tested with Fossapup95 using the BBC Iplayer as the source.

Using yt-dlp for your links, I am informed that it is 'throttled' and therefore unable to playback.

So, I ended up using the BBC Iplayer service instead.

I am using FFMPeg and MPV.

Image

Using yt-dlp I listed the formats that were available to me and then choose an AV1 file for playback.

As you see in my command it is then piped to mpv for immediate playback.

Image

Image

SteveS
Posts: 45
Joined: Tue Sep 24, 2024 4:00 pm
Has thanked: 1 time
Been thanked: 16 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by SteveS »

@Jasper

Thank you for your research.

What you found with the BBC seems interesting, so I wanted to test it myself.

Here is my MPV:
Image

And FFmpeg:
Image

I tried to find BBC iPlayer video streams... except that the service is not available outside the UK:
Image

So I searched for direct links to BBC videos without going through the BBC website and found this, for example:
Image

With yt-dlp I tried to list the formats that were available, but my geolocation prevents me from doing so:
Image

And for the same reasons, I couldn't open the video either:
Image

As a result, I couldn't verify any BBC AV1 videos.
Life is unfair sometimes...

For anyone interested,

Here are 2 sites offering AV1 test videos:
https://av1.webmfiles.org/
https://test-videos.co.uk/sintel/mp4-av1

In my case with EasyOS, even though sometimes the audio may work, the videos won't play.

Alternative methods for streaming videos from the terminal, without consuming the resources of a web browser, could deserve a topic of their own, but I doubt the subject would interest normal people.

User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

@SteveS

For you desired link, there is no need for the text description eg

Code: Select all


https://www.bbc.co.uk/iplayer/episode/m0009tt8

Here are the formats for the link you provided:

https://i.postimg.cc/kGw5yzgz/1.webp

https://i.postimg.cc/GpRZc2QP/2.webp

https://i.postimg.cc/9QBjwZzg/3.webp

https://i.postimg.cc/kGWH3PbY/4.webp

https://i.postimg.cc/T33tQDC4/5.webp

Have you attempted to use the GeoBypass option?

https://yt-dlp.memoryview.in/docs/advan ... -in-yt-dlp

If you use the 'verbose' command it will give you detailed information.

Code: Select all


yt-dlp --verbose --list-formats https://www.bbc.co.uk/iplayer/episode/m0009tt8

User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

Here's the detailed information from your YouTube link:

https://i.postimg.cc/8cQLrthn/Screensho ... 81911.webp

https://i.postimg.cc/g2k8RwZd/Screensho ... 81926.webp

Unofficial yt-dlp guide - GeoBlock options:

https://yt-dlp-docs.netlify.app/docs/ad ... in-yt-dlp

Finally, it might be worth trying a proxy tool (single binary) :

https://github.com/DNSCrypt/dnscrypt-proxy

User avatar
bugnaw333
Posts: 440
Joined: Wed Jul 20, 2022 11:04 pm
Location: Cebu, Philippines
Has thanked: 645 times
Been thanked: 96 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by bugnaw333 »

Here are 2 sites offering AV1 test videos:
https://av1.webmfiles.org/
https://test-videos.co.uk/sintel/mp4-av1

@Jasper
No audio on EasyOS Daedalus. :shock:

User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

@bugnaw333

I am not familiar with the OS setup.

One of the files that I viewed on that website using LibreWolf-136.0.4-1 shows me the video with audio playback.

http://temp.sh/rowjc/LibreWolf-136.0.4-1.sfs

My animation files are GIF's, so a little slow in playback with no audio.

https://i.postimg.cc/cC1g0yD4/librewolf.gif

I did download the file and played it using mpv.

Code: Select all


wget https://dl6.webmfiles.org/BigBuckBunny-AV1.webm
 

Fossapup95 uses ALSA for audio.

https://i.postimg.cc/FzKB5wmj/reduced.gif

Could it be an issue that you do not have LibOpus ?

AV1-video-OPUS-audio.webp

This should be available in FFMpeg.

Have you tried playback using an alternative media player like VLC?

SteveS
Posts: 45
Joined: Tue Sep 24, 2024 4:00 pm
Has thanked: 1 time
Been thanked: 16 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by SteveS »

Thanks again @Jasper

In the links for the BBC video, in the VCODEC column I see the formats 'avc3' and 'avc1' listed.

If I'm not mistaken, AVC1 and AVC3 videos are not AV1 encoded. They are formats of the H.264/AVC codec, which is a different video compression standard.
AV1 is a newer codec designed to provide better compression efficiency than H.264/AVC or even H.265/HEVC. AV1 belongs to a different family of codecs.
There really is enough to get lost in all of this!

Have you attempted to use the GeoBypass option?

https://yt-dlp.memoryview.in/docs/advan ... -in-yt-dlp

and

Unofficial yt-dlp guide - GeoBlock options:

https://yt-dlp-docs.netlify.app/docs/ad ... in-yt-dlp

Finally, it might be worth trying a proxy tool (single binary) :

https://github.com/DNSCrypt/dnscrypt-proxy

To be honest, I hadn't thought about all of that at the time, but I confirm that yt-dlp --geo-bypass https://www.bbc.co.uk/iplayer/episode/m0009tt8 and yt-dlp --geo-bypass-country UK https://www.bbc.co.uk/iplayer/episode/m0009tt8 don't work either (same error as before).

But apparently, people seem to really struggle with the BBC geo-ip filtering since the era of youtube-dl in 2020:
https://www.linuxquestions.org/question ... 175680199/

Then I remembered having already seen the 'avc1' format (like for the BBC video) almost every time I've listed YouTube video formats...

Time for a new test:

Let's take this video https://www.youtube.com/watch?v=9bZkp7q19f0 having 'vp09', 'av01', 'vp9' and 'avc1'.

To force the 'avc1' format only (to play H.264 encoded video) I replaced in my mpv.conf file this line:

Code: Select all

ytdl-format="bestvideo[height<=?720][fps<=?30][vcodec!~='vp0?9']+bestaudio/best"

with this one:

Code: Select all

ytdl-format="bestvideo[height<=?720][fps<=?30][vcodec~='^(avc|h264)']+bestaudio/best"

I found inspiration here:
https://github.com/yt-dlp/yt-dlp/issues ... 1821393561

Then I ran the command:

Code: Select all

mpv https://www.youtube.com/watch?v=9bZkp7q19f0

Result:
It works.
EasyOS Scarthgap can stream AVC1 videos (H.264/AVC codec) without issue.

But not videos with AV1 codec.

For that, we still need to compile FFmpeg with libdav1d or install libdav1d-dev and configure FFmpeg with:

Code: Select all

--enable-libdav1d

All this perhaps explains why BBC iPlayer videos might work out-of-the-box.

bugnaw333 wrote: Thu Apr 03, 2025 1:11 pm

Here are 2 sites offering AV1 test videos:
https://av1.webmfiles.org/
https://test-videos.co.uk/sintel/mp4-av1

@Jasper
No audio on EasyOS Daedalus. :shock:

For me it's the opposite:
Audio ok but no video on EasyOS Scarthgap :)

User avatar
N97
Posts: 127
Joined: Tue Dec 10, 2024 3:27 am
Has thanked: 6 times
Been thanked: 24 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by N97 »

As a recent build check is in order at this point...
libdav1d is version 7.0.0

You may also need libSvtAv1Enc which is at version 2.2.0

VoidPup64-100924 has these exact files
and mpv is at version 0.39.0

Regards
N97

From Netscape to AI scrape. We're running short of bandages.

User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

@SteveS

Do you want to create a 'new' topic in the Multimedia section?

I was about to share some more information that you might find useful and decided not to as is generic in nature and I am mindful this is the EasyOS section.

User avatar
don570
Posts: 795
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 6 times
Been thanked: 155 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by don570 »

Screenshot 2025-04-04 16.33.51.png
Screenshot 2025-04-04 16.33.51.png (13.08 KiB) Viewed 344 times

When I download with my Dell Chromebook using Chrome OS
I don't hear any audio with the video
_________________________________________

User avatar
bugnaw333
Posts: 440
Joined: Wed Jul 20, 2022 11:04 pm
Location: Cebu, Philippines
Has thanked: 645 times
Been thanked: 96 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by bugnaw333 »

Still no audio on Mercury, Chrome, and Opera browsers. :(
@Jasper
LibOpus is already installed in EasyOS by default. :thumbup:

Attachments
Screenshot(94).png
Screenshot(94).png (95.12 KiB) Viewed 335 times
User avatar
bugnaw333
Posts: 440
Joined: Wed Jul 20, 2022 11:04 pm
Location: Cebu, Philippines
Has thanked: 645 times
Been thanked: 96 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by bugnaw333 »

@Jasper

for MPV and Celluloid:
1. BigBuck Bunny--video&Audio OK. :thumbup2:
2. BeachYoga--video OK but no audio
3. BeachDrone--video OK but no audio

for VLC version 3.0.21:
1. BigBuck Bunny-- with audio but no video
2. BeachYoga and BeachDrone--will play but no display and no audio, black screen.

SteveS
Posts: 45
Joined: Tue Sep 24, 2024 4:00 pm
Has thanked: 1 time
Been thanked: 16 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by SteveS »

Jasper wrote: Fri Apr 04, 2025 10:34 am

@SteveS

Do you want to create a 'new' topic in the Multimedia section?

I was about to share some more information that you might find useful and decided not to as is generic in nature and I am mindful this is the EasyOS section.

No problem, you can create a new topic there and share the link here!

I'm certain you could teach us a lot of interesting things, and I also think other members of the forum might appreciate it.

User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

@bugnaw333

The files provided are a combination of "video (only)" and "video and audio"

https://av1.webmfiles.org/

Which is why you get different results with your media player.

For example this 1920x1080 sample file is "video only"

https://i.postimg.cc/fLnr3PCR/Screensho ... 82329.webp

Personally, I do not have issues with my older setup:

https://i.postimg.cc/13CQ9qNj/Screensho ... 81322.webp

User avatar
Jasper
Posts: 1906
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 909 times
Been thanked: 392 times

Re: mpv and ffmpeg cannot play AV1 videos

Post by Jasper »

SVT1Enc is an 'encoder' only.

https://i.postimg.cc/qMT65c7V/Screensho ... 92858.webp

When compiling it will use cpuinfo to find out which instructions your processor it capable eg SSE.

It is cpu intensive.

A better option would be to purchase and use a dedicated graphics card which utilises VA-API.

Libdav1d is a 'decoder' (VLC)

https://i.postimg.cc/4xFfgz3L/Screensho ... 03347.webp

Post Reply

Return to “EasyOS”