Custom mpv with hw accel with vaapi + vogpu + crostini on chromeOS

Introduction

You can watch videos on ChromeOS with the inbuilt player. But if you are like me and use Debian (crostini), then having a dedicated media player to watch the content makes more sense.

mpv is an amazing media player with so many customization options. I have used it previously on MicroSLOP Windows 10 and was wondering if I can set up mpv with hardware acceleration on chromeOS.

Without the hardware acceleration the playback is super stuttery and audio/video is desynced. In this post, I discuss how to set up the config for mpv to enable smoother playback.

Prerequisites

  1. Chromebook with crostini support, You can enable it by launching Chrome browser, navigate to chrome://flags/#crostini-gpu-support, enable the flag and restart the system.
  2. Check if the hw is detected using glxinfo -B and see “Device: virgl”
  3. Download mpv, xclip, ffmpeg and other dependencies
  4. Clone the mpv-config GitHub repo.

Note: ASUS C423NA doesn’t support av1 encode/decode on my device.

Steps

  1. Copy the content of the repo to the mpv config folder. On Linux it is stored in ~/.config/mpv/mpv.conf
  2. Edit the file, add the following to it.
~/.config/mpv/mpv.conf
# Enable GPU accel, Read the [official mpv manual](https://mpv.io/manual/stable/#gpu-renderer-options)
vo=gpu
hwdec=vaapi

# NOTE: disable or alter the config parameters as per the hardware.
  1. Open a video file with mpv and enjoy the smooth playback.

Screenshots

A screenshot of mpv running on ChromeOS

A screenshot of mpv running on ChromeOS

Sources: