Jump to content

Show Intro Skip Option (Plugin)


Liquidfire88

Recommended Posts

@samuelqwe I am not sure what kind of l statement this is 😂

f1[int(offset):int(len(f1))]

In c# the ":" can (sometimes) mean "else".

I can see a a comparison between the offset, and the length of f1, but I don't know what ":" <-- means 🤪

Edited by chef
Link to comment
Share on other sites

31 minutes ago, chef said:

@samuelqwe I am not sure what kind of l statement this is 😂




f1[int(offset):int(len(f1))]

In c# the ":" can (sometimes) mean "else".

I can see a a comparison between the offset, and the length of f1, but I don't know what ":" <-- means 🤪

The ":" is to specify the range of the elements you want in that list.

So in this case, I want all the elements in the list f1 starting from index offset to index length of f1.

Does that make sense?

EDIT: This website might explain it better than me haha.

Edited by samuelqwe
  • Thanks 1
Link to comment
Share on other sites

21 minutes ago, chef said:

@samuelqwe I am not sure what kind of l statement this is 😂


f1[int(offset):int(len(f1))]

In c# the ":" can (sometimes) mean "else".

I can see a a comparison between the offset, and the length of f1, but I don't know what ":" <-- means 🤪

Its a slice of the original data starting at offset and going to len(f1)

data[ start_index : end_index ]

 

  • Thanks 1
Link to comment
Share on other sites

Okay, it's like "GetRange" of IEnumberable in c#. 

I suppose the translation should deal with List<T> instead on Array.

Thank you guys.

Link to comment
Share on other sites

Sorry,

in "getBestOffset"

index = output.index(max(output))

is this placing an index marker at the end of the "output" array?

{cringe...}

Link to comment
Share on other sites

18 minutes ago, chef said:

Sorry,

in "getBestOffset"



index = output.index(max(output))

is this placing an index marker at the end of the "output" array?

{cringe...}

its finding the max in the array of integers

 

output = [10, 11, 4, 100, 56]

index = output.index(max(output))

print(index)

will print 3

 

Edited by TeamB
Link to comment
Share on other sites

Just now, TeamB said:

its finding the max in the array of integers

 


output = []

output.append(10)
output.append(11)
output.append(4)
output.append(100)
output.append(56)

index = output.index(max(output))

print(index)

will print 3

 

Oh, right! the position in the array where the highest integer resides.

 

Link to comment
Share on other sites

I was able to correctly detect the start of the theme music in the first 7 epp of StarTrek - Discovery season 3


S03E01 - 09:52
S03E02 - 04:58
S03E03 - 09:17
S03E04 - 05:31
S03E05 - 06:37
S03E06 - 08:22
S03E07 - 07:48

The scan approach had a very good detection with a large distance variation drop when it found the correct starting points.

A few things to consider;

  • what about TV shows that have different theme songs/music for different seasons?
  • are there any tv shows that have no or random theme music?
  • would it be possible to have a lib of theme song chromaprints available, perhaps this is already a thing?
  • Like 1
Link to comment
Share on other sites

23 minutes ago, TeamB said:

A few things to consider;

  • what about TV shows that have different theme songs/music for different seasons?
  • are there any tv shows that have no or random theme music?
  • would it be possible to have a lib of theme song chromaprints available, perhaps this is already a thing?

I think the best approach would be to scan each season on its own instead of one whole show at a time using the same intro segment for every season. My script doesn’t require an existing theme song as it finds the common audio segment between the episodes, which is the intro/theme song. While it could be possible to have theme song chromaprints ready to go, it is probably wiser to calculate them on the fly, because different versions of the same show might not chromaprint exactly the same, which could lead to some inaccuracies.

Also, forgot to add this initially, but there are definitely shows without intros. Those shouldn’t really pose a problem though as there won’t be any obvious similarities between the audio clips. And I can’t personally recall shows with random theme music, but it’s likely they exist. Those are probably much less common, though.

Edited by samuelqwe
Fixed typo and no theme song remark
  • Like 1
Link to comment
Share on other sites

12 minutes ago, TeamB said:

I was able to correctly detect the start of the theme music in the first 7 epp of StarTrek - Discovery season 3


S03E01 - 09:52
S03E02 - 04:58
S03E03 - 09:17
S03E04 - 05:31
S03E05 - 06:37
S03E06 - 08:22
S03E07 - 07:48

The scan approach had a very good detection with a large distance variation drop when it found the correct starting points.

A few things to consider;

  • what about TV shows that have different theme songs/music for different seasons?
  • are there any tv shows that have no or random theme music?
  • would it be possible to have a lib of theme song chromaprints available, perhaps this is already a thing?

Mr. Robot episodes have no intro to them. They recap, then start the episode.

Link to comment
Share on other sites

Looking good - i had missed the convert to mono bit - but that should make it work with any audio type - subject to testing

 

An easy way to get the markers into emby would be to create a chapters file with two chapters "Intro Start" and "Intro End" or similar and mux that into the file using ffmpeg

Note if the file already has real chapters they would need to be maintained also if the file ends up with only two chapters - then thats all emby will extract for thumbnails - So... it might be worth adding the 5min chapters for files that do not come with chapters in the first place.

The time to remux the file will be short on even a low power machine as you are not changing any of the video or audio - just adding a couple of chapter markers - i have done this a lot for a post processing script - so if you are not sure how to do it then let me know - its in the ffmpeg help pages - which are such a joy to use and read :) 

Once read by emby then the intro chapter can be skipped as an interim measure till the devs come up with an auto skip option - based on the chapter name etc

 

  • Like 1
Link to comment
Share on other sites

Psych has two different intros of different lengths that are used seemingly at random across episodes. Would this work with that? 

Link to comment
Share on other sites

31 minutes ago, PenkethBoy said:

An easy way to get the markers into emby would be to create a chapters file with two chapters "Intro Start" and "Intro End" or similar and mux that into the file using ffmpeg

Note if the file already has real chapters they would need to be maintained also if the file ends up with only two chapters - then thats all emby will extract for thumbnails - So... it might be worth adding the 5min chapters for files that do not come with chapters in the first place.

The time to remux the file will be short on even a low power machine as you are not changing any of the video or audio - just adding a couple of chapter markers - i have done this a lot for a post processing script - so if you are not sure how to do it then let me know - its in the ffmpeg help pages - which are such a joy to use and read :) 

Once read by emby then the intro chapter can be skipped as an interim measure till the devs come up with an auto skip option - based on the chapter name etc

 

This could definitely work as an interim solution as you said, I just personally don’t want to modify the chapters on my files 😛

  • Haha 1
Link to comment
Share on other sites

1 hour ago, samuelqwe said:

I think the best approach would be to scan each season on its own instead of one whole show at a time using the same intro segment for every season. My script doesn’t require an existing theme song as it finds the common audio segment between the episodes, which is the intro/theme song. While it could be possible to have theme song chromaprints ready to go, it is probably wiser to calculate them on the fly, because different versions of the same show might not chromaprint exactly the same, which could lead to some inaccuracies.

Also, forgot to add this initially, but there are definitely shows without intros. Those shouldn’t really pose a problem though as there won’t be any obvious similarities between the audio clips. And I can’t personally recall shows with random theme music, but it’s likely they exist. Those are probably much less common, though.

Trying to auto find similar blocks of audio across multiple episodes might work, however would need to test and see how this goes, the only problem I could see is where shows have a recap/primers at the beginning that does not change over a few episodes, small audio sections will be similar, that might play havoc with the similar area detection process.

Link to comment
Share on other sites

16 minutes ago, crusher11 said:

Psych has two different intros of different lengths that are used seemingly at random across episodes. Would this work with that? 

interesting, it could be factored in, search for one then the other, it would increase the scan time though.

Link to comment
Share on other sites

1 hour ago, chef said:

Mr. Robot episodes have no intro to them. They recap, then start the episode.

I guess that is not an issue and you can skip what is not there 🙂

Link to comment
Share on other sites

2 minutes ago, TeamB said:

Trying to auto find similar blocks of audio across multiple episodes might work, however would need to test and see how this goes, the only problem I could see is where shows have a recap/primers at the beginning that does not change over a few episodes, small audio sections will be similar, that might play havoc with the similar area detection process.

The auto detection should already ignore sections deemed too short to be an intro, but without testing it’s impossible to say 100% that it won’t run into issues. Though, there is definitely tweaking that can be done to reduce false positives.

Link to comment
Share on other sites

40 minutes ago, samuelqwe said:

This could definitely work as an interim solution as you said, I just personally don’t want to modify the chapters on my files 😛

then you would need an edl type file to be created and read by emby - thats been asked for for a long time though so.........

  • Like 1
Link to comment
Share on other sites

33 minutes ago, PenkethBoy said:

then you would need an edl type file to be created and read by emby - thats been asked for for a long time though so.........

Please correct me if I'm wrong but afaik those edl files would "only" allow to skip commercials, so it would benefit a lot less users. 

From this in the other hand all users (LiveTV + "regular" show viewers) can benefit and that would put some more "pressure" on it.

Don't get me wrong I'm not saying skipping commercials isn't important, it definitely is as commercials are a waste of time IMHO but with potentially more users benefiting from this, it will probably go up in the prio list.

Link to comment
Share on other sites

no - not limited to commercials - its just a file with times in it - that a program can then use to skip a section of video

  • Thanks 1
Link to comment
Share on other sites

I was wondering if @TeamB you'd be interested in checking my work.

It is pretty much a function to function translation of @samuelqwe work,  into c#. Sorry to request this of you.

There is one line (mentioned in the post above) which I don't understand enough to translate properly. Line: 234

There is one cast to uint in the code which may or may not be okay. Line: 44

 

C# version on samuelqwe intro detection code:

https://github.com/chefbennyj1/IntroDetectionTesting/blob/master/ClassTesterConsole/IntroDetectionVersionTwo.cs

The translation gave me a run for my money. :)

also, I think I finally learned python (minimally) because of this little exercise. LOL!

Edited by chef
  • Like 1
Link to comment
Share on other sites

5 hours ago, chef said:

One more question, @TeamB @samuelqwe



    range(min(len(f1), len(f2))):
    	

can't quite understand. Is it the minimum entry between both arrays?

This was the last line that needed translating.

This line just means create a range from 0 to the length of the shortest array between f1 and f2

  • Thanks 1
Link to comment
Share on other sites

1 minute ago, samuelqwe said:

This line just means create a range from 0 to the length of the shortest array between f1 and f2

Thank you.

Python is Soo much less "wordy" then c#. 

Link to comment
Share on other sites

4 hours ago, chef said:

I was wondering if @TeamB you'd be interested in checking my work.

It is pretty much a function to function translation of @samuelqwe work,  into c#. Sorry to request this of you.

There is one line (mentioned in the post above) which I don't understand enough to translate properly. Line: 234

There is one cast to uint in the code which may or may not be okay. Line: 44

 

C# version on samuelqwe intro detection code:

https://github.com/chefbennyj1/IntroDetectionTesting/blob/master/ClassTesterConsole/IntroDetectionVersionTwo.cs

The translation gave me a run for my money. :)

also, I think I finally learned python (minimally) because of this little exercise. LOL!

On line 44, the score is supposed to be a float. It’s essentially a percentage, so a value between 1 and 0 that says how similar the two fingerprints are.


From what I can tell, most of it looks good. I haven’t looked line by line to compare, but it seems well done to me based on my knowledge of C#.

Great work!

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...