ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.38k stars 9.96k forks source link

Consider creating an edit decision list for youtube videos from the SponsorBlock database #26084

Open db48x opened 4 years ago

db48x commented 4 years ago

Checklist

Description

SponsorBlock is a nice browser extension which allows viewers to crowdsource information about the different content segments in the videos they watch. Segments can be categorized as advertisements, intros or outros, self promotions, etc. Segment categories are annotated on the video timeline and advertisements are automatically skipped.

Youtube-dl could download this information from SponsorBlock's API and then save the information as an edit decision list in a format usable by common video players.

Of course there are questions to consider. Different users may want to automatically skip a different set of segment categories, so in an ideal implementation that would be configurable. Perhaps a command-line argument such as --sponsorblock-autoskip-categories=[sponsor,intro,outro,interaction,selfpromo,music_offtopic] would work. Of course a simple implementation could skip this step and simply build the EDL from the sponsor category alone.

Worse, however, is that not every video player supports the same format for edit decision lists. VLC's documentation is poorly organized, but it appears that it can read this information from both M3U and XPSF playlist files. Mplayer has a very simple EDL file format. (Repeat ad infinitum for all other video players.) It seems likely that an initial implementation would pick one of these formats while leaving room for extension over time as more formats can be generated. An option like --generate-edl-from-sponsorblock-api would do to start, and it could be extended later to let the user specify which format to generate.

There are other existing feature requests for creating playlist files, which as far as I can tell do not overlap with this request. Of course they do share some technical requirements around creating various playlist formats. Hopefully implementing this feature would make it easier to implement the others, and visa-versa.

tiwarys commented 3 years ago

SponSkrub is an implementation of this feature but it only works for individual videos, not playlists. yt-dlc is trying to implement this feature. Check this for more information.

JanPokorny commented 3 years ago

Do note that SponSkrub only runs on Linux, with the author stating that he has "no intention of supporting Wangblows". A proper support would require forking the project and providing multi-platform releases -- or better yet, rewriting the (not so complex...) utility in Python.

db48x commented 3 years ago

This is good news, although personally I'm a little wary of a solution that destructively edits the video rather than making an edit decision list that can be updated later.

Harsh-dbey commented 3 years ago

+1

pukkandan commented 3 years ago

@JanPokorny I have forked sponskrub and made a windows release

https://github.com/pukkandan/SponSkrub

JanPokorny commented 3 years ago

@pukkandan Splendid! Let's hope one day, someone rewrites the huge D monstrosity in 50 lines of Python. 😆 (It's on my to-do list but you know how it goes... Here's a PoC: https://github.com/faissaloo/SponSkrub/issues/13#issuecomment-729264229)

pukkandan commented 3 years ago

@JanPokorny When you manage to make any progress on that, do let me know

This may be of use to you: https://github.com/JSubelj/yt-dl-sb

Lee-Carre commented 2 years ago

VLC … appears that it can read this information from both M3U and XPSF playlist files.

Having relevant experience; it has a variety of CLI options for setting start & end (playback) points within the full duration of the media (video, audio, whatever). Run vlc --full-help to enumerate a list.

A simple approach would be to use a series of these, for each segment you want to be played (omitting the segments to be skipped), while enqueueing to the (existing) playlist. Though, if VLC would read the segment-list from a textual file in the same directory (like for closed captions), that would be far more portable. If it were a playlist format, then I think that could be enqueued to any existing playlist (or trigger VLC to launch and play only that playlist of segments).

I think it may be possible to also tell VLC to mute, and such, via its XSPF extensions.

Another thought is to (somehow) leverage the chapter list.

Though, it's been a while since I tinkered with VLC in such ways. VLC has changed since then, and my knowledge is out-of-date.

pukkandan commented 2 years ago

Forgot this issue existed! yt-dlp has implemented this feature for a while now