mpv handler
A protocol handler for mpv, written by Rust.
Use mpv and yt-dlp to play video and music from the websites.
Please use it with userscript:
Protocol
Plugins
play
: Use mpv player to play video
Encoded URL
Use URL-safe base64 to encode the URL.
Replace /
to _
, +
to -
and remove padding =
.
Example (JavaScript):
let data = btoa("https://www.youtube.com/watch?v=Ggkn2f5e-IU");
let safe = data.replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
Parameters (Optional)
cookies = [ www.domain.com.txt ]
profile = [ default, low-latency, etc... ]
quality = [ best, 2160p, 1440p, 1080p, 720p, 480p, 360p ]
v_codec = [ av01, vp9, h265, h264 ]
subfile = [ Encoded URL ]
Installation
Linux
Manual installation
- Download latest Linux release
- Unzip the archive
- Copy
mpv-handler
to$HOME/.local/bin
- Copy
mpv-handler.desktop
to$HOME/.local/share/applications/
- Set executable permission for binary
$ chmod +x $HOME/.local/bin/mpv-handler
- Register xdg-mime (thanks for the linuxuprising reminder)
$ xdg-mime default mpv-handler.desktop x-scheme-handler/mpv
- Add
$HOME/.local/bin
to your environment variablePATH
(if needed) - Create
$HOME/.config/mpv-handler/config.toml
and edit it (if needed)
Windows
Windows users need to install manually.
Manual installation
- Download latest Windows release
- Unzip the archive to the directory you want
- Run
handler-install.bat
register protocol handler - Add mpv and yt-dlp to environment variable
PATH
(if needed) - Edit
config.toml
(if needed)
macOS (Alpha)
I haven't tested it, if it doesn't work, please open an issue.
macOS users need to install manually
Manual installation
- Download latest macOS release
- Unzip the archive and copy
mpv-handler.app
directory to$HOME/Applications
- Add mpv and yt-dlp to environment variable
PATH
(if needed) - Create
$HOME/Library/Application Support/mpv-handler/config.toml
and edit it (if needed)
Configuration
If you have already added mpv and yt-dlp to PATH
, manual configuration is usually not required.
mpv = "/usr/bin/mpv"
# Optional, Type: String
# The path of mpv binary
# Default value:
# - Linux: mpv
# - Windows: mpv.com
ytdl = "/usr/bin/yt-dlp"
# Optional, Type: String
# The path of youtube-dl binary
# Default value:
# - Linux: yt-dlp
# - Windows: yt-dlp.exe
# For Windows users:
# The path can be "C:\\folder\\some.exe" or "C:/folder/some.exe"