Guide on how to set up MPV on Linux to open media streams through IINA URIs.
- Create a bash script that extracts the stream URL from an IINA URL and plays it with MPV:
iina-to-mpv.sh
Make it executable (#! /bin/bash input_url="$1" encoded_url="${input_url#*url=}" # Decode percent-encoded characters decoded_url=$(printf '%b' "${encoded_url//%/\\x}") exec mpv "$decoded_url"
chmod +x iina-to-mpv.sh
) and put it anywhere you want. In this example, its location is:/usr/local/bin/iina-to-mpv.sh
- Create a
iina-handler.desktop
file to handle the IINA URI scheme:
iina-handler.desktop
Put it in[Desktop Entry] Name=Open IINA URIs with MPV Exec=/usr/local/bin/iina-to-mpv.sh %u Terminal=false Type=Application MimeType=x-scheme-handler/iina;
~/.local/share/applications/
. - Update the desktop file database:
update-desktop-database ~/.local/share/applications/
- Register it as the default handler for IINA URLs:
xdg-mime default "iina-handler.desktop" "x-scheme-handler/iina"
That's it. Your browser should now be able to open IINA URLs with MPV.