-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playback mode that automatically skips silent parts. #6797
Comments
It'd be pretty trivial to write a filter which does this for audio only. But if video is involved, it would be much more complex. |
The audio filter should be disabled if there is any video stream. Is it possible to make an audio filter know whether there is video playing? |
I would want to use this filter in a video file too, so there should be an option or something like that, if that is even possible. |
I would like to see this implemented as well. Would it be possible to have mpv run silencedetect on the file and store the output (internally or in a temp directory) to skip the detected sections maybe? |
I've recently noticed that NewPipe has such option for videos, but it's used for fast forwarding [auto fast-forwards when silence is detected ] and I'm completely addicted to it |
What kinds of videos have silence which should be skipped? At all the clips I've ever watched, usually there's never real silence, and even if there was - I'd still like to watch the video... |
I don't know how it works but it's not a total silence, and surprisingly it's useful with many that I watch, game streams, any educational content, longform talks, reviews, obviously not with music. |
For me personally, it's recordings of online lectures. I'm sure this would be useful to many people as well, and it can also be used for similar events such as webinars etc. |
Yes, of course. I'm using it for lectures too, together with a small speed up. It's a real godsend, wish I knew about it earlier. It's a huge timesaver |
Can someone upload a sample video someplace, and list the first few timestamps+duration of silence which should be removed? I wonder if ffmpeg's silencedetect can be used in a script in a similar way which cropdetect is used. |
silencededetect been used that way for audio only things as per reddit, (outdated) |
For example, it turns this https://youtu.be/T7SWETadMn0 16 min video into a 9 min video and from listening just to the audio I wouldn't be able to tell, it just sounds like she's speaking without ever catching breath AFAIK they use this |
Please don't refer to other players and what they do or don't do right. Just give a sample clip and describe the first few timestamps (seconds resolution would be enough) and rough duration where such silence should be removed. |
That wasn't my intention, since they're open source I've linked directly to the code bit so it might be of use to someone. |
Personally I want it for music. Because I would like to skip the 10 to 15 seconds of silence that for some reason initiates many recordings of classical music. I just want the music to start instantly when I start the player. |
@afcady that one is achievable with lavfi skipsilence filter, it's pretty much what it's meant for. |
I would love to see this feature. I think a lot of people would. I'd love to be able to do something like: mpv -detectSilence video.mp4 which results in mpv searching the audio stream for silence (for some given threshold) and opening it. It then set's like a"breakpoints" where the given silent part begins and ends and automatically skips it. Now people say that's a bad solution because you might skip content that's important but most people use it for lectures and how many lectures did you watch where the lecturer showed something without saying anything about it? Rarely, if ever. To accommodate that, one would need motion detection - but that is resource heavy, so for the sake of efficiency I'd just stick with the above approach. To give it more user friendlieness, one could enable the auto skip only on the first run through. So you watch the video, you come to a part where the video is silent for let's say 2 seconds and mpv automatically skips it. You now see that you somehow got lost and skip back. Since you skipped back manually, mpv won't skip forward again but let's you watch the previously skipped part. Would make the life of educational content consumer a lot easier. |
I really hope this feature will be implemented. IMHO, the user should have two options: to skip silent segments whenever they occur or to skip them only at the beginning and the end of the file.
|
I would like something similar to this browser extension: https://github.com/vantezzen/skip-silence |
This script solves the issue for SOME, videos, some meaning ones with subs/captions as it fast-forwards when no text is visible. Edit. just found that there's one for audio too |
RIGHT? I need this for MPV and as a chrome extension! |
T
There is a chrome/firefox extension already called skip-silence mentioned above, it works fairly well |
Hi, https://gist.github.com/6ed6308be78dd8a2f58c9a9109fe050b See the comments on the top for usage. Enjoy! |
Thank you so much for this!. It works well. Finally, I can get back to watching lectures on the desktop. |
speed-transition.lua script skips to the next subtitle rather than audio. No one has mentioned it here, it achieves quite a similar purpose if your video is subtitled. You can also use Ctrl+RIGHT/LEFT to skip to the next/previous subtitle, this keybind comes out of the box in mpv. |
Unfortunately most of my classes/lectures hold subs for pauses, rendering these useless for me. They kick in with a delay too. |
You might just re-do the timings with an automatic retimer like alass. I agree that speedup is preferable to cutting. |
I have tweaked the script https://gist.github.com/bitingsock/e8a56446ad9c1ed92d872aeb38edf124 (speed-transition-Audio.lua) and it works better now. Mainly the speed up to 5x during silences was too much and sometimes the upcoming audio would cut out. Now there is a gradual transition to 3x and works better. |
Have you found a satisfying way to use ffmpeg's silencedetect / silenceremove in mpv? I'm interested in experimenting with skipping over any silence in audio lasting more than a second or two. |
I wrote a script here and there is also another script here. Mine requires hwdec to be off and it works by fast forwarding, so it may or may not be practical for your use case @07416. EDIT: I'm now seeing bitingsock's script in this thread, it seems to work in a similar fashion. |
@AN3223 Good recommendations. Do you happen to know an entirely automated script (all three set keybinds)? I plan creating a dedicated profile for speech-only playback and perhaps another for music, skipping silence between songs and discovering hidden tracks. For this workflow manual actions don't quite fit. |
Hm, I'm not sure. Maybe someone can adapt one of the scripts for that purpose. I don't really use mine and I find it to be unreliable. |
Hello, I have a proof-of-concept to show. The following mpv lua script: The idea:
Usage:
Problems:
Possible improvements:
|
I rewrote my previous proof-of-concept and created a new script based on the same idea. See my comments in the file for further information: Have fun. Main problems: |
There is a new revision available under the link in my last post. Also if it is set too low, it can be that mpv can't skip fast enough |
Based on https://gist.github.com/bitingsock/e8a56446ad9c1ed92d872aeb38edf124 I created a highly configurable script that works without external programs. I've published it here: https://github.com/ferreum/mpv-skipsilence |
If you combine it with OpenAI's whisper-based subtitles generator (specifically this yt-whisper fork) — you will likely get desired result. I use whisper specifically to cut pauses in vlog-recorder with very high precision, the same way yt-whisper generates subtitles. Upd: something based on whisper.cpp, like whisper-subs, would be even better. |
Short update: With mpv 0.37, the audio/video desynchronization I mentioned above has been fixed. As a result, the skipsilence script works very well now. |
That's cool and all, there's one issue though, English isn't the only spoken language existing.
Amazing work, does everything that I wanted from such feature. It's a literal life-saver. |
There are multilingual models for whisper and whisper.cpp as well (for limited number of languages). |
Like this ffmpeg-based script that processes a file to remove silent parts with certain inputs for how silent it should be when cutting and such: github.com/carykh/jumpcutter
Another playback mode that would be useful is to detect silence from one of 2 audio channels, and playing mono.
There's probably a lot of things you can do with a "playback mode" feature.
The text was updated successfully, but these errors were encountered: