osc.lua: display seekbar hover time as property for other lua scripts#17510
Conversation
Add functionality to show position in seconds when hovering over the seekbar, useful for thumbnail creation.
Correct comments for clarity and fix minor typos.
Clarified comment about the seekbar's functionality.
|
it is my first time using PR so i was just checking, i should not have done all these, i was learning but it all became mess, sorry |
N-R-K
left a comment
There was a problem hiding this comment.
I do not like this. The UI script should have control over where to draw the thumbnail, this makes it the thumbnailers job to draw as well.
For practical example, on mfpbar I draw a (configurable) border around the thumbnail. The thumbnail position also needs to be adjusted based on whether the video has a chapter or not.
The way I see it, the point of this PR is to remove this concern from the UI's responsibility, and onto a 3rd party script which can use this info and expose its own configurability over this matter. Without understanding fully what such interface might be (where the UI controls if, where, and how to place the thumbnail), I would think that this PR is a strict subset of it. I.e. any such interface would have to include a way for a script to know which time-pos is being hovered at the UI. So this PR provides only this part, while leaving other aspects of this more-complete interface to be defined (and implemented!) in the future, and without obvious conflicts that I can think of between what this PR does, and what a full interface would do. Don't you agree? EDIT: This is indeed a very loose interface, but it has both pros and cons. The main pro is that it's trivially simple to add to the osc and to use by 3rd party scripts. The con is that the OSC has no control over what 3rd party scripts might do with it, which might interfere with the osc somehow, or suffer from loose integration otherwise. But the flip side of that con is also a pro - scripts are not bounded by interface implementation and limitations at the osc. Any new feature which a script wants to add, like bouncing baloons around the thumbnail - they can do right now, without having to wait for the osc maintrainers to agree that bouncing baloons should be part of the interface, and then enhance the interface to support it, and add the user configurability via the osc, etc. It really decouples these concerns from the osc, while providing the asolute minimum which a 3rd party script needs in order to start doing useful things with thumbnails. |
|
@xdev23 thanks for the PR. I think it's interesting, and potentially useful. Mandatory question: did you write the code yourself? can you comfortably edit it yourself to address review comments? For instance, the way it's placed currently at the code is not ideal IMO. It's placed between the comment which describes the title-on-hover code - and the code itself which implements it. Second thing, it duplicates the whole title-hover code skeleton, but this new code runs unconditionally and without user control - unlike the title-hover code. Thirdly, if we're to accept this PR, then these two things need to be merged somehow (the PR code and the existing title-hover code) while reducing duplication to minimum. And finally, an interesting concern came up, where apparently this PR increases the Any alternative measurement numbers are welcome. So except the last performance issue, can you address these concerns on your own? |
fixed maintainers raised issues
|
i know both of your questions are valid, i did thought of having to add border and chapter titles below thumbnails but i don't think that is possible to do directly with osc, as it is already too complex,
i am requesting property now to answer @avih question i did use ai to understand what/where exactly i need to change otherwise to understand what i don't know much about performance problem but i think calling mp.set_property_number blindly in render() is spamming and can cause that 10% lag you talked. i have pushed an update I merged the property into the existing title-hover block. i did not have any video with chapter so could not check it, but i tested there was issue, but it should be working as excepted now, my script what i am using for testing with this property simple_thumb_v1a.lua I added a i also added |
I never asked anything about border or rendering of anything at the OSC. I was talking about where the code is positioned. Before the PR the code looked like this:
But the PR added the new code just between those parts, which made it:
But what I did ask first, very very clearly, and which I do expect you to answer is:
I asked specifically who wrote the code, and whether you could address these issues on your own. Did you do that on your own? I also point you to the contribution guidelines which have this section: Lines 264 to 268 in f9190e5 |
i did use ai help, and i have disclosed , sorry i made wrong mentions n-r-k asked about border and chapters, and you asked about this ai and performance things |
I might have missed it, but I've read your first comment few times and I can't see it. Where did you disclose it? How much of it is AI, and how much did you write or fix on your own? Also, you still didn't answer my question of whether you can do these fixes on your own - without AI. |
|
come on bro @avih , read this #17510 (comment) i have mentioned everything here your question
i have written in #17510 (comment)
my reply meant that i have used ai to understand the osc code, but i did write code on my own, i used ai to know what existing variables do, are they what i need, i have also read the code myself to verify that what ai said is right, it is more than 3k like of code, without ai it will probably take 2-3 days to understand it next question
yes i can do changes on my own without ai, |
|
since you are using my simple_thumb_v1b.lua script then i assume that you are using osc.lua with my PR saved in scripts folder you see i have changed a hell lot of things in my thumbnail script without affecting download the script again simple_thumb_v1b.lua you can't use fixed preview height if it is not my script creates i haope maintainer @avih and @kasper93 push my pr to master and we will be able to delete the 2026-03-07.21-57-41.mp4 |
|
@xdev23 I'm not worrying about the code because even if there are issues, they would be simple to fix. The discussion is about which approach is best here. Your PR suggests to expose only the hover-time-pos, and let other scripts do the rest. The other approach is that the OSC should control most of the things, and specifically the position, while the script should mainly be responsible to do the actual thumbnail. And maybe there are other approaches which would be good. So it's about deciding which approach is best, while trying to take important considerations into account, and also think what are the implications of each approach for the future. For some reason there were a lot of misunderstandings in this PR, and that didn't help. It also doesn't help that we don't actually know how experienced and capable you are with writing code on your own and making informed decisions. Maybe you're great at those, but it didn't show up so far. So it happens that someone else opened another PR with the same goal but a different approach. There's also a lot of discussion there. Again, the issue is deciding what we want to do, and you're welcome to participate in this discussion. Once we decide that, and we actually know what we want to do, then writing the code will not be a problem. The code will be simple with any solution. The hard part is deciding which solution is best. |
|
@xdev23 You're fundamentally misunderstanding the point NRK is making. With your proposed API, the thumbnailer script is responsible for positioning the thumbnail preview which is simply not feasible across every single layout out there. If we're going to make an official API for this, it should be good enough to work with any layout or OSC script, not just the ones blessed by your script. |
|
ok now i understand the issue from #17510 (comment) Approach 1: my approch is open a property Approach 2: it is to let osc control all settings of other scripts and let those scripts be free, i will stick with my approach, because osc is already to big, there are already too many controls, if someone were to decide they want to create some script, so would you add settings of that 3rd party script to osc, hell no, this doesn't make sense at all, as it will only make osc more crowded, it is not sustainable at all why do you even want to add settings of a 3rd part script to osc, if user doesn't use that script that code in osc is useless you must open key features as property like i requested for |
There's no "must" here, and there's more than one valid opinion, and there are pros and cons to both sides, and, as noted, there might even be other approaches which we didn't consider yet. This is why we're discussing it. We're trying to find the best solution. |
|
you are wrong with my api, with my api everything will be done by my script not by osc, i don't care about 3rd party layouts, i like and use default i think you guys are confused about my new approach , you must read this #17510 (comment) then my reply #17510 (comment) you will understand i am not wrong at all, |
Is there any viable approach without thumbnailer knowing |
Because logically the thumbnail is very much part of the osd. If thumbnail layout is handled by a non-osd "3rd party script" then that 3rd party script must support your osd configuration or it will look out of place. So if I decide to make an osd with a red background for the seek bar and want to have the thumbnail preview have a matching border then (with your approach) this osd depends on the thumbnailng script supporting this layout/styling functionality. However if we instead move layout to the osd implementation (by providing the thumbnailer with the destination rectangle, or imo even better do what the script kasper93 mentioned here does) we now have layout consistently done by a single script. This means the osd can remain coherent irrespective of the thumbnailer implementation. (side note: why does thumbfast not use the "pass file path" approach? is it just due to it making things more complicated?) This is basically a question of "should the osd share layout information with the thumbnailer or should the thumbnailer share thumbnails with the osd". Personally the second approach seems more natural and involves sharing less state between scripts. Though of course equivalently the thumbnailer could just implement every customization option under the sun and effectively function as a sort of "UI component library" but that could just be a thing on top of the base thumbnailer API and doesn't feel right as any sort of "official API".
It has to know the time to thumbnail but it can be provided as an event instead of a property (which seems to better match the problem Maybe I'm making too many assumptions but https://github.com/occivink/mpv-gallery-view/blob/4a8e664d52679fff3f05f29aa7a54b86150704bc/scripts/gallery-thumbgen.lua just seems like a much better direction? Please correct me if I'm wrong. edit: @N-R-K pointed out on IRC that thumbfast's API when using the |
|
you guys are maintainers, in the end choice will be yours, implementing a api or property is easier then to maintain code for others, which will only increase your burden instead you could add new features in mpv the confusion between choices is maybe because i am the first person who actually asked to create a property inside i hope you understand that i am not making a invalid request, creating a property like i do hope that my PR is merged😑, right now i feel like i am asking for something that everyone is against but they know they need it but taboo to ask |
I've said several times, in very similar words to yours, that I'm on the side which thinks that the approach in this PR is viable as a first step, and we can enhance it in the future as new needs reveal themselves. The fear with this approach (which I don't share) is that it leaves too much freedom to the script, but without enough knowledge to ensure the script can use it safely and reasonably, and therefore it's a bad interface. So if some maintainers (defined loosely, you're included for that matter) insist that it's not a viable first step, then it's worth further discussion to see if we could find a solution which more people are happy with. |
@avih if i understand correctly you mean, that other scripts affect look at my script simple_thumb_v1b.lua i am using i am drawing my own osc overlay for thumbnail preview which is not affecting if in future when mpv updates and i am not making unreasonable request, i don't know why people are so concerned even though i have explained everything clearly |
The discussion is about how much freedom mpv should give to scripts, and how much it should try to control. If it's too much freedom or too little information which scripts can use, then it can result in scripts which actualy interfere badly with mpv, but if it's too little freedom, then it limits what scripts can do. The "trick" is to find a balance which is great for everyone. And it's not always easy. As for "viable first step", it means I think this PR is OK.
Yes, it's fine for YOUR script. But the code which we add in mpv should be good for everyone. Not just you. And in this case, I also agree with others that this much freedom on its own can result in bad interference with mpv. Because the script cannot know where the OSC is. Even if it wants to be responsible and behave nicely and not draw over the OSC - it just cannot do that, because it doesn't know where the OSC is on screen.
You care about what your script needs right now. We care about what is good for mpv and for mpv users now and in the future. The reasons we're discussing this subject is because we think it has potential to be good for mpv and the users too. Maybe not exactly what you need right now, but we hope to find a solution which will be good for mpv and users and you too. But it takes time and discussions to find a solution which is good for many people.
You explained clearly enough, but it doesn't mean that everyone has to agree with you. It's OK, sometimes people disagree. |
I don't think Imagine the situation that you move the mouse to different place on timeline, but OSC for whatever reason decides that image shouldn't be drawn at this point in time. Should it not update See also, for the part one: #17518 (comment) |
|
@avih @N-R-K @kasper93 @na-na-hi you guys are misunderstanding everything about my PR so read it completely, then say anything my PR is creating a property in if it had that property many scripts like thumbfast could work directly with mpv's when you hover on seekbar this property will write a external script like my script gets that this PR aims to solves a complex problem just by creating a new property and it only have benefits and no problems but you guys don't understand it, i have explained the problem many times but you guys failed to grasp that problem so how can you even understand the purpose of this PR, creating a property that i am requesting doesn't cause any problems you are listing. i even added images and video clips #17510 (comment) so that everyone understand what this PR is, but you guys ignored all of that, and even blame me for being hard to understand #17510 (comment)
yes, i may be selfish but i have told you guys the purpose of my PR so many times, but instead of trying to understand what i mean, you guys are listing tons of unrelated problems in my what a great community we have everything you guys are talking about
if my pr was about counting easy 1 to 10 then you guys made it hard counting millions to billions, soul of my PR is gone, and i am too tired to explain anything anymore, because instead of just merging so everyone can benefit from a new property, you guys will just list more of your imaginary problems. |
|
@xdev23 we see many of your posts multiple times. For instance your last posts appeared more than 10 times. If you know why it happens, or if you can do something about it, please try to fix it. Thanks. |
@avih |
|
@avih @N-R-K @kasper93 @na-na-hi if you guys don't want to accept my PR no problem, i don't care anymore and i don't think you guys also care about this anymore, but still read this #17510 (comment) maybe you will understand i would also like to request |
That's a valid assessments. I couldn't care less about thumbnails, just posted few thoughts on the topic. I also understand. But at the same time I think solutions that are merged to upstream (here) should be well thought out and not focus on fixing use of specific script. That's why I propose to design better interoperability API for thumbnailing, that may be reused by other UI scripts too. I personally don't think OSC should broadcast it's timeline hover position, this makes everyone feel like this is the goto solution for implementing features. However, since the changes are not intrusive, if others agree on introducing such interfaces, I don't mind too. It just feels like it will be quickly either discarded by other scripts or replaced with different solutions, which makes us keep stop gap interface for next two mpv releases at least. |
|
@kasper93 since you want to discuss then lets disscus your ways our goal, whether or not broadcast time of hover in seconds when mouse is on seekbar, lets take this image for our goal
kaspar you say
i think there will be 2 cases to make thumbnail preview in mpv possible- CASE 1: implement everything within osc.lua you will have to directly add thumbnailing to osc.lua which increases its codebase and many more settings for osc.conf. like thumbnail size, border, chapters support and what not, (it is possible but if it is missing features it only increases more PR) CASE 2: broadcast the hover position using property in image mouse is at position 10:18 so property writes 618 in seconds, any thumbnail script reading this property with this property can be used with custom scripts, works will all mpv osc layout size or seek bar, whether it is full screen or not, works without any issues, as long as mouse hits seekbar, |
|
@avih @N-R-K @kasper93 @na-na-hi i tested the compiled artifact exe file of this PR from https://github.com/mpv-player/mpv/actions/runs/22795569076#artifacts using the new property maintainers as much as i understand that you guys wanna implement thumbnail logic directly in if you think instead of directly adding thumbnail logic in i don't understand why you won't add a important property that only improves its functionality and make things difficult for yourself, wasn't this why mpv uses lua and is configurable but one day you will realize i am right, there was a lot of drama in this PR, but i explained everything again properly here - #17510 (comment) i will move my focus on something else now - video showing results if this PR is approvedfuture thumbnail scripts can use 2026-03-08.19-19-46.mp4video when thumbfast is used with its custom osc.lua,if this pr not approved new users use 2026-03-08.20-50-01.mp4 |
|
hey @xdev23 your idea is good it could be very helpful to me, i am actually a script writer for videos, and i have to watch a video multiple times and create story line, so i have multiple mpv open at same time for playing video at different times, if i can get this hover time then i can use a ipc server to seek in another mpv window very quickly [not like thumbnails you are showing but full mpv window], this is very very helpful for me, i won't have to open many mpv windows, just 2 will be enough [one main and 2nd for quick seek], it won't be of much use in longer videos but for upto 20-30 min it is you offended mods but i am actually very interested, i downloaded your osc.lua with pr change but it is not working and i don't want to use exe you showed in video, i am trying to create another script so i can make it work for my usecase how do i make it work xdev23 i do hope mods do something |
|
@xdev23 my bad, |
|
hey @avih @N-R-K @kasper93 @na-na-hi i don't think this i saw how you guys talked in irc chat as if i undermined you, so i request you to delete this in the mean time i will still use mpv, because it just that good, |
|
@xdev23: Stop posting, tagging everyone and deleting messages. You can edit if needed. This is first and last warning. |
|
can you delete this pr |
You can close it if you wish, but PRs stay in the repository history. |
|
@xdev23 Yes, we know it works. It's simple code, and we understand it, and we know it can work. You don't need to convince and show us that it works, again and again, because we already know it. While I think this PR is OK, it looks like the majority of mpv members prefer the approach in the other PR - #17518, so this PR will probably not get merged. For this reason, I'll close this PR now. Thanks again for this PR. If the other PR gets merged, then I hope you could still use it with yout thumbnail script, because the other PR also adds the hover-timepos as a property (but it also does more things which other people think are important). |
|
@avih anyway, a lot of thing happend on my side, i have created a custom script that doesn't need hidden mpv at all, uses ffmpeg dlls that mpv is based on, it is slow right now but i am sure you might want to have a look at this as this can be implemented using mpv's ffmpeg dlls if NRK doen't mark my comment off topic in #17518 i am willing to share my findings i am sure it will help a lot |
|
You're welcome to share anything you want, either here (people can still read comments here even if the PR is closed), or at the other PR. Just... try to post each sharing only once, without posting it many times and then deleting it... :) Thanks. |


right now mpv osc does not make time of mouse hovering on seekbar accessible by other scripts, this change Adds functionality to mouse hover time in seconds to be used by other scripts using a property, useful for thumbnail creation scripts.
from now on people can use this property
${user-data/osc/hover_mouse_time}
it will give
hover time in secondswhen mouse is on seekbar otherwisenonewhen mouse is outside seekbarif this property
user-data/osc/hover_mouse_timeis approved then people don't need to use outdatedosc.luafromthumbfastscript as it lacks many updated features of original osc.lua of mpvand i have made this thumbnail script simple_thumb_v1a.lua, just save it to scripts folder and thats it, it works on my system, windows 11 latest as of today,
https://github.com/xdev23/mpv-scripts/blob/main/simple_thumb_v1a.luait works similiar to the thumbfast by spawning a hidden mpv process, but works with latest updated osc
edit: fixed issues from last failed commit
i made a mess during commit as it is my first pr on github, i just did without knowing, maintainers sorry for that