Jump to content

Plugin - Chapter Editor (ChapterApi)


TeamB

Recommended Posts

TeamB

I have put together a simple chapter viewer and editor plugin.

The plugin is now in the plugin catalogue.

As always here is the source:
https://github.com/faush01/ChapterApi/tree/main/ChapterApi

It is very simple and allows you to view chapters for a item (Movie, Season or Episode), remove chapters and add them. It supports all the different chapter marker types.

It also has a season Intro summary page, select a season to see if it has intros detected for each episode.

Note:
All chapters are wiped and reset when you do a metadata refresh on an item. If you spend any time setting up or editing your chapters keep this in mind. There is no current way of locking chapters.

Chapter List

image.png.7ae0f39f17886b5d26e9482b2085a47d.png

 

Season Intro summary

image.png.50fd5ff990d9449105225a80051203b8.png

 

Intro Detection (CTRL-F for Intros)

I have added a new way of detecting intros based on theme audio, this is using a very different approach than the core approach, it is using some of the ideas I posted over there:

https://emby.media/community/index.php?/topic/107878-audio-fringerprinting-chromaprint-segment-detection/

With this approach you need an the Into Chromaprint info, this is a simple audio fingerprint of the theme song/music/audio. The plugin looks for this and can create chapters based on the results of the search.

So where do you get the Chromaprint Intro info file, you can create one yourself for a series, season or episode by adding chapter info for one episode and then extracting that as a Chromaprint Info file. The new icons on the season summary page lets you extract the info file, if you just want to check you have the chapter offsets correct you can extract the audio of the chapter to play back and confirm it.

image.png.0b59ded84d5ec37f32eb2437c488aa00.png

A Chormaprint info file looks like this:

{
	"series":"Game of Thrones",
	"season":2,
	"tvdb":"121361",
	"imdb":"tt0944947",
	"tmdb":"1399",
	"duration":107,
	"extract":10,
	"cp_data":"ThXy/E4hsdxOIZDdziWA3c9lgNnd/YDI3NyAyNyYwMzcuFHc1L0V3dS1F1/E8xJexOISXsfyMl72UzZe5lM13uZlNN/m7FDddvyT3Hack9xWjJDdR52Q3USWkN0EkvHfFJJz3zT2d98s53ffJO1n/yR8Z/4lTCf+Hgwn/k40N/pOJHH63iBR+/4xUfnuEdP47hXDeH1XgXgcd4B4DP/AeAzf0FkM/VBZDO0QWTzkEFkt9BN7bdASet3RUnqP0UJaj9dFe57WRH2u/kR977pEf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A178EBFF37AD2E8"
}

Its just a JSON file with some info and the Chromaprint data. This can then be used in the Intro Detection tab to create a job against a series/season/episode list. Once complete you can import the job results into your items.

image.png.8119c9f7ada9f93d73f3f6e81c5bb2a4.png

This is a semi auto way of detecting chapters for series that are having issues, because you are supply a good well know chromaprint of the audio you want to target your results are much more predictable.

Sharing intro theme cp data

The sharded intro theme cp data is now hosted on github

https://github.com/faush01/ThemeCpData

To use the hosted data in the auto detection in the ChapterApi plugin you can use the following URL in the "Intro Data External Url" on the options tab of the plugin:

https://github.com/faush01/ThemeCpData/archive/refs/heads/main.zip

Add the url, hit download intro data, hit reload intro data and the intro cp data will be loaded for all the series you have that there are cp data in the shared repository.

If you want to add more the to the shared repo, clone it, add your new into cp json items and do a pull request to have you new items merged in and available to others.

 

 

 

 

Edited by TeamB
  • Like 15
  • Thanks 5
Link to comment
Share on other sites

TeamB

New version in first post with a cool Season level Intro summary

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

TeamB

@Luke it looks like there is no way of locking chapters to stop metadata refresh wiping all chapter info.

Can we get a lock chapters option?

  • Like 1
Link to comment
Share on other sites

GrimReaper

Very handy tool, @TeamB. Could you maybe add an option to automatically create chapters at 5 minute intervals for the whole lenght of the item (as opposed to adding one by one manually with Time/Add button) for movies that have single chapter marker embedded, like this one? 

 

Link to comment
Share on other sites

TeamB
43 minutes ago, GrimReaper said:

Very handy tool, @TeamB. Could you maybe add an option to automatically create chapters at 5 minute intervals for the whole lenght of the item (as opposed to adding one by one manually with Time/Add button) for movies that have single chapter marker embedded, like this one?

The problem at the moment is that any metadata refresh of an item will wipe all chapter changes, we really need to have some sort of way to retain manually edited chapters. Or at least be able to lock chapters from metadata refresh actions.

 

  • Thanks 1
Link to comment
Share on other sites

crusher11

I had a glitch with the IntroSkip plugin that resulted in this happening to a bunch of my episodes:

931035513_Screenshot2022-07-1700_49_50.thumb.png.893e7aceff17219c526fe1ee36dad36c.png

 

Is there an easy way to find which episodes have the glitch?

Link to comment
Share on other sites

TeamB
6 hours ago, crusher11 said:

I had a glitch with the IntroSkip plugin that resulted in this happening to a bunch of my episodes:

931035513_Screenshot2022-07-1700_49_50.thumb.png.893e7aceff17219c526fe1ee36dad36c.png

 

Is there an easy way to find which episodes have the glitch?

It looks like they are all IntroEnd chapter markers, I could make it so the season summary page shows you the first IntroEnd it finds and then it would be obviouse by looking season by season if an episode had a IntroEnd at 00:00:00 and no intro duration.

Link to comment
Share on other sites

TeamB

@crusher11

Latest version in the first post might help you identify episodes with weird markers. You can view a season and quickly check its Intro and Credits chapter markers.

Link to comment
Share on other sites

GrimReaper
22 hours ago, TeamB said:

The problem at the moment is that any metadata refresh of an item will wipe all chapter changes, we really need to have some sort of way to retain manually edited chapters. Or at least be able to lock chapters from metadata refresh actions.

 

Appreciate the info. Personally never do a metadata refresh within Emby as I curate my collection externally so that doesn't bother me at all. Think it would be useful to have an option to populate all chapters in one go as opposed to doing it one by one. Thanks. 

Link to comment
Share on other sites

TeamB
21 minutes ago, GrimReaper said:

Appreciate the info. Personally never do a metadata refresh within Emby as I curate my collection externally so that doesn't bother me at all. Think it would be useful to have an option to populate all chapters in one go as opposed to doing it one by one. Thanks. 

So would this be for items that did not have chapters at all? or to replace all chapters with a uniform chapter every x minutes?

I have noticed looking though my collection that a lot of movies and episodes have weird chapters, probably from the original file extracted at import time. Some have 1 chapter like end credits, others have 3 or 4 but at weird times. I agree some way of "fixing" this would be something useful.

My only concern is any changes will get nuked my a metadata refresh, you could spend some time on this and then accidentally wipe all your work by accidentally refreshing metadata on a series to say get the latest ratings etc.

I am not sure what the best option is here.

Link to comment
Share on other sites

GrimReaper
1 minute ago, TeamB said:

So would this be for items that did not have chapters at all? or to replace all chapters with a uniform chapter every x minutes?

Tbh, I was thinking about filling chapters for items that don't have any or have 1-2 weird ones. But now that you mention it, I'd maybe go with replacing those with uniform x-minutes ones as they can be spaced at really big timeframes, sometimes making them practically useless. 

3 minutes ago, TeamB said:

I have noticed looking though my collection that a lot of movies and episodes have weird chapters, probably from the original file extracted at import time. Some have 1 chapter like end credits, others have 3 or 4 but at weird times

Yup, observed same, those would be embedded chapters, if present Emby would read them as-is and not create generic 5-minutes ones. As said above, those are occasionally spaced really weirdly, sometimes logically within the story, other times completely illogically as per encoder's whim. In either case I'd still prefer uniform x-minute ones for faster navigation. 

Link to comment
Share on other sites

TeamB
35 minutes ago, GrimReaper said:

Yup, observed same, those would be embedded chapters, if present Emby would read them as-is and not create generic 5-minutes ones. As said above, those are occasionally spaced really weirdly, sometimes logically within the story, other times completely illogically as per encoder's whim. In either case I'd still prefer uniform x-minute ones for faster navigation. 

I though you could already do this this in the library setting thumbnail extraction ever x seconds (advanced library setting). But I just experimenting with that now it looks like this does NOT create new chapters but just creates thumbnails for use in the clients? But it did not show up in the Web Client so is this only for some clients?

I agree I think we will need some create automatic chapter points every x or some other logic sort of thing.

Link to comment
Share on other sites

GrimReaper
3 minutes ago, TeamB said:

I though you could already do this this in the library setting thumbnail extraction ever x seconds (advanced library setting).

Nope, that setting is only for selecting either 10-second bifs (for visual seeking) or 5-minute Chapter markers. 

4 minutes ago, TeamB said:

But I just experimenting with that now it looks like this does NOT create new chapters but just creates thumbnails for use in the clients?

If you refer to bifs, yes, they are only used in client apps during playback as visual aid, it does not create any new chapters. 

5 minutes ago, TeamB said:

I agree I think we will need some create automatic chapter points every x or some other logic sort of thing.

Yup, agree. 

  • Agree 1
Link to comment
Share on other sites

Junglejim

This looks cool! It would be good for media that have strange chapters. Most of my media that doesn't have embedded chapters get the default 5 min markers, which is all good.

Some though have weird chapters and this could fix that to some degree. As stated a refresh of meta would blow it away. But personally for movies that's fine with me, I don't usually refresh them.

TV Shows are different, not many have chapters (except anime) so most get the 5 min marker on my system.. :)

Looking forward to testing this out!

As @GrimReaper pointed out an automatic interval of chapter markers would be great. 👍

Edited by Junglejim
Link to comment
Share on other sites

Cheesegeezer

@TeamB great work fella, i actually was using this to diagnose my introEnd issues and it has proved very useful. 
 

thanks for sharing 

Link to comment
Share on other sites

crusher11

Is it possible to allow chapter types to be changed? A lot of my series' have a chapter point at the start of the end credits, it would be super helpful to be able to just change that rather than having to add another chapter there and then delete the existing one.

Link to comment
Share on other sites

TeamB

New version with Auto create chapters at X interval.

Also added multi select and delete.

14 hours ago, crusher11 said:

Is it possible to allow chapter types to be changed? A lot of my series' have a chapter point at the start of the end credits, it would be super helpful to be able to just change that rather than having to add another chapter there and then delete the existing one.

I will look into it.

  • Like 1
Link to comment
Share on other sites

crusher11

Additionally, timings in IntroSkip support thousandths of a second. Having to round things to a whole second can be awkward.

Link to comment
Share on other sites

TeamB
Just now, crusher11 said:

Additionally, timings in IntroSkip support thousandths of a second. Having to round things to a whole second can be awkward.

why awkward? sec not accurate enough?

I dont think most seeking playback is frame accurate anyway.

Link to comment
Share on other sites

TeamB

latest version has millisecond and a copy time action.

The copy time action just copies the time to the add form so you can create a new chapter at the same time with a different type, you will still need to delete the old chapter.

Link to comment
Share on other sites

rbjtech

Nice - thanks @TeamB - as a stand alone general chapter editor - this could be useful.

My understanding is that an editor is being created 'in the near future' for the Core Introskip feature - We cannot get any dates from Eric or Luke so read into that what you will ;) - but I'm raising FYI.

On the 'Saving' of edited data - yes we hit this one hard in the Plugin ourselves - and never got around to resolving it.

Options, I guess are -

a) Lock data in the chapter table in the emby dB 

b) Write modified (or all?) chapter info to NFO

c) Write info to source (MKV, MP4 etc)

d) write info to external chapter file - chapter.xml etc - also compatible with ffmpeg, mkvtoolnix etc

 

From the lessons learnt in the Introskip Plugin - the above saving of data is #1 on the list for a plugin like this - users spending lots of time curating chapters etc will, understandably, get rather peeved if they lose edits on a metadata refresh...

..and on that note -

@crusher11

The extra chapters issue in the Plugin has been resolved, I've had the fix for a few days now from @Cheesegeezer and it works great.

This needs a manual refresh of the item to put it back to it's original state before correctly adding the Introskip dB chapter points - so we are also working on a way to remove the superfluous entries without the need for a manual refresh as this in itself clearly involves a lot of work to 'find them'.  

Edited by rbjtech
Link to comment
Share on other sites

crusher11
1 hour ago, rbjtech said:

..and on that note -

@crusher11

The extra chapters issue in the Plugin has been resolved, I've had the fix for a few days now from @Cheesegeezer and it works great.

This needs a manual refresh of the item to put it back to it's original state before correctly adding the Introskip dB chapter points - so we are also working on a way to remove the superfluous entries without the need for a manual refresh as this in itself clearly involves a lot of work to 'find them'.  

Yes, I have that update as well, that's why I'm trying to find the problem episodes. However, the update seems to have broken the import functionality nearly completely, as I cannot import the intro/end credit points back into most those episodes.

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...