Skip to content

Instantly share code, notes, and snippets.

@realnc
Created July 30, 2025 21:38
Show Gist options
  • Save realnc/4cd7e8a34289e8703dec5c55537f6b65 to your computer and use it in GitHub Desktop.
Save realnc/4cd7e8a34289e8703dec5c55537f6b65 to your computer and use it in GitHub Desktop.
How to handle the IINA URI scheme with MPV on Linux

Guide on how to set up MPV on Linux to open media streams through IINA URIs.

  1. Create a bash script that extracts the stream URL from an IINA URL and plays it with MPV:
    iina-to-mpv.sh
    #! /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"
    Make it executable (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
    
  2. Create a iina-handler.desktop file to handle the IINA URI scheme:
    iina-handler.desktop
    [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;
    Put it in ~/.local/share/applications/.
  3. Update the desktop file database:
    update-desktop-database ~/.local/share/applications/
    
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment