How to get av1 hardware acceleration on av1 video file

My system runs ubuntu mate 22.04 LTS on alder lake 12500 cpu, so hardware wise, i know it support av1 hardware acceleration decoding for video playback. However, looking at sudo intel_gpu_top, hardware acceleration doesn't seem to work.

Anyone with experience can help?

AV1 hardware decoding driver for intel VAAPI was released in 2022 AFAIK just before Ubuntu-MATE 22.04 (Jammy Jellyfish) so I'm pretty sure it was not in time to make it into that version.

The fastest check you can do is from terminal:

vainfo

It will show you the list of supported decoders (VLD) and encoders (EncSlice)

There is a reasonable chance that Ubuntu-MATE 23.04 (Lunar Lobster) supports AV1 hardware decoding but you will have to check that yourself :slight_smile:

BTW, If 23.04 is able to decode AV1 in hardware , use MPV player to test it. Pressing ShiftI during playback will give you live information on the video including use of hardware decoding.
CtrlH will switch between hardware and software decoding.

1 Like

av1 related output of vainfo is only VAProfileAV1Profile0 : VAEntrypointVLD.

I mainly use mpv, with smplayer gui. I can confirm that CtrlH shows that hw codec (vaapi) only works on H264 and HEVC.

Can I check ubuntu mate 23.04 hardware decode support through live usb?

Good, that means the (VAAPI) driver supports AV1.

I don't know. You can at least try it.

1 Like

I'm running Lunar with 13th Gen. Results of vainfo. Don't know what it means. Always interested in learning what tkn has to say.

libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.17 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ()
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSliceLP
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSliceLP
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointEncSliceLP
VAProfileVP9Profile1 : VAEntrypointVLD
VAProfileVP9Profile1 : VAEntrypointEncSliceLP
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointEncSliceLP
VAProfileVP9Profile3 : VAEntrypointVLD
VAProfileVP9Profile3 : VAEntrypointEncSliceLP
VAProfileHEVCMain12 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointVLD
VAProfileHEVCMain422_12 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_10 : VAEntrypointVLD
VAProfileHEVCMain444_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_12 : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointEncSliceLP
VAProfileHEVCSccMain10 : VAEntrypointVLD
VAProfileHEVCSccMain10 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444 : VAEntrypointVLD
VAProfileHEVCSccMain444 : VAEntrypointEncSliceLP
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP

@mdd12, your vainfo output is identical to mine. except you have later driver.

can you try what @tkn suggested?

Interested to know your outcome.

Maybe this will add some useful info:

1 Like

:blush: Thanks for the kind words.

To explain the output of your vainfo command, let's translate that output to something a bit more readable:

Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ()

Video Decoding Capabilities (needed to play video):

[first column which probably looks familiar is the Codec column
the rest is about the complexity settings of the used encoding and might be less familiar]

JPEG    Baseline

MPEG2   Simple      Main

H264    Main        High          ConstrainedBaseline

HEVC    Main        Main10        Main12
        Main422_10  Main422_12    Main444    Main444_10    Main444_12
        SccMain     SccMain10     SccMain444 SccMain444_10

VP8     Version0_3

VP9     Profile0    Profile1      Profile2   Profile3

AV1     Profile0

Encoding Capabilities:

JPEG    Baseline

H264    Main        High        ConstrainedBaseline

HEVC    Main        Main10      Main444     Main444_10
        SccMain     SccMain10   SccMain444  SccMain444_10

VP9     Profile0    Profile1    Profile2    Profile3

To clarify a bit about video in general, things like:

avi mkv webm ogm mpg mp4 vob dv

are 'envelope' files. They contain:

one or more videostreams like:

AVC(=H264) HEVC(=H265) mpeg2 mpeg4 theora AV1 VC9 DV

and one or mode audiostreams like:

AC-3 mp3 opus vorbis wav aac aac-lc 

and one or more subtitle streams (either text or bitmapped ) like:

srt ssa ass pgm vtt sub psb

and some encoded timestamps and chapterinformation

When decoding in hardware , the hardware itself and the driver are not the only things needed:
The player also have to cooperate to get this up and running.

More (very very good) info on:
https://wiki.archlinux.org/title/Hardware_video_acceleration

EDIT:
If you want to know what mediastreams your videofile consists of, i would advise mediainfo

you can install the standalone gui-app:

sudo apt install mediainfo-gui

or the caja plugin:

sudo apt install caja-mediainfo

or both :slightly_smiling_face:

3 Likes

b.t.w. There is a chance that you only need a newer mpv version.
If you need newer drivers you might as well start using HWE kernels (which is probably the easiest solution)

1 Like

can you explain what is Profile0? I found out that my av1 file format profile is [email protected]. I lookup wikipedia about profile and level, nothing about profile0 is mentioned. It says there are 3 profile specifically Main, High, and Professional

Yes indeed, the info about it is hard to find.

I deleted my old post. I found the needed info in a PDF document downloaded from:
https://www.intel.com/content/www/us/en/products/docs/processors/core/core-technical-resources.html
12th Generation Intel® Core™ Processor Family (AlderLake)

This means for your hardware AV1 decoding:

profile: main (pixfmt=4:2:0 either 8 or 10 bit)
Level: L6.1
Max Resolution: 8K video @ 60fps / 16K pictures

So that would mean that you should be able to play a [email protected] encoded video.
(So you might try a newer MPV version)

2 Likes

I used celluloid which is supposed to be a front end to MPV. Is this what you were referring to?

2 Likes

Yes. :+1::slight_smile:
If you see the word VAAPI, it uses hardware decoding
(try Ctrl-H to switch between software and hardware decoding)

1 Like

Looks like celluloid doesn't show hwdec. You should try run the mpv / mplayer on terminal. then try the ShiftI again. It should show hwdec library used. I did this too because smplayer doesn't show hwdec.

2 Likes

That is a very useful and important observation. I didn't knew that. Tnx!

1 Like

Yes, the hardware surely support the format, but I guess the current driver does not? I have updated mpv to latest ver. 0.35.1. Still no hardware acceleration.

Also, hardware acceleration av1 playback on youtube also doesn't work , this is on firefox and firefox nightly too..

That is a reasonable thought.
OTOH people with older drivers seem to get it kind of working (except for some other problems they encountered).

See this 'hwdec / AV1 / mpv / ffmpeg' discussion:

I guess the situation should be somewhat better since then.

Last try, force the use of hwcodecs. Start from commandline:

mpv -v --hwdec=vaapi --hwdec-codecs=av1 --vo=gpu   videofile.mkv &>logfile

The '-v' option will generate a lot of diagnostic output which we can redirect to a logfile (named 'logfile' in this case but you are free to call it anyway you want.)
This logfile will (hopefully) reveal what's missing.

If that doesn't work, you might try a HWE kernel or even try out Ubuntu-MATE 23.04

Since even local playback doesn't work yet, that is only to be expected.

1 Like

Hi @tkn, I need your help. I am trying to compile the latest libva from source GitHub - intel/libva: Libva is an implementation for VA-API (Video Acceleration API)

on ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu I got the following output

Afaik, Extra window systems should be configured with drm x11 glx, and mine is missing x11 and glx. How to compile with x11 and glx window system?

Because there's no x11 configured, now I get the following error mpv: symbol lookup error: /lib/x86_64-linux-gnu/libva-x11.so.2: undefined symbol: va_fool_postp

Thanks. 23.04 with 13th gen mpv from the command line. It shows vaapi. I knew the Spice Girls wouldn't let me down. Screenshots below.


@mdd12 , Can you try playing av1 video? I'd like to know if av1 hardware accell works on ubuntu 23.04.