Send browser media to mpv for better playback, controls, and hw acceleration.
demo.mp4
(Recorded at low fps)
Linux only.
- Tested with Brave and Google Chrome on Linux desktop.
- Native messaging install paths use Linux
~/.config/...locations. - When available,
xdotoollets the host wait for a visiblempvwindow on X11 or XWayland. - Not supported on macOS or Windows.
Requirements:
nodempv- A current
yt-dlprelease
Keep yt-dlp updated using the same method you used to install it. YouTube changes frequently, and outdated releases may resolve stream URLs that fail with HTTP 403. This project uses the external yt-dlp executable rather than vendoring or pinning it.
Optional configuration:
- Install
xdotoolto let the host wait until thempvwindow is visible. Without it, playback still launches, but the host returns immediately. - For Twitch and other sites that need browser cookies, add this to
~/.config/mpv/mpv.conf:
ytdl-raw-options=cookies-from-browser=brave
Replace brave with chrome or chromium if that browser holds the cookies you want to use.
From the repository root, run:
./install.shThis installs the native messaging host for Brave, Google Chrome, and Chromium.
Load the extension once in each browser you use:
- Open
brave://extensionsorchrome://extensions. - Enable Developer mode.
- Select Load unpacked.
- Choose the
extensiondirectory in this repo.
- Click the toolbar button to inspect the current page for playable media and open the best candidate in
mpv. - Right-click a page and choose
Open page in mpv. - Right-click a link and choose
Open link in mpv.
When the extension finds a direct stream URL, it also sends Referer and User-Agent headers to mpv.
The native host only accepts http:// and https:// URLs.
YouTube and Twitch are supported. DRM-protected sites like Netflix are not supported.