mpv
mpv copied to clipboard
Add Loop button to the player controls
Expected behavior of the wanted feature
It would be great if you could have a loop button in the video player controls. A shuffle button would also be great. Mpv supports these functions (at least with the mpris plugin). Exposing these buttons in the ui seems like a nice thing.
If there is a plugin for these buttons i did not find any. If there is a way to have these buttons help is appreciated.
Alternative behavior of the wanted feature
No response
Log File
No response
Sample Files
No response
https://mpv.io/manual/master/#custom-buttons
https://mpv.io/manual/master/#custom-buttons
@guidocella so it is possible with scripts, i see. Is there any script for this pre-made. i have never made any scripts for mpv. Would probably be a difficult task (for me) to make a script for this.
Those are script-opts, not a script. You just define the desired buttons in script-opts/osc.conf (just gotta put each item on separate lines as the docs are currently formatted incorrectly).
script-opts/osc.conf
In the config folder i presume? On linux: ~/.config/mpv/script-opts/osc.conf I will try that. Sorry that I misunderstood you.
@guidocella Thanks it works but how do i get the emojis to work? The buttons are just empty squares for me. Also using the shuffle button won't display any info. If i use loop if displays "Loop current File: " with "inf" and "no". Can i get something like that for shuffle too?
You need a font with monochrome emoji.
For shuffle you would need to write a script that keeps tracks of whether you shuffled and prints different messages.
I see, any font recommendations? Also do i set the font in the config afterwards, is this how this works?
If you know any scrips for shuffle print please say so, but otherwise i guess i have to leave this alone.
I see, any font recommendations?
Symbola
Also do i set the font in the config afterwards, is this how this works?
No need.
If you know any scrips for shuffle print please say so, but otherwise i guess i have to leave this alone.
It is trivial. This will do it
local shuffled
mp.add_key_binding('F1', 'toggle-shuffle', function ()
if shuffled then
mp.command('playlist-unshuffle; show-text Unshuffled')
else
mp.command('playlist-shuffle; show-text Shuffled')
end
shuffled = not shuffled
end)
Change F1 to the desired key and bind script-binding toggle-shuffle to custom buttons
ok thanks, and how do i trigger it with the onscreen (/custom) button? Just the script name added to "custom_button_2_mbtn_left_command" (shuffle button in osc.conf)?
bind
script-binding toggle-shuffleto custom buttons
Seems to do nothing: I got in ~/.config/mpv: toggle-shuffle.lua (with your code) script-opts/osc.conf (with: custom_button_2_mbtn_left_command=script-binding toggle-shuffle)
F1 wont show text or toggle shuffle and the custom button also triggers nothing. I probably missunderstood, but i don't know how to fix that.
Scripts go in ~/.config/mpv/scripts
Jep works now, also i just installed chaotic-aur/otf-symbola
(This added /usr/share/fonts/OTF/Symbola.otf) is that not correct?
Or do i need to restart, a empty square is still displayed for the emojis
It seems to only work with ttf-symbola-free
ok i installed that, now i got a file at: /usr/share/fonts/TTF/Symbola.ttf Emojis are still shown as squares in mpv though.
Do I have to link the ttf file to some other location or is this still the wrong font. I downloaded: aur/ttf-symbola-free 9.00-1
It should work by installing it.
How do i debug that. Its all installed but it still looks like this:
I added some letters to indicate what is what, but if the emoji would work that would be great.
--msg-level=osd/libass=v
There seems to be some issue with sans-serif.
[input] Unknown key 'ctlr+F1' at <api>:1
Resuming playback. This behavior can be disabled with --no-resume-playback.
[osd/libass] libass API version: 0x1703000
[osd/libass] libass source: commit: 0.17.3-0-ge46aedea0a0d17da4c4ef49d84b94a7994664ab5-dirty
[osd/libass] Shaper: FriBidi 1.0.15 (SIMPLE) HarfBuzz-ng 11.2.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
● Video --vid=1 (hevc 1920x1080 60 fps) [default]
● Audio --aid=1 (aac 2ch 48000 Hz 158 kbps) [default]
[osd/libass] libass API version: 0x1703000
[osd/libass] libass source: commit: 0.17.3-0-ge46aedea0a0d17da4c4ef49d84b94a7994664ab5-dirty
[osd/libass] Shaper: FriBidi 1.0.15 (SIMPLE) HarfBuzz-ng 11.2.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
Using hardware decoding (nvdec).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 1920x1080 cuda[nv12]
AV: 00:00:02 / 00:11:39 (0%) A-V: -0.000 Cache: 696s/102MB
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] fontselect: (sans-serif, 400, 0) -> /usr/share/fonts/noto/NotoSans-Regular.ttf, 0, NotoSans-Regular
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] Glyph 0x23F1 not found, selecting one more font for (sans-serif, 400, 0)
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] fontselect: failed to find any fallback with glyph 0x23F1 for font: (sans-serif, 400, 0)
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] fontselect: (mpv-osd-symbols, 400, 0) -> mpv-osd-symbols-Regular, 0, mpv-osd-symbols-Regular
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] Glyph 0x1F501 not found, selecting one more font for (sans-serif, 400, 0)
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] fontselect: failed to find any fallback with glyph 0x1F501 for font: (sans-serif, 400, 0)
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] Glyph 0x1F500 not found, selecting one more font for (sans-serif, 400, 0)
AV: 00:00:02 / 00:11:39 (0%) A-V: 0.000 Cache: 696s/102MB
[osd/libass] fontselect: failed to find any fallback with glyph 0x1F500 for font: (sans-serif, 400, 0)
Keeps repeating this
[osd/libass] Glyph 0x23F1 not found, selecting one more font for (sans-serif, 400, 0)
...
[osd/libass] fontselect: failed to find any fallback with glyph 0x23F1 for font: (sans-serif, 400, 0)
...
But with other Glyphs
Do i need to install a font for that one too maby? i have installed:
extra/wqy-zenhei 0.9.45-10
extra/ttf-opensans 3.003-1
extra/ttf-fira-sans 1:4.301-2
extra/noto-fonts-emoji 1:2.047-1
extra/noto-fonts-cjk 20240730-1
extra/noto-fonts 1:2025.05.01-1
maybe i need a other one.
Seems i got the correct fonts. Any ideas?
It should use Symbola as the sans-serif icon font. I don't know why it doesn't for you. I get
[osd/libass] Glyph 0x1F500 not found, selecting one more font for (sans-serif, 400, 0)
[osd/libass] fontselect: (sans-serif, 400, 0) -> /usr/share/fonts/TTF/Symbola.ttf, 0, Symbola
The font Its definitely at the same spot as on your machine.
If I use ls /usr/share/fonts/TTF/Symbola.ttf I get:
.rw-r--r-- 3,1M root 30 Mär 14:16 /usr/share/fonts/TTF/Symbola.ttf
Strange, can it be manually defined somehow or is only automatic detection suported. Btw my mpv is on: extra/mpv 1:0.40.0-3
Since im on it, mpv --version gives me:
mpv v0.40.0-dirty Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
built on May 21 2025 20:53:16
libplacebo version: v7.351.0
FFmpeg version: n7.1.1
FFmpeg library versions:
libavcodec 61.19.101
libavdevice 61.3.100
libavfilter 10.4.100
libavformat 61.7.100
libavutil 59.39.100
libswresample 5.3.100
libswscale 8.3.100
Yeah it's in /usr/share/fonts/TTF/Symbola.ttf. You can pass --osd-font=Symbola but it will set it for all OSD text.
I ran: mpv --msg-level=osd/libass=v --osd-font=Symbola video.mp4
and got:
[input] Unknown key 'ctlr+F1' at <api>:1
Resuming playback. This behavior can be disabled with --no-resume-playback.
[osd/libass] libass API version: 0x1703000
[osd/libass] libass source: commit: 0.17.3-0-ge46aedea0a0d17da4c4ef49d84b94a7994664ab5-dirty
[osd/libass] Shaper: FriBidi 1.0.15 (SIMPLE) HarfBuzz-ng 11.2.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
● Video --vid=1 (hevc 1920x1080 60 fps) [default]
● Audio --aid=1 (aac 2ch 48000 Hz 158 kbps) [default]
[osd/libass] libass API version: 0x1703000
[osd/libass] libass source: commit: 0.17.3-0-ge46aedea0a0d17da4c4ef49d84b94a7994664ab5-dirty
[osd/libass] Shaper: FriBidi 1.0.15 (SIMPLE) HarfBuzz-ng 11.2.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
Using hardware decoding (nvdec).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 1920x1080 cuda[nv12]
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: -0.000 Cache: 686s/100MB
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] fontselect: (Symbola, 400, 0) -> /usr/share/fonts/noto/NotoSans-Regular.ttf, 0, NotoSans-Regular
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] fontselect: (sans-serif, 400, 0) -> /usr/share/fonts/noto/NotoSans-Regular.ttf, 0, NotoSans-Regular
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] fontselect: (mpv-osd-symbols, 400, 0) -> mpv-osd-symbols-Regular, 0, mpv-osd-symbols-Regular
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] Glyph 0x23F1 not found, selecting one more font for (Symbola, 400, 0)
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] fontselect: failed to find any fallback with glyph 0x23F1 for font: (Symbola, 400, 0)
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] Glyph 0x1F500 not found, selecting one more font for (Symbola, 400, 0)
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] fontselect: failed to find any fallback with glyph 0x1F500 for font: (Symbola, 400, 0)
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] Glyph 0x1F501 not found, selecting one more font for (Symbola, 400, 0)
AV: 00:00:12 / 00:11:39 (2%) x3.00 A-V: 0.000 Cache: 686s/100MB
[osd/libass] fontselect: failed to find any fallback with glyph 0x1F501 for font: (Symbola, 400, 0)
There are more glyph issues down the line. And the emoji is still squares.
Basically still looks like this:
The font seems to not have changed in the interface.
this shit must be added by default why the fuck is the most important button lacking lol?
You can already loop by right clicking the play button.
https://github.com/mpv-player/mpv/issues/5067 https://github.com/mpv-player/mpv/issues/5068
but i believe it just got overtaken by anime lovers so don't expect much https://github.com/orgs/mpv-player/people
https://github.com/mpv-player/mpv/pull/15031 https://github.com/mpv-player/mpv/issues/15176
shift + l i suppose
How do i debug that. Its all installed but it still looks like this:
I added some letters to indicate what is what, but if the emoji would work that would be great.
could you out wheres the bar located at in the source code so i could've made a patcher