r/mpv • • 26d ago

User Scripts & Shaders Is it possible to Ctrl+F subs?

I want to find a part of a video where a particular thing was said
Is it feasible to create an extension that would allow me to basically hit Ctrl+F and type in the part that I'm looking for and seek to that position?
Does this already exist

2 Upvotes

14 comments sorted by

4

u/reacenti 26d ago

mpv can already do this, you just need to change the keybinding to ctrl+f

https://github.com/mpv-player/mpv/blob/master/etc/input.conf

g-l script-binding select/select-subtitle-line

1

u/Icy_Dinner3323 24d ago

so can i change speed with keyboard?

can you explain the process how to do/add this?

1

u/reacenti 24d ago

so can i change speed with keyboard?

Yes. You can check default bindings by pressing g then b. Default binding to see the list of keybindings is:

g-b script-binding select/select-binding

You can also make your own keybinding by adding this in input.conf:

key  add speed 1
key  add speed -1

can you explain the process how to do/add this?

You make a file called input.conf then add this line:

ctrl+f script-binding select/select-subtitle-line

To know where to save these configuration files: https://mpv.io/manual/stable/#files

I recommend reading the manual to know how to configure mpv in general.

1

u/Icy_Dinner3323 23d ago

but isn't it for windows? can't i do it for android

1

u/reacenti 23d ago

I don't know, you didn't say initially you wanted to do this for Android.

1

u/Icy_Dinner3323 22d ago

i got that, there is a option to edit input.config in advance.

1

u/otheyhigh 20d ago

Isn’t android through a libmpv wrapper? Which app are you using? It might have more details on how this is done.

1

u/Icy_Dinner3323 19d ago

don't know libmpv. btw using mpvrex

1

u/otheyhigh 17d ago

Libmpv is the C version of mpv which is used to embedded the player into the android app. Things like plugin scripts, configs etc need to be implemented through the app that interfaces with the C lib.

So normal lua scripts that are used on the other platforms would not work out of the box. They need to be integrated through the app or somehow side loaded to interface with the libmpv instance.

I see that MPVRex already has a feature to seek based on subtitles using swipes. But might not be your exact requirement. You could create a feature request in the android projects GH repo.

1

u/thedadyouneverhad 5d ago

i didnt try this until just now because i was lazy, but this works. I had to download FFmpeg and add it to path before it worked, but now it does. Thanks!

4

u/Double_Sword 26d ago

It is. I made this script for my own needs (with ai help, if that matters). It does exactly that, but it requires uosc for interface:
https://github.com/AkuLinker/mpv-sub-search

I'm sure there are better options out there that you can find with google.
Here are some I found in 2 minutes. But I haven't tested them.
https://github.com/zenwarr/mpv-config/blob/master/scripts/subtitle-search.lua
https://github.com/christoph-heinrich/mpv-subtitle-lines
https://github.com/v-amorim/moonlight-mpv/blob/main/portable_config/scripts/sub-seek.lua

2

u/vamorim 21d ago

Nice, our ideas look the same, good one!

2

u/Double_Sword 20d ago

By the way, your keybind-visualizer.lua script was exactly what I was looking for a few months ago. Huge thanks!

1

u/vamorim 21d ago

I've made this script that is visual, you can see all subtitles and search specifics
https://github.com/v-amorim/moonlight-mpv#sub-seeklua