copy link and click play:
1.
flatpak install flathub io.mpv.Mpv
sudo apt-get install xclip
2.
sudo ln -sf /var/lib/flatpak/exports/bin/io.mpv.Mpv /usr/local/bin/mpv
3.
/home/user/.var/app/io.mpv.Mpv/config/mpv/mpv.conf
---------------------
# MPV configuration file, solve syslog spam problem
log-file=/dev/null
msg-level=all=no
#cache=no yes auto
#cache=auto
# Performance
vo=gpu-next
hwdec=auto-copy
profile=fast
# cache optimisation
cache=yes
demuxer-max-bytes=5M # Nur 5MB (statt 15MB)
demuxer-max-back-bytes=512K # Minimal Zurückpuffer
# no waiting for buffer
demuxer-cache-wait=no
# always on top
vo=x11
---------------------
4.
create path:
mkdir -p ~/bin
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
script in path: YT360
---------------------
#!/bin/bash
mpv --ytdl-format="worstvideo[height>=320]+worstaudio" --speed=1.7 "$(xclip -o)" || mpv --ytdl-format="[height=360]" --speed=1.7 "$(xclip -o)" || mpv -ytdl-format=hls-480 --speed=1.7 "$(xclip -o)"
---------------------
or and higher settings:
mpv --ytdl-format="bestvideo[height=480]+bestaudio/best" --speed=1.7 "$(xclip -o)"
mpv --ytdl-format="(bestvideo[height=720]/bestvideo[height<=480])+bestaudio/best" --speed=1.7 "$(xclip -o)"
mpv --ytdl-format="(bestvideo[height=1080]/bestvideo[height<=720]/bestvideo[height<=480])+bestaudio/best" --speed=1.7 "$(xclip -o)"
mpv --ytdl-format="(bestvideo[height=1440]/bestvideo[height<=1080]/bestvideo[height<=720]/bestvideo[height<=480])+bestaudio/best" --speed=1.7 "$(xclip -o)"
5.
/home/user/.local/share/applications/YT360.desktop
---------------------
[Desktop Entry]
Type=Application
Name=YT360
GenericName=Multimedia player
Icon=/home/user/snap/snap-store/common/.cache/gnome-software/mpv.png
Exec=sh -c "/home/$USER/bin/YT360"
Terminal=false
X-KDE-Protocols=ftp,http,https,mms,rtmp,rtsp,sftp,smb
Keywords=yt
MimeType=audio/*;video/*;
---------------------
6.
Pin to Dash
Is there a good reason for using the flatpak ? mpv is in the repositories, and depending on the version of Ubuntu (22.04 → 0.34, 24.04 → 0.37, 25.04 and 25.10 → 0.40) you’re running you’ll get the same version of mpv as the flatpak without the overhead. And since the youtube integration of mpv relies on youtube-dl or yt-dlp it’s kind of questionable whether the flatpak brings those along (and if it does than the aforementioned overhead gets even worse since those are python programs and you need both the interpreter and quite a lot of libraries for them to work …).
YES, apt has older version of mpv and yt-dlp, tried snap mpv and yt-dlp but only this worked, flatpak mpv comes with yt-dlp integrated. Its easy solution, and i like easy.
That’s strange. I’m for the moment still on 22.04, so I still have mpv 0.34. Playing youtube videos through mpv works just fine, but I have to admit that I don’t use yt-dlp from the repositories and instead use one I installed (and upgraded through reinstallation) through pip3.
Ah yes, i had 20.04 before and the same config as you, but 24.04 had library issues or something, it didn’t work. pip, and it was too complicated for me or not possible. And then i used snap mpv and yt-dlp and it worked but suddenly stopped working, maybe mpv has to be in /usr/local/bin/? I think mpv had problems using yt-dlp because of snap sandbox.
snaps are sandboxed to the point where they can’t even ‘see’ anything that isn’t in the same snap or possibly in a snap connected by the plug/slot mechanism. So it probably stopped working because youtube changed something which made yt-dlp stop working – as they usually do – and the packager(s) of the snap didn’t update to compensate.
Note that I said ‘pip3’, not ‘pip’. Also note that I run pip3 as a normal user, not as root so yt-dlp gets installed into ~/.local/bin not system wide.
Moved to the Lounge since this seems more like a how-to than a support request.
@igorius-plombozihi Welcome to Ubuntu Discourse ![]()
Feel free to clarify if this is not the case.
Thanks
Why move it to the Lounge? I don’t like it. It’s meant for all users, and in the Lounge, only registered users can see it. I wrote it for everyone, not just for those who have registered on the site. I wont post anymore then. Moving this tutorial to the Lounge makes it harder for users to find. I created it for all users, not just registered ones, so I don’t think it belongs there. Is there a solution for this problem?
Well, loading untrusted data in memory (as any video or image you can find anywhere) is always a good reason to use a sandboxed package, whether it’s snap or flatpak (both with enough constraints).