Jump to content

Show Intro Skip Option


Liquidfire88

Recommended Posts

samuelqwe
11 minutes ago, Happy2Play said:

Does not look like it is enabled in Emby ffmpeg (at least in Windows) in ffmpeg 4.3 or 4.4.

Emby vs downloaded ffmpeg

image.thumb.png.a99e8c23cd38aff3428dccfccddd184c.png

That would definitely be problematic in this case...

@chef you could always build a custom version of FFmpeg (or you can likely find a precompiled one) that does have chromaprint, if you want to keep working on this in the meantime.

https://github.com/acoustid/ffmpeg-build/releases or https://www.gyan.dev/ffmpeg/builds/ might work to be able to test.

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

rbjtech

or you can specify a different version of ffmpeg in Advanced Transcoding via the Diagnostics plugin (for testing) ?

ffmpeg.thumb.PNG.e20139271963d49c25824c1dca5d037b.PNG

  • Like 1
Link to comment
Share on other sites

chef
6 hours ago, rbjtech said:

or you can specify a different version of ffmpeg in Advanced Transcoding via the Diagnostics plugin (for testing) ?

ffmpeg.thumb.PNG.e20139271963d49c25824c1dca5d037b.PNG

Thanks man, I've never seen that before 😳😬

Link to comment
Share on other sites

chef

@samuelqwe I was able to acquire a version of ffmpeg which handles chromaprint so I can continue writing this thing.

But, when I open the .bin file, there is a lot of encoded data inside, where I thought we would see an Array of finger print data.

Is this expected? Is that what you see as well?

 

 

Edited by chef
Link to comment
Share on other sites

Micael456
14 minutes ago, chef said:

@samuelqwe I was able to acquire a version of ffmpeg which handles chromaprint so I can continue writing this thing.

But, when I open the .bin file, there is a lot of encoded data inside, where I thought we would see an Array of finger print data.

Is this expected? Is that what you see as well?

 

 

Bin compresses it, could be that. Have you tried raw instead?

  • Thanks 1
Link to comment
Share on other sites

samuelqwe
22 minutes ago, chef said:

@samuelqwe I was able to acquire a version of ffmpeg which handles chromaprint so I can continue writing this thing.

But, when I open the .bin file, there is a lot of encoded data inside, where I thought we would see an Array of finger print data.

Is this expected? Is that what you see as well?

 

 

@chef
 

Yes, this is normal. The file contains raw binary data, so just ones and zeros but text editors don’t know that so they try to read it as text. That means that you have to convert each 4 bytes of that binary data to integers yourself.

I’m sure there are built-in methods to do this in C#, but I am not super familiar with the language so I can’t tell you exactly how that would work. It shouldn’t be that difficult to accomplish though. It takes about 4 lines of code in Python to accomplish.

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

chef
53 minutes ago, samuelqwe said:

@chef
 

Yes, this is normal. The file contains raw binary data, so just ones and zeros but text editors don’t know that so they try to read it as text. That means that you have to convert each 4 bytes of that binary data to integers yourself.

I’m sure there are built-in methods to do this in C#, but I am not super familiar with the language so I can’t tell you exactly how that would work. It shouldn’t be that difficult to accomplish though. It takes about 4 lines of code in Python to accomplish.

LOL! okay, I'll have to take a look. I think C# has a BinaryReader (hopefull it is used in .netcore... probabaly is).

I haven't used it before, so off to Stackoverflow I go! 😆

Link to comment
Share on other sites

samuelqwe
8 minutes ago, chef said:

Oh boy, that's advanced! but I understand.

Here it is in Python, in case it might be helpful:

fingerprintArray = [] # Create empty fingerprint array
with open("FILENAME.bin", "rb") as f: # Open .bin file in binary reading mode
    while (byte := f.read(4)): # Read 4 bytes at a time, until the end of the file
        fingerprintArray.append(int.from_bytes(byte, byteorder='little', signed=False)) # Convert from binary to int and add to fingerprint array

 

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

chef

Perhaps there is ac# dev who wants to chime in here.

I can use FileStream to calculate the Byte Array, and get it into chunks, but I think you'll agree that my attempt to add the byte data to the List<uint> feels weird!

There must be an AddRange solution to this that I am not seeing right away, without taking four bytes, and moving back through them... Yikes!

private List<uint> SplitByteData(string bin)
        {
            var fingerprint = new List<uint>();
            using(var fileStream = new FileStream(bin, FileMode.Open))
            {
                var fingerprintLength = (uint)fileStream.Length; //The entire size of the filestream
                var bits = new byte[fingerprintLength]; //Fingerprints added to a  new byte Array
                for (int position = 0; position < fingerprintLength; position += 4) //move through byteArray take every 4 bytes
                {
                     //This feels strange to do here!
                    fingerprint.Add(bits[position - 4]);
                    fingerprint.Add(bits[position - 3]);
                    fingerprint.Add(bits[position - 2]);
                    fingerprint.Add(bits[position - 1]);
                }
            } 
            
            return fingerprint;
        }

 

Link to comment
Share on other sites

samuelqwe
1 hour ago, chef said:

Perhaps there is ac# dev who wants to chime in here.

I can use FileStream to calculate the Byte Array, and get it into chunks, but I think you'll agree that my attempt to add the byte data to the List<uint> feels weird!

There must be an AddRange solution to this that I am not seeing right away, without taking four bytes, and moving back through them... Yikes!


private List<uint> SplitByteData(string bin)
        {
            var fingerprint = new List<uint>();
            using(var fileStream = new FileStream(bin, FileMode.Open))
            {
                var fingerprintLength = (uint)fileStream.Length; //The entire size of the filestream
                var bits = new byte[fingerprintLength]; //Fingerprints added to a  new byte Array
                for (int position = 0; position < fingerprintLength; position += 4) //move through byteArray take every 4 bytes
                {
                     //This feels strange to do here!
                    fingerprint.Add(bits[position - 4]);
                    fingerprint.Add(bits[position - 3]);
                    fingerprint.Add(bits[position - 2]);
                    fingerprint.Add(bits[position - 1]);
                }
            } 
            
            return fingerprint;
        }

 

@chef

I figured there had to be a more efficient way to do it and I had a bit of time, so I created a simple C# project in Visual Studio and tried messing around with that. I don't know C# very well, but I can somewhat understand it. So after a bit of googling and trying various solutions, I came up with this:

var fingerprint = new List<uint>();
using (BinaryReader b = new BinaryReader(File.Open("FILENAME.bin", FileMode.Open)))
{
  int length = (int)b.BaseStream.Length / sizeof(uint);
  for (int i = 0; i < length; i++)
  {
    fingerprint.Add(b.ReadUInt32());
  }
}

Seems simple enough and gives the expected result. Also, the fingerprint is already in an unsigned int array/list, so no need for an intermediary byte array/list. Just don't know if this solution would work in .NET Core or not.

  • Like 1
Link to comment
Share on other sites

intro.thumb.png.f2409bfc1290d7caa54951bd619edccf.png

it looks good and think it works for me! But than i play en Episode i don't see any option to skip the Intro! Is that so? Or something missing?

 

greetz

Link to comment
Share on other sites

samuelqwe
1 minute ago, G_P said:

intro.thumb.png.f2409bfc1290d7caa54951bd619edccf.png

it looks good and think it works for me! But than i play en Episode i don't see any option to skip the Intro! Is that so? Or something missing?

 

greetz

This is a proof of concept plugin, there is currently no skipping functionality. We are hoping to get there at some point.

  • Like 1
Link to comment
Share on other sites

chef
1 hour ago, samuelqwe said:

@chef

I figured there had to be a more efficient way to do it and I had a bit of time, so I created a simple C# project in Visual Studio and tried messing around with that. I don't know C# very well, but I can somewhat understand it. So after a bit of googling and trying various solutions, I came up with this:


var fingerprint = new List<uint>();
using (BinaryReader b = new BinaryReader(File.Open("FILENAME.bin", FileMode.Open)))
{
  int length = (int)b.BaseStream.Length / sizeof(uint);
  for (int i = 0; i < length; i++)
  {
    fingerprint.Add(b.ReadUInt32());
  }
}

Seems simple enough and gives the expected result. Also, the fingerprint is already in an unsigned int array/list, so no need for an intermediary byte array/list. Just don't know if this solution would work in .NET Core or not.

👍 Yup that's the ticket! I'll get it saving to the database next. Nice!

Link to comment
Share on other sites

chef

The good news: 

We can create and manage a data base.

Each entry of the db is marked by the internalId of the item for fast lookup.

It also contains:

1. The fingerprint data,

2. SeriesId,

3.SeasonId

4. The duration of the fingerprint (because they all have to match)

5. Start and End Times of the title sequence.

 

The Fingerprinting scheduled task will set up the entry, but leave the Start and End times at 0.

When the second task (Detect Title Sequences) is run, we'll be able to  grab the fingerprints for each entry of the database (based on season), calculate the sequence, and fill in the missing start and end times.

 

The sad news:

Emby on windows will not currently support chromaprinting using ffmpeg. 

But when it does (patiently waiting...😐) we'll be ready.

 

Link to comment
Share on other sites

samuelqwe
1 minute ago, chef said:

Emby on windows will not currently support chromaprinting using ffmpeg. 

@Luke @softworkz

It appears that some platforms have Chromaprint within their FFmpeg builds and others don’t.

Anything that can be done here so that all platforms have Chromaprint?

Link to comment
Share on other sites

25 minutes ago, samuelqwe said:

@Luke @softworkz

It appears that some platforms have Chromaprint within their FFmpeg builds and others don’t.

Anything that can be done here so that all platforms have Chromaprint?

Yes we need to look at the platforms that are missing it. Thanks.

  • Thanks 5
Link to comment
Share on other sites

Sammy

Just for reference. As expected, the title sequence for Friends is a bit more than a 30 second skip...

image.thumb.png.ef27d672e6524d61e6b6b2bf39ddf7bd.png

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

Sammy
2 hours ago, chef said:

The good news: 

We can create and manage a data base.

Each entry of the db is marked by the internalId of the item for fast lookup.

It also contains:

1. The fingerprint data,

2. SeriesId,

3.SeasonId

4. The duration of the fingerprint (because they all have to match)

5. Start and End Times of the title sequence.

 

The Fingerprinting scheduled task will set up the entry, but leave the Start and End times at 0.

When the second task (Detect Title Sequences) is run, we'll be able to  grab the fingerprints for each entry of the database (based on season), calculate the sequence, and fill in the missing start and end times.

 

The sad news:

Emby on windows will not currently support chromaprinting using ffmpeg. 

But when it does (patiently waiting...😐) we'll be ready.

 

@chef Is a new plugin ready to test?

Link to comment
Share on other sites

chef
29 minutes ago, Sammy said:

@chef Is a new plugin ready to test?

😅  I had better make sure the database is working. Probably get this working very soon.

I should forewarn, we'll be swapping ffmpeg on windows machines when we try it out.

  • Thanks 1
Link to comment
Share on other sites

chef
46 minutes ago, Sammy said:

Is there a detrimental effect to "normal" use?

Not sure. Most likely not, but I have a second server setup so I'll try it out. Wouldn't want to mess up movie night.

  • Like 1
Link to comment
Share on other sites

chef

yeah, database can be hard. But, after many hours auditing the thing, it seems to be okay. Just have to properly edit the table row with title sequence data next.

Did you know that a database will sometimes maintain it's file size even if its empty?  I know right?!?  😆

introskipdb3.thumb.png.615dc9fb5337f199df3a9066be0eb64f.png

Also have to check print duration of each episode prior to running the task. If the user changes this, we'll have reprint the entire season. Probably should put that as a warning in the UI somewhere.

 

Also, how big should the database be? Really big? Oh good! Because it will be. 😶

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

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