Video decode acceleration issues on Chromium-based browsers in Ubuntu 22.04 often stem from compatibility problems with system libraries and codecs. While native installations may struggle with hardware acceleration, the Snap environment provides a self-contained solution that ensures video decoding functions correctly. Using the Snap version of your browser can significantly improve video playback performance and reduce CPU usage by enabling hardware-accelerated decoding.

Method 1: Install Chromium-Based Browser via Snap for Hardware Acceleration

Step 1: Begin by removing your current Chromium-based browser installation to avoid conflicts. Open a terminal window by pressing Ctrl + Alt + T, execute the following command to uninstall the existing browser:

sudo apt remove chromium-browser

Confirm any prompts to remove the browser completely.

Step 2: Next, install the Snap version of Chromium. Snap packages are containerized applications that come with their own dependencies, reducing compatibility issues. Run the following command in your terminal:

sudo snap install chromium

Wait for the installation to complete. This process may take a few minutes, depending on your internet connection.

Step 3: After installation, ensure hardware acceleration is enabled within Chromium. Launch the browser, type chrome://flags in the address bar, and press Enter. In the search box, type "Hardware-accelerated video decode" and set it to "Enabled". Restart the browser to apply the changes.

Step 4: Verify that hardware acceleration is active. Visit chrome://gpu and look under "Video Decode" to confirm it shows "Hardware accelerated". If it does, your browser will now correctly utilize your GPU for video decoding.


Method 2: Update Graphics Drivers to Improve Compatibility

If hardware acceleration still isn't functioning properly after installing Chromium via Snap, the issue might be related to outdated or incompatible graphics drivers.

Step 1: Open the "Software & Updates" application from the Ubuntu application menu. Navigate to the "Additional Drivers" tab.

Step 2: Ubuntu will automatically search for available proprietary drivers for your graphics card. Select the recommended driver from the list provided and click "Apply Changes". Wait until the installation completes.

Step 3: Restart your computer to ensure the new drivers take effect. After rebooting, launch Chromium again and verify the hardware acceleration status by navigating to chrome://gpu.


Method 3: Adjust Browser Launch Flags Manually

If you've verified your drivers and installed the Snap version but still don't see hardware acceleration enabled, manually adding command-line flags can sometimes resolve the issue.

Step 1: Open your terminal and run the following command to edit the Chromium desktop file:

sudo nano /var/lib/snapd/desktop/applications/chromium_chromium.desktop

Step 2: Within the editor, locate the line beginning with Exec=. Append the following flags after the existing command:

--enable-features=VaapiVideoDecoder --use-gl=desktop

For example, your edited line might look like this:

Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/chromium_chromium.desktop /snap/bin/chromium %U --enable-features=VaapiVideoDecoder --use-gl=desktop

Save the changes by pressing Ctrl + O, then exit the editor by pressing Ctrl + X.

Step 3: Restart Chromium, and check again at chrome://gpu to confirm hardware acceleration is now active.


Following these steps should enable proper video decode acceleration in Chromium-based browsers on Ubuntu 22.04, improving video playback quality and reducing resource usage.