Jump to content

Show Intro Skip Option (Plugin)


Liquidfire88

Recommended Posts

Dibbes

@chefjust a thought and you know by now I'm not a programmer, so if I'm not making any sense, just tell me to shut up.

Anyway, I was thinking: Intros for the same series all have the same (or at least very similar) video information. Is there not a way that an admin can set it once for an episode, that the server checks this for the rest of the series and puts in chapter markers for the rest of the episodes? Yes, there is a manual component here, but it feels it's going to be more accurate than  what I read earlier... 

Link to comment
Share on other sites

@chef The work apps would have to do to support it would not be difficult. An overlay showing "Skip Intro?" with a button [ OK ] [ NO ] . Once you click OK in the app and it knows you did once it never asks again and skips the intro on them all ever after. As long as all have the same intro length which most of a series do. A few special episodes will differ though. But for the majority it would skip the intro correctly on episodes and the apps would only have to ask once and then do that same thing on subsequent episodes during playback. It is no more difficult than Up Next at the end of a show during credits to ask if the user wants to play the next immediately or sit through the credits. This would be the opposite of that. To skip that intro (rather than the credit outro). Emby needs this. That is the point I am getting to. :)

Edited by speechles
  • Like 2
Link to comment
Share on other sites

PenkethBoy

also i would assume that a large proportion of peoples libraries are not recorded TV - for the vast majority

so dont think commercials are that big a problem as you have comskip for that

so you might for livetv - have to do two processes one to find the commercials (not 100% either) then look for the intro - or vice versa

again the fingerprint method would be a better solution i suspect in the long run

  • Like 3
Link to comment
Share on other sites

samuelqwe

I think that the best way to start with this feature would be to add the skip intro button in the client apps, and read the intro markers from an NFO or XML file.

From there, people can either:
1. Add the data manually
2. Use a tool to automate the generation of the intro markers
3. Not use the feature at all

At least by adding the button in the clients you support the feature and then it’s up to server admin to figure out how, or if, they wish add the intro markers. In that way, the server admin is responsible for the accuracy of these markers, and the community can develop and improve utilities that can generate these markers automatically. Then, in the future, the Emby team can create a built-in solution to generate the markers, if an accurate enough solution exists.

This was just me thinking out loud, but I really think something like this could be viable.

Edited by samuelqwe
Link to comment
Share on other sites

4 minutes ago, samuelqwe said:

I think that the best way to start with this feature would be to add the skip intro button in the client apps,

As I mentioned before, without an accurate method of identifying the exact start of the intro, this would not be a good approach.

  • Like 3
Link to comment
Share on other sites

Dibbes
1 hour ago, Dibbes said:

@chefjust a thought and you know by now I'm not a programmer, so if I'm not making any sense, just tell me to shut up.

Anyway, I was thinking: Intros for the same series all have the same (or at least very similar) video information. Is there not a way that an admin can set it once for an episode, that the server checks this for the rest of the series and puts in chapter markers for the rest of the episodes? Yes, there is a manual component here, but it feels it's going to be more accurate than  what I read earlier... 

 

22 minutes ago, PenkethBoy said:

again the fingerprint method would be a better solution i suspect in the long run

Yes, that's what I meant, I guess... but then with a manual control part of it...

  • Like 1
Link to comment
Share on other sites

samuelqwe
17 minutes ago, ebr said:

As I mentioned before, without an accurate method of identifying the exact start of the intro, this would not be a good approach.

But as I also mentioned in my post, the data would have to be either put in manually or created by a tool at the discretion of the server admin. If no intro markers (that means both intro start and end markers, not just one or the other) are present in the NFO or XML file, don’t show the button.

I am fully aware that automated solutions like the ones discussed in this topic may not have perfect accuracy, but it would be up to the server admin to choose whether or not to use them.

The server admin would be completely responsible for the accuracy of the data, and is not required to make use of this feature at all.

Link to comment
Share on other sites

37 minutes ago, samuelqwe said:

But as I also mentioned in my post, the data would have to be either put in manually or created by a tool at the discretion of the server admin. If no intro markers (that means both intro start and end markers, not just one or the other) are present in the NFO or XML file, don’t show the button.

I am fully aware that automated solutions like the ones discussed in this topic may not have perfect accuracy, but it would be up to the server admin to choose whether or not to use them.

The server admin would be completely responsible for the accuracy of the data, and is not required to make use of this feature at all.

If a manual process by the user is required then it would not be a good application of developer resources to put this functionality into all the apps because the number of people who would be able to take advantage of it would just be too small.

  • Like 1
Link to comment
Share on other sites

samuelqwe
12 minutes ago, ebr said:

If a manual process by the user is required then it would not be a good application of developer resources to put this functionality into all the apps because the number of people who would be able to take advantage of it would just be too small.

I hadn’t thought of that, but it makes sense to prioritize features that would benefit the most amount of users.

Well, there’s always hope for this feature in the future when a better solution is found.

  • Like 1
Link to comment
Share on other sites

Dibbes
18 minutes ago, ebr said:

If a manual process by the user is required then it would not be a good application of developer resources to put this functionality into all the apps because the number of people who would be able to take advantage of it would just be too small.

That's true, but isn't really how I envisioned it though. The manual process is up to the administrator. The users only gets the skip option in the player, a little like Amazon Prime does it, I suppose...

Link to comment
Share on other sites

Well, over all it was pretty cool learning how some features of ffmpeg work.

It'll only readout over command line on the error output.

It has the ability to scan video files for parts that have no image or sound.

Pretty cool stuff. This means that Emby not only has a huge API, but it also has a whole bunch of untapped abilities, that I'm sure we'll see in the future. 

 

Very cool stuff. 👍

  • Like 6
Link to comment
Share on other sites

Probably would want to pass the integer array over a couple of different episodes just to make sure it was right. That would create longer scan times. 

Link to comment
Share on other sites

3 hours ago, dotcom said:

That’s what I did in my python script I posted before. It’s probably not as good as the dark and silence detection method. 

it's actually a better way. 

Link to comment
Share on other sites

10 minutes ago, chef said:

@dotcom are you using a chromaprint flag with ffmpeg?

I can't seem to get that particular flag to work with embys version of ffmpeg.

I actually didn't know there was an ffmpeg flag for that, I'm using chromaprint separately which would be less efficient. You can see in the top of the file I say what needs to be installed, that includes fpcalc. I was piping it to fpcalc in my calculate functions, if it's in the binary then that wouldn't be necessary and would save some time. In the example I gave I put a clip I did myself but it would be trivial to create another function that gave it a start and length to get the fingerprint from a video file. What I made was clunky and a first pass from some info I cobbled together but could be refined to be more accurate.

I imagined a menu option that asked for a start point and an end point of an episode and then a "apply skip to series/season" and it be done. Though I'm completely ignorant of how emby's code works and the best way to do this.

  • Thanks 1
Link to comment
Share on other sites

Just now, dotcom said:

I actually didn't know there was an ffmpeg flag for that, I'm using chromaprint separately which would be less efficient. You can see in the top of the file I say what needs to be installed, that includes fpcalc. I was piping it to fpcalc in my calculate functions, if it's in the binary then that wouldn't be necessary and would save some time. In the example I gave I put a clip I did myself but it would be trivial to create another function that gave it a start and length to get the fingerprint from a video file. What I made was clunky and a first pass from some info I cobbled together but could be refined to be more accurate.

I imagined a menu option that asked for a start point and an end point of an episode and then a "apply skip to series/season" and it be done. Though I'm completely ignorant of how emby's code works and the best way to do this.

yes I have found fpcalc, there doesn't seem to be a whole lot of documentation... I found some.

In the article posted above, the writer mentions that a chromaprint can be outputted like an array of numbers:

[15, 20, 9, 13, 12, 10, 6, 7, 3, 2, 2, 1, 0, 3, 2, 1, 9, 13, 12, 14.....]

 

Do you think it is possible to loop over, two or three, 180 second clips of video files (episodes), get the chromaprint in an array, then compare the arrays for commonalities (which would be our intros)?

If it was possible, do you believe we could map that information back to the main stream and pinpoint a time stamp where the intro started and stopped?

 

Link to comment
Share on other sites

5 minutes ago, chef said:

yes I have found fpcalc, there doesn't seem to be a whole lot of documentation... I found some.

In the article posted above, the writer mentions that a chromaprint can be outputted like an array of numbers:


[15, 20, 9, 13, 12, 10, 6, 7, 3, 2, 2, 1, 0, 3, 2, 1, 9, 13, 12, 14.....]

 

Do you think it is possible to loop over, two or three, 180 second clips of video files (episodes), get the chromaprint in an array, then compare the arrays for commonalities (which would be our intros)?

If it was possible, do you believe we could map that information back to the main stream and pinpoint a time stamp where the intro started and stopped?

 

I sure do, that's what piping to fpcalc does, it gives us back an array of numbers like that we then do comparisons on. They aren't direct comparisons. The way I did it is it takes a sound bite of any length and then returns the beginning of that intro start. You can try my example with the mp3 as the argument against any episode of the office and it has a decently high accuracy down to the sub second. Some episodes are miscalculated but that's just a dialing in thing. I get outputs something like this when I loop my script through office episodes:

image.thumb.png.526939baca8cb2a7c5746101902adcaa.png

  • Like 1
Link to comment
Share on other sites

Well, that's magical... Automagical even 👍

We would have to figure out if the intro can be located without an mp3 theme song available, but, this is how you pull if intro skip.  Pretty cool.

 

Link to comment
Share on other sites

Yeah, you can easily get the thumbprint directly from a video but that doesn't show my example well since it would be different on each episode.

You can pipe a timestamp of a video through fpcalc or maybe with an ffmpeg flag if there is one and get the output instead of using an mp3 input. I'd be happy to collaborate to figure this out if you have the time. The way I do it is naive and would take some fiddling to make 100%. Also we would probably only need about 5-10 seconds of intro. (meaning only a start time and we figure out the rest programattically)

The issue with recaps would have to be silence detection though. AND we could have a database where users could map these for everyone else if detection missed on an episode ending up with a comprehensive way for all users to reliably have skips where they want/need.

Link to comment
Share on other sites

1 hour ago, dotcom said:

Yeah, you can easily get the thumbprint directly from a video but that doesn't show my example well since it would be different on each episode.

You can pipe a timestamp of a video through fpcalc or maybe with an ffmpeg flag if there is one and get the output instead of using an mp3 input. I'd be happy to collaborate to figure this out if you have the time. The way I do it is naive and would take some fiddling to make 100%. Also we would probably only need about 5-10 seconds of intro. (meaning only a start time and we figure out the rest programattically)

The issue with recaps would have to be silence detection though. AND we could have a database where users could map these for everyone else if detection missed on an episode ending up with a comprehensive way for all users to reliably have skips where they want/need.

absolutely!

 

 I think I have figured some things out here to share, this is c#

 

1. Get a 5 minute clip from a video file, and strip out the audio:

ProcessStartInfo(ffmpegPath,$"-t 00:05:00 -i \"{input}\" -c:a alac -c:v copy output.m4a")

 

2. Convert to wav

ProcessStartInfo(ffmpegPath,$"-i output.m4a output.wav")

 

 

3.

ProcessStartInfo(fpcalc,$"output.wav -json")

which will ouput the finger print in JSON format to be consumed by EMby's JsonSerializer Interfaces

 this is exciting.

 

Edited by chef
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...