This request would involve some collaboration with thetvdb but an entry in the database for the time to skip at the beginning of a TV episode and being able to enable-disable it.
Just out of curiosity, how would this even be possible? Does TVDB keep track of when intros start and end or something?
I recognize this is not really what the OP wants, but I do this with all of my TV Shows already. Push my remote button one time to forward to next chapter and voila, it skips ahead to first chapter after opening.
thetvdb doesn’t to my knowledge have entries for the length of a programs intro. Thats why I mentioned that there would need to be some collaborative work with them to add those fields. So having an intro start point and intro end point as some shows have an intro after leading you into the story first.
This isn’t a must have feature, I just thought of it as I’ve been watching Six Feet under from beginning to end again and it would be nice to auto skip the intro (as cool as it is, watching 2 or 3 episodes in a row I find myself wanting to skip it).
For now I’m doing the skip forward trick which really made me think of this feature.
Again, no biggie. Just a neat feature no one has implemented anywhere.
Into/credits auto-skip needs to happen!
Resurrecting an old thread here, but this really is an obvious feature that is completely doable, especially since Plex is designed, for the most part, to work with “main stream” media. I like the idea of using TVDB etc. to just store the times for intro/credits, but not all rips are the same and it can be done with local media easily enough. So here’s a way to make it happen using dejavu and MoviePy, and an alternate method inspired by Videogrep.
(mostly) automated identification of intro/credits offsets in episodes of a series
- Manually extract the audio for the intro/credits from an episode (This process could be automated by using the intro theme music provided by Plex already. I don’t suppose there’s a similar feature for credits, so that would require some input from the user, just a timestamp)
- For each episode, extract the audio of the beginning and end (the first and last 3-5 minutes of the episode).
- Make a dejavu database containing beginning audio clip and another containing the end audio clip.
- Search the first dejavu database for the intro and the second for the credits, recovering, among other things, the offset of the match, indicating the time that the intro/credits starts in the beginning/end audio files. This can be used to find the offset of the intro and credits in the episode itself.
- With the intro/credits offsets and lengths known, could have Plex add the necessary GUI elements to skip the intro or skip to next episode. If that’s not possible, can use this information to cut the episode apart and use segmented MKV files, all achievable with MoviePy, to achieve the desired behavior. Or simply cut out the intro and credits for all but the first episode of each season and store the intro-less versions alongside the originals.
Steps 2 and after can be entirely automated, and I think there are some clever ways to automate step 1
E.g. one could get the sample intro/credit audio by searching for an identical audio segment in multiple episodes. One way would be to start by breaking up the first and last few minutes of several episodes first into 5 second clips and see which match, then increase the length of the clip to 10 seconds, then 15, then 30, etc. until you’ve found the maximum length clip whose audio fingerprint appears in all the files. The clip length would be adjusted to get it just right. You could even use a SciPy minimizer and a cleverly written function based on the quality of the audio fingerprint match to achieve very accurate results, though that may be overkill since an extra half-second won’t kill anybody. I’m not exactly sure what the process would look like in terms of the creation and use of dejavu databases, but I’m sure it’s possible.
Both dejavu and MoviePy are python libraries, and the basics of what I describe here would be easy to achieve. I imagine some fine tuning and testing would be necessary in order to achieve a fully automated solution, but that’s also very doable.
Of course, dejavu may not be the ideal too for this, but I think audio fingerprinting is the way to go.
A subtitle-based method
Videogrep is a clever tool that makes super-cuts of videos based on their accompanying subtitles. This made me consider that, if you have subtitles for every episode in a series, and the subtitles have something along the lines of “Intro music playing…” that shows at the beginning of the intro, then you can use that to get the intro/credits offsets, thereby eliminating the need for steps 1-4 above, skipping straight to the Plex GUI implementation for skipping the intro/credits or cutting the files based on these offsets.
Moving forward
I figure someone (who ideally isn’t me) would write this up as a separate Python utility as a proof of concept, and hand that over to the Plex devs so they could implement it right. It’s not completely necessary for Plex to get the extra metadata and playback changes to make this happen, since you could just adjust the files to achieve automatic skipping of intro/credits as desired. But a solution that requires the complicated use of segmented MKV files or results in nearly doubling the space of all your series just to cut out 2 minutes from each episode seems like a poor solution. This should really be a convenience offered to users no matter what, and therefore a completely automated process that runs alongside the, already expansive, background tasks performed by Plex. If Plex were to add this as a proper feature, then the implementation could be, ideally, something like what’s described below.
Intro/credits auto-skip in current Apple TV 4 Netflix app
Here’s how Netflix does it, and it’s phenomenal!
- When a series watching session is started (i.e. the app is launched and an episode is selected and played from beginning) the current episode plays from the beginning, and as the intro begins (which may be after some time because of a cold start), a button appears, “Skip Intro”, so the user need only press the “OK” button to skip past the intro.
- Towards the end of the episode, as the credits start, two buttons appear, “Watch credits” and “Playing next episode in 5…4…3…” (the number counts down), where “Playing next episode” is the default choice and by either pressing “OK” or doing nothing and allowing the countdown to complete, the remainder of the current episode is skipped and the next episode begins.
- If the next episode starts with an intro, it is skipped automatically, so that by either selecting “Playing next episode” or letting it timeout, the user is skipped straight to the end of the intro of the next episode. If the next episode does NOT start with an intro (has a cold start), then the behavior is as in (1).
After using this implementation in the Apple TV 4 Netflix app for several weeks, I have to say it’s EXACTLY how Plex needs to do it. Hope there’s no bogus copyright or anything keeping the implementation from being too similar.
@twilsonco said:
Here’s how Netflix does it, and it’s phenomenal!
- When a series watching session is started (i.e. the app is launched and an episode is selected and played from beginning) the current episode plays from the beginning, and as the intro begins (which may be after some time because of a cold start), a button appears, “Skip Intro”, so the user need only press the “OK” button to skip past the intro.
- Towards the end of the episode, as the credits start, two buttons appear, “Watch credits” and “Playing next episode in 5…4…3…” (the number counts down), where “Playing next episode” is the default choice and by either pressing “OK” or doing nothing and allowing the countdown to complete, the remainder of the current episode is skipped and the next episode begins.
- If the next episode starts with an intro, it is skipped automatically, so that by either selecting “Playing next episode” or letting it timeout, the user is skipped straight to the end of the intro of the next episode. If the next episode does NOT start with an intro (has a cold start), then the behavior is as in (1).
Sounds nice but no magic is taking place. This was programmed in manually. Netflix would not know the first 47 seconds of a show was “Previously on How Aliens Walked the Earth”, or the first 64 seconds was the opening intro without someone indexing the time or getting the info from the shows network.
Also, I’ve notice almost all(if not all) netflix originals having this option but other content they don’t.
I don’t know… Seems like alot of work for very little gain. I mean, it’s easy to maintain time indexes for content you’ve created, or are authorized to distribute. The good folks at TVDB would be hard press to keep up with the vast number of releases for a single episode of anything. Some are a bit easier (netflix originals, amazon originals, hulu originals) as these only have one source but T.V. sources can be HDTV/WEBRip/WEB-DL/etc… Each one of these will probably have different start/end time as well as different intros/credits and release groups. Take the release group FLEET for example. They like to hack the s#!t out of their releases.
This would need to be totally optional if it came (not like the post play screen which cannot be removed)
I want zero popups when starting/ending a show, i want to see it in its full
What Netflix do is awful, imo, and if Plex copied this i would uninstall it
@NewPlaza said:
Sounds nice but no magic is taking place. This was programmed in manually.
I figured as much for Netflix, as they have the manpower to go through and tag episodes for this feature. I was just trying to give an example of how this would be implemented in the GUI.
@paulsalter said:
This would need to be totally optional if it came
Of course! I imagine a few options for it. One to disable the feature entirely, and another to change the timeout behavior so that doing nothing results in both watching the credits and the next episode’s intro.
@paulsalter said:
I want zero popups…
I agree. Though I don’t really consider the small buttons shown in Netflix to skip the intro a “popup”. Just a button really. Though it is a matter of taste.
This would be yuge! Not only does the intro/title/credits/outro waste time for some viewers, but it is often much louder than the show itself.
Imagine you’re falling asleep to the Star Trek crew politely laughing at Data’s humanisms, and then…DOOO! DO DO DOOO! DO DO DOOOOOOO!!! the theme-song orchestra wakes you the hell up.
I will gladly update all my MKVs to somehow mark chapters as skippable, if the Plex player could add an option to skip them (or lower the volume?). There isn’t a standard for this yet, so let’s start one right here:
How about appending [TS]
or [Title Sequence]
to chapter names, and then having the option to “Skip Title Sequence Chapters”? Who knows, maybe VLC will incorporate it, too. There is already a similar feature request. And maybe encoders will start using it…
Good idea: volume options for the intro/credits/outro.
I’d like a solution that doesn’t require mkv containers though. Simple metadata for the items should be sufficient, either fetched from online databases or determined automatically like I describe above.
I haven’t had the time to make any significant progress with the audio fingerprinting method, unfortunately.
@twilsonco said:
Good idea: volume options for the intro/credits/outro.I’d like a solution that doesn’t require mkv containers though. Simple metadata for the items should be sufficient, either fetched from online databases or determined automatically like I describe above.
I haven’t had the time to make any significant progress with the audio fingerprinting method, unfortunately.
I should have found this thread before. I have started working on a tool that your describing.
Simple put:
Download all themes from plex, make a audio print. Listen to websocket for ppl starting a new episode. Download the first 10 min of the episode. Try to figure out when that ends. Stick the result in a db. Send a seek command to the client. Start processing the next episode of the same show, store that in the dB.
You can find the project here:
That’s fantastic. Do you think it’s feasible to identify the theme start/end times without having to download the themes from plex, thereby opening your tool to skip end credits as well?
@twilsonco said:
That’s fantastic. Do you think it’s feasible to identify the theme start/end times without having to download the themes from plex, thereby opening your tool to skip end credits as well?
No, I think we have to handle this another way.
It would be pretty sweet if whatever we come up with here can handle both intros and outtros, including those with cold opens.
Thanks for your work @Hellowlol !
I’ve been playing with a method in my head. Add the audio from the first/last 5 minutes of every show in a series/season in small (eg 5 second) increments into an audio fingerprint hash table. The small portions that are shared between multiple episodes are most likely things like openings and end credits. This hints at a more general method for identifying the start and stop times of portions that are repeated across episodes, don’t you think?
@twilsonco Might have be closer to 10 ~ 15 minutes–Star Trek: TNG and Battlestar both have some long cold opens–but the idea seems sound (no pun intended).
Netflix appears to use frame fingerprinting. See their patent: patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=9418296.PN.&OS=PN/9418296&RS=PN/9418296
@twilsonco said:
I’ve been playing with a method in my head. Add the audio from the first/last 5 minutes of every show in a series/season in small (eg 5 second) increments into an audio fingerprint bash table. The small portions that are shared between multiple episodes are most likely things like openings and end credits. This hints at a more general method for identifying the start and stop times of portions that are repeated across episodes, don’t you think?
Thats is a good idea. Todo for new stuff is speeding up the download of the themes from YouTube and adding modes.
Mode theme will do nothing other then play until theme then jump to right to theme end. This is be the default action since it the safest option.
Mode recap willl use pocketsphinx to make a transcript of the video and looking to words like last season, previously on xx this will be a config option to ppl can add there own words/ in other langs.
My wish is that a real programmer helps out so we can add a proper db. I don’t understand any of the magic audfprint does. It would be cool if we could use a db so make a flask app or something. Ppl could a browser extension to query the db and make a dialog box if they use lex web.
I release a a version to pip so it easier to get started.
I came across https://github.com/daeks/Chapter-Agent.bundle/blob/master/Contents/Code/init.py today. It would be cool so modify this for tvshowsand adding chapters markings for the intro so clients can skip by a push of a button. It would be simple to automate as we would just see if the correct chapters and jump
** edit
Adding chapters via a Agent metadata does not seem to be possible for tv shows
Bw_plex has been updated. It no longer limited to python 2. The analysis has also been changed.
The primary method is still finding the theme song, but we also looking for places where there are black frames and audio silence. We check for recaps using subtitle or audio transcripts.
There are two modes: the default will only skip the theme while the other will jump to theme end if we detect a recap.
Does anybody have a suggestion on a show that uses: recap, show, theme song show?