Jump to content

Show Intro Skip Option


Liquidfire88

Recommended Posts

samuelqwe
49 minutes ago, chef said:

@samuelqwe might know for certain. 

 

There are areas in the code where we look at the contiguous regions between the two uint arrays... could this be dialed in?... I don't know.

We can probably do some adjustments there and even potentially adjust the fingerprints to get "cleaner" results.

The way the contiguous region is calculated currently could be prone to errors in certain scenarios, so there might be a better way to do it.

  • Like 2
Link to comment
Share on other sites

Cheesegeezer
7 minutes ago, chef said:

EDIT: @Cheesegeezer ever notice that  Emby's UI objects don't seem to handle inputs with a number type. Interesting....

can't say i have issues with the Vantage point number inputs

			<div class="inputContainer">
			            <input is="emby-input" type="number" id="txtNumAds" min="1" max="50" step="1" label="No of Ads/Funnies to play"/>
			            <div class="fieldDescription">Use this to play a Adverts, Commercial, funny infills, etc (Max 50)</div>
		            </div>

 

Link to comment
Share on other sites

Micael456
47 minutes ago, chef said:

In my opinion... Maybe.

But, there is some just scepticism around if it is actually possible because people will have different encodings, and thus have different results.

Yep. Though I did actually have a thought to make the numbers more manageable here. Originally we were thinking we'd have to hash the whole file, with all the possible permutations out there.

But.

ffmpeg (though ffprobe is easier iirc) allows you to md5 hash the streams independently, so we can identify the audio stream(s) separately to the video. There's a much higher chance that two people downmux the same audio track to say 320kbps aac than there is to match the whole video file.

Likewise, if someone were to rip an episode and only downmux the main audio track (e.g. 5.1 to 2.1), they may very well leave the commentary track (if they keep it), at the original encoding since those are often 2.0 only). So we would also be able to match on that too, again cutting down on the number of duplicates.

 

e.g.

id_tvdb id_imdb IntroStart IntroEnd md5_hashes
25335 tt0709233 04:04 05:03 {643cf2aef1f9c63d9b52834d263e1a54,65b5917a43252421dd74445160dac6e6,14fe47b2d44792743cfbfefe188d08a6}

Example code to generate that hash: (third audio track)

ffmpeg -i "\\NAS\d\TV Shows\Stargate Atlantis\Season 1\1x03 - Hide and Seek.mkv" -map 0:3 -f hash -hash md5 -

 

  • Like 1
Link to comment
Share on other sites

guardianali

If people need help with the logistics of how to implement, plex has a working skip intro button for a little while now. I believe a large chunk of their code is still under GPL and is open to the public.  Not saying we have to copy them but maybe their code and method of implementation could help with this effort...?

  • Thanks 1
Link to comment
Share on other sites

Cheesegeezer
9 minutes ago, samuelqwe said:

We can probably do some adjustments there and even potentially adjust the fingerprints to get "cleaner" results.

The way the contiguous region is calculated currently could be prone to errors in certain scenarios, so there might be a better way to do it.

I have a  intros from Westworld season 1 where the intro is detected from 0 to 1m14 secs, which is not correct.

@rbjtech has the same episode but his are detected correctly.

Is it worth uploading both of them from each of us, so you could possibly run them thru a spectrogram to assess the differences and see why mine failed and his didn't.  Might help with troubleshooting and improving detection.

Link to comment
Share on other sites

samuelqwe
20 minutes ago, Cheesegeezer said:

Is it worth uploading both of them from each of us, so you could possibly run them thru a spectrogram to assess the differences and see why mine failed and his didn't.  Might help with troubleshooting and improving detection.

I may be able to see what's going since I have my own external version of the intro skip detection algorithm that exports a graph of the differences in the audio. Can't guarantee anything though, as it may be too minor to easily spot what's going on, but I can always try.

Link to comment
Share on other sites

crusher11
8 minutes ago, samuelqwe said:

I may be able to see what's going since I have my own external version of the intro skip detection algorithm that exports a graph of the differences in the audio. Can't guarantee anything though, as it may be too minor to easily spot what's going on, but I can always try.

Did you see my post earlier in the thread in which I attached samples from The Alfred Hitchcock Hour?

Link to comment
Share on other sites

samuelqwe
4 minutes ago, crusher11 said:

Did you see my post earlier in the thread in which I attached samples from The Alfred Hitchcock Hour?

There are a lot of posts in this thread so I may have missed it, but if you link the post I could take a look at it. Again, no guarantees I'll be able to find anything, but I can try.

Link to comment
Share on other sites

crusher11
2 minutes ago, samuelqwe said:

There are a lot of posts in this thread so I may have missed it, but if you link the post I could take a look at it. Again, no guarantees I'll be able to find anything, but I can try.

 

  • Thanks 1
Link to comment
Share on other sites

50 minutes ago, Micael456 said:

Yep. Though I did actually have a thought to make the numbers more manageable here. Originally we were thinking we'd have to hash the whole file, with all the possible permutations out there.

But.

ffmpeg (though ffprobe is easier iirc) allows you to md5 hash the streams independently, so we can identify the audio stream(s) separately to the video. There's a much higher chance that two people downmux the same audio track to say 320kbps aac than there is to match the whole video file.

Likewise, if someone were to rip an episode and only downmux the main audio track (e.g. 5.1 to 2.1), they may very well leave the commentary track (if they keep it), at the original encoding since those are often 2.0 only). So we would also be able to match on that too, again cutting down on the number of duplicates.

 

e.g.

id_tvdb id_imdb IntroStart IntroEnd md5_hashes
25335 tt0709233 04:04 05:03 {643cf2aef1f9c63d9b52834d263e1a54,65b5917a43252421dd74445160dac6e6,14fe47b2d44792743cfbfefe188d08a6}

Example code to generate that hash: (third audio track)


ffmpeg -i "\\NAS\d\TV Shows\Stargate Atlantis\Season 1\1x03 - Hide and Seek.mkv" -map 0:3 -f hash -hash md5 -

 

Whoa, that's very cool. Then all you have to do is lookup the specific hash and respond with the appropriate chromaprint. 

 

Link to comment
Share on other sites

rbjtech
57 minutes ago, Cheesegeezer said:

I have a  intros from Westworld season 1 where the intro is detected from 0 to 1m14 secs, which is not correct.

@rbjtech has the same episode but his are detected correctly.

Is it worth uploading both of them from each of us, so you could possibly run them thru a spectrogram to assess the differences and see why mine failed and his didn't.  Might help with troubleshooting and improving detection.

Happy to do this - or I just give you access to the library and you can d/l yourself - either way works for me.

Can you remember what ep's they were Cheese ?

Link to comment
Share on other sites

samuelqwe
10 minutes ago, rbjtech said:

Happy to do this - or I just give you access to the library and you can d/l yourself - either way works for me.

Can you remember what ep's they were Cheese ?

BTW, I just need the audio from the episodes. Should make things easier to upload.

  • Thanks 1
Link to comment
Share on other sites

Cheesegeezer
3 minutes ago, samuelqwe said:

BTW, I just need the audio from the episodes. Should make things easier to upload.

i'll need to run the fp and detect on the the season again as i have been editing chapter points to test the insertion methods.  So i can identify the episodes again.

will get them in a bit

  • Like 1
Link to comment
Share on other sites

Cheesegeezer

@chef

This should fix some more wierd chapter anomolies.

You are in charge of pull requests from now on.  So please merge when you are ready

image.png.39238f081bc70f906d4357340163cd73.png

  • Like 1
Link to comment
Share on other sites

Cheesegeezer
30 minutes ago, rbjtech said:

Happy to do this - or I just give you access to the library and you can d/l yourself - either way works for me.

Can you remember what ep's they were Cheese ?

TADAAAAAA

image.png.4d7f68b7636ba595fb95eb305f7224ef.png

  • Haha 1
  • Thanks 1
Link to comment
Share on other sites

rbjtech
4 hours ago, Cheesegeezer said:

i'll need to run the fp and detect on the the season again as i have been editing chapter points to test the insertion methods.  So i can identify the episodes again.

will get them in a bit

likewise - got some other stuff to do before it gets dark - will be a couple of hours and I'll PM them to you.. 

edit - PM/files sent - thanks @samuelqwe

Edited by rbjtech
Link to comment
Share on other sites

Cheesegeezer
2 hours ago, chef said:

I'm not sure if we should have a select box of series, and an add button?

Maybe under it is a 'paperlist' the item gets added to. Then each entry in the list has a trash icon that will remove the item?

We just keep an array of series Id's in the configuration, they get ignored in the scan.

It's most likely better to have a list of items to ignore, then a list of items to scan.

Bingo!! Absolutely what i was thinking! 
 

  • Agree 1
Link to comment
Share on other sites

rbjtech
5 hours ago, Micael456 said:

Yep. Though I did actually have a thought to make the numbers more manageable here. Originally we were thinking we'd have to hash the whole file, with all the possible permutations out there.

But.

ffmpeg (though ffprobe is easier iirc) allows you to md5 hash the streams independently, so we can identify the audio stream(s) separately to the video. There's a much higher chance that two people downmux the same audio track to say 320kbps aac than there is to match the whole video file.

Likewise, if someone were to rip an episode and only downmux the main audio track (e.g. 5.1 to 2.1), they may very well leave the commentary track (if they keep it), at the original encoding since those are often 2.0 only). So we would also be able to match on that too, again cutting down on the number of duplicates.

 

e.g.

id_tvdb id_imdb IntroStart IntroEnd md5_hashes
25335 tt0709233 04:04 05:03 {643cf2aef1f9c63d9b52834d263e1a54,65b5917a43252421dd74445160dac6e6,14fe47b2d44792743cfbfefe188d08a6}

Example code to generate that hash: (third audio track)



ffmpeg -i "\\NAS\d\TV Shows\Stargate Atlantis\Season 1\1x03 - Hide and Seek.mkv" -map 0:3 -f hash -hash md5 -

 

I've been giving this some thought - and had a light bulb moment ( I think..) 🤪

It doesn't actually matter about the content/codec/bitrate/language/version of file you have - the only thing which is of relevance is the duration of the show.

If your 'version' of the show is the same duration as the lookup db - then would that not indicate that the Intro is highly likely to be at the same time ?

If you had a different version with lets say a recap included - then it would be a longer duration - but again, the recap is fixed, so easily identifiable.

We don't even need a hash match - as you can just match by the tvdb episode id.

So each episode may have say 3 possible Intro start/stop times -

1. dvd/bluray release (probably no HBO type intro, no recap) - duration 57 mins 10 seconds

2. Original Broadcast ( No recap) - duration 57 mins 5 seconds

3. Original Broadcast (Recap) - duration 58 mins 10 seconds

You match 'your' file to the nearest duration (1,2 or 3) - and your Intro is certain to be in the same place ?  No FP or Detect required ...

Edited by rbjtech
Link to comment
Share on other sites

10 minutes ago, rbjtech said:

I've been giving this some thought - and had a light bulb moment ( I think..) 🤪

It doesn't actually matter about the content/codec/bitrate/language/version of file you have - the only thing which is of relevance is the duration of the show.

If your 'version' of the show is the same duration as the lookup db - then would that not indicate that the Intro is highly likely to be at the same time ?

If you had a different version with lets say a recap included - then it would be a longer duration - but again, the recap is fixed, so easily identifiable.

We don't even need a hash match - as you can just match by the tvdb episode id.

So each episode may have say 3 possible Intro start/stop times -

1. dvd/bluray release (probably no HBO type intro, no recap) - duration 57 mins 10 seconds

2. Original Broadcast ( No recap) - duration 57 mins 5 seconds

3. Original Broadcast (Recap) - duration 58 mins 10 seconds

You match 'your' file to the nearest duration (1,2 or 3) - and your Intro is certain to be in the same place ?  No FP or Detect required ...

Yes. The encoding of the fingerprint will be the same, or similar enough.

Remember we use Hamming Distance calculations to weigh out the differences between the int arrays.

So they only have to be similar.

(it's totally a side, and doesn't really matter) but if we used  Levenshtein Distances, instead of Hamming Distances, it is possible that the durations of encodings don't have to be the same.

 

Edited by chef
Link to comment
Share on other sites

rbjtech
8 minutes ago, chef said:

Yes. The encoding of the fingerprint will be the same, or similar enough.

Remember we use Hamming Distance calculations to weigh out the differences between the int arrays.

So they only have to be similar.

 

For an online lookup @chef,  I believe we don't need any FP - all we need is the duration of the show.

I realised this when I was comparing the Westworld episodes - @Cheesegeezer Intro times are 'almost' exactly the same as mine (1 second longer) and thinking about it - why wouldn't they be ?!

His versions may be 4K UHD, Dolby Atmos THD, even in another language - but it doesn't matter - his intro is going to be in exactly the same place as my 'version' IF the show duration is the same.

?

Edited by rbjtech
Link to comment
Share on other sites

samuelqwe

It would be fantastic if we could dramatically increase the speed of the detection by making the calculations themselves faster…

Edited by samuelqwe
Removed quote :)
  • Agree 1
Link to comment
Share on other sites

Cheesegeezer
3 hours ago, chef said:

Oh my... They are correct 😲

1second-3.thumb.png.13fca8c9c2c4b867be636e0dbfc18357.png

This is the last frame of the intro.

1second-4.thumb.png.3e019a0940a334eff4c2586fc593372d.png

That's pretty awesome chef!!

Link to comment
Share on other sites

15 minutes ago, Cheesegeezer said:

That's pretty awesome chef!!

I'm re-running the scan to make sure, but that's crazy right?!? 1 second for title sequence detection... 

All I did was learn who Richard Hamming was, then I read about how he created the algorithm that calculated the difference in strings and how it applies to integers. Then read about how you can make his algorithm faster. 

Better make sure.... but 1 second?!?! 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...