detuur / mpv-scripts

This is a collection of my own mpv scripts.
MIT License
57 stars 8 forks source link

skiptosilence: disable video/subtitle while skipping #12

Open Eisa01 opened 1 year ago

Eisa01 commented 1 year ago

Disabling the video and subtitle while skipping instead of applying a blackout filter, fixes #3.

When there are too many packets in the demuxer packet, caused by exceeding the expected inside a packet then skipping will not stop and result in the action to never end. This is resulted from subtitles and video output from my testing.

Also fixed the script-opts template in the same PR.

detuur commented 1 year ago

Wonderful. That bug has been a thorn in my sides since I never actually managed to replicate it in the first place. I'll test the changes later today so expect a merge by tomorrow.

I never even knew the opts template was wrong...

Eisa01 commented 1 year ago

There are also additional possible enhancements. I'll probably make enhancements to this PR or add additional one.

In case a file that doesn't have any moment of silence, it is better to add an mp.register_event('end-file) to handle it, so that once the file ends, the function stops "even if this case is very rare, it is still a possibility". This will also solve a possible issue that loading a new item from playlist while the function is running, will result in the function to keep on running towards the next file.

It is also possible to include mp.observe_property('pause',... to stop the function when initiating pause.

Also, a nice feature could be is to set a configurable maximum silence length, so it breaks the functions (or doesn't even initiate "dont know the possibility for now", if the next silence point exceeds the configured time) e.g.: 120 seconds.

Eisa01 commented 1 year ago

I have made drastic changes to be able to include additional options. However, I'll move the script to separate branch (since I believe it could be not what you are intending with skiptosilence) and include it in my mpv-scripts collection whilst mentioning that it is a separate fork of skiptosilence.lua of course.

When I am not changing the script too much, I could be submitting a PR, however maintaining two separate projects of similar functionality will be an overhead for me.

Eisa01 commented 1 year ago

The above commits adds many new features and enhancements, which are not related to the bug.

I think now I poured most of the ideas I have for skiptosilence, thank you for the awesome script =) Now I'll create a separate branch and set the current code as a start for my next project.

Eisa01 commented 1 year ago

Totally agree with all your comments, things got mixed with the branch in where I was planning to make drastic changes, and the one I am doing enhancements / fix for PR. For osd_msg I would suggest removing the option, since I see that all osd messages important and should be displayed for the user. Let me know what you think, and I will start working on the requested changes =)

detuur commented 1 year ago

Let's get rid of osd_msg. Anyone concerned with tweaking the values can add debug print statements anywhere they want in the script.

Eisa01 commented 1 year ago

Apologies, been very busy lately. I'll try to dedicate time very soon hopefully to resolve this.

detuur commented 1 year ago

Take your time. There's no urgency here.