WofWca / jumpcutter

⏩ Fast-forwards long pauses between sentences — watch lectures ~1.5x faster (browser extension)
https://chrome.google.com/webstore/detail/jump-cutter/lmppdpldfpfdlipofacekcfleacbbncp
GNU Affero General Public License v3.0
329 stars 11 forks source link

feat: new skipping algorithm: based on caption (subtitle) timings #149

Open WofWca opened 1 year ago

WofWca commented 1 year ago

Fadi suggested this.

It can work for videos that have captions/subtitles (YouTube can even auto-generate them). Each caption has a time range that is supposed to be displayed for:

WEBVTT

00:01.000 --> 00:04.000
- Never drink liquid nitrogen.

00:05.000 --> 00:09.000
- It will perforate your stomach.
- You could die.

We could simply skip every range that doesn't have captions (subtitles?). Fortunately, the cloning algorithm already implements skipping according to an array of time ranges, so it's a matter of bootstrapping stuff:

https://github.com/WofWca/jumpcutter/blob/90931ad3b1979aa1be141e3c8dc6b8ceea891bfb/src/entry-points/content/ElementPlaybackControllerCloning/ElementPlaybackControllerCloning.ts#L427

See https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video for more on captions in browsers.

WofWca commented 1 month ago

Another project implements the captions algorithm!

https://github.com/WojtekTB/UCSD-Silence-Fast-Forward/blob/main/scripts/helper_functions.js#L157