Force VLC to use VA-API for Hardware Accellerated Video Decoding

tl;dr: add the --avcodec-hw=vaapi option on the command line or to the Exec option in the .desktop file.

It’s stupid, I know, but it’s been bothering me for a while now. Especially when I want to watch conference talks that are available in the AV1 video format (e.g. FOSDEM) the video always seems to hang (show an old frame indefinitely), have broken decoding (shows alternating weirdly colored blocks), de-sync from audio or just stay black. This is happening on both Intel and AMD integrated graphics for years now, and I somehow decided that VDPAU must be the culprit. I also definitely know that VA-API works on my machines, because I’ve tested it … so that can’t be the problem. 😇

VLC (generally) supports both VA-API (mainly for Intel and AMD hardware) and VDPAU (for Nvidia) libraries for hardware accelerated video decoding, but on my Ubuntu desktop machines prefers VDPAU on any hardware for some reason. The settings don’t even show support for anything else: “Simple Preferences” -> “Input/Codecs” tab -> “Hardware-accelerated decoding” only shows “Automatic”, “VDPAU video decoder” and “Disable” options. 😵‍💫 The only “variant” that correctly uses VA-API automatically on my machines is the VLC Flatpak. I checked which backend was used via the “Modules Tree” tab in the “Tools” -> “Messages” dialog. It will show “vdpau”-something in the “video output” subtree (or not).

The Solution

So I dug through weird forums and tried different suggested options, of those many weren’t even supported until I found the right incantation: --avcodec-hw=vaapi .

Fixing the .desktop file

To make your desktop always call VLC with the right options we have to edit VLC’s so-called .desktop file. Mine was located in /usr/share/applications/vlc.desktop.
The relevant line looked like this: Exec=/usr/bin/vlc --started-from-file %U .

Copy the vlc.desktop file to either the $HOME/.local/share/applications/ directory if you want to change the behavior only for you. Alternatively if you have root privileges you can update vlc.desktop for all users of that machine by copying it to /usr/local/share/applications/ . NOTE: you may need to create those directories first.

Then edit the Exec= line to look like this: Exec=/usr/bin/vlc --avcodec-hw=vaapi --started-from-file %U

Or if you want to just copy the relevant commands:

# create the directory for personal .desktop files
mkdir -p $HOME/.local/share/applications/

# copy the original vlc.desktop to this directory
cp /usr/share/applications/vlc.desktop $HOME/.local/share/applications/

# edit the copied vlc.desktop by changing its "Exec" option to include the relevant VLC option
desktop-file-edit --set-key=Exec --set-value="/usr/bin/vlc --avcodec-hw=vaapi --started-from-file %U" $HOME/.local/share/applications/vlc.desktop

Enjoy!

JavaScript History’s Future as Seen From 2022

Brian Sletten presents an overview of the WebAssembly landscape, the development direction and applications it enables. I can’t but notice that we’re really on the path to WebAssembly becoming the JavaScript-derived universal runtime Gary Bernhardt promised in 2014. 🤯

Abspielen
Das Video wird von Youtube eingebettet abespielt. Es gilt die Datenschutzerklärung von Google

X: the dumbest OS you’ve ever seen

For future reference: Daniel Stone dispels myths about “great” X is and why it’s actually former X maintainers that designed and implemented Wayland.

Abspielen
Das Video wird von Youtube eingebettet abespielt. Es gilt die Datenschutzerklärung von Google

We Really Are Engineers 🎉

Hillel Wayne interviewed people who have worked professionally both as a software and a traditional engineer (from a diverse set of engineering disciplines) to determine if “software engineers” are really engineers … and, yes we are.

He also analyzes myths from and about software engineering and tries to find out if there’s actually something that makes software engineering unique among the other engineering disciplines.

Abspielen
Das Video wird von Youtube eingebettet abespielt. Es gilt die Datenschutzerklärung von Google

Multi-step Refactoring Pains in C++

Titus Winters talks about maintaining and refactoring large C++ code bases (i.e. code bodies that require multi-step refactoring). He describes how “higher-level” language features effectively make refactoring harder (e.g. functions, classes, templates, concepts).

Abspielen
Das Video wird von Youtube eingebettet abespielt. Es gilt die Datenschutzerklärung von Google

Naïvité FTW

Daniele Procida explores how a certain naivety (being unsophisticated) can lead to beautiful and useful things.

Update 2021-08-15: the original video from DjangoCon 2018 is not available any more. It seems Daniele gave a similar talk at EuroPython 2018 also.

Abspielen
Das Video wird von Youtube eingebettet abespielt. Es gilt die Datenschutzerklärung von Google