Jump to content

Automatically extract embedded subtitles alongside video files?


kevinmd88
 Share

Go to solution Solved by GrimReaper,

Recommended Posts

kevinmd88

Just wanted to know if Emby has this capability. A lot of my videos have subtitles embedded in the file, SRT and ASS are common. During library scans, can Emby server be configured to automatically extract the subtitles from these files and store them alongside the videos, following the expected naming conventions Emby uses?

Just as an example case, if I have the following video

Movies
|-Movie (2000)
  |-Movie.mkv

and Movie.mkv contains embedded subtitles for the English language, metadata flagged as "forced", the following file would be produced

Movies
|-Movie (2000)
  |-Movie.mkv
  |-Movie.eng.forced.srt

 

(note: I'm aware Emby is capable of handling embedded subtitles in playback, I just want to know if they can be extracted as part of the library)

Edited by kevinmd88
Link to comment
Share on other sites

  • Solution
GrimReaper
24 minutes ago, kevinmd88 said:

During library scans, can Emby server be configured to automatically extract the subtitles from these files and store them alongside the videos, following the expected naming conventions Emby uses?

Nope. Lend your support here:

Also, some tools available in Tools and Utilities forum section:

 

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

rbjtech

This subtitle extraction/cleanup functionality is exactly what has been recently added to the MediaInfo plugin.

The Plugin is in the catalogue - but I don't believe the subtitle bit has been fully added yet to this version as it's still in testing.

@Cheesegeezer@FrostByte

Maybe we can add you to the testing team but please be aware this should not be tested on your main library ! ;)

image.png.dbb840212e83a1e5e4309e13f8991282.png

 

This is the function branded as 'SubKiller' - it removes all the unwanted embedded subs and extracts all text based subs as external SRT's.  I believe there is some discussion on having the option to removing all the embedded subs altogether (once they have been extracted) but we need to understand the logic on how emby chooses which subs to use.  I believe it will use the external first - in which case, I see no reason to remove the embedded ones.

 

image.png.b58807f05dee73e03828d8da0bd17ada.png

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

rodainas
33 minutes ago, rbjtech said:

but we need to understand the logic on how emby chooses which subs to use.  I believe it will use the external first

That’s correct, that’s what I do, no need for me to remove the internals.

To ensure it chooses the external first is better to use default tag in external filename, just in case some internal is already set as default, this works perfectly with smart and always modes. But in the case of “Default” mode if there is a default (no forced) external and a default forced internal it chooses the internal. I  haven’t tested default forced  external vs default forced internal in default  mode to confirm priority.

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

Cheesegeezer
36 minutes ago, rodainas said:

That’s correct, that’s what I do, no need for me to remove the internals.

To ensure it chooses the external first is better to use default tag in external filename, just in case some internal is already set as default, this works perfectly with smart and always modes. But in the case of “Default” mode if there is a default (no forced) external and a default forced internal it chooses the internal. I  haven’t tested default forced  external vs default forced internal in default  mode to confirm priority.

@rbjtech i think these would be a great candidates to join in our testing.

rodainas and @kevinmd88 would you be up for it. Its in the final phases of testing and i would value you input along with @FrostByte

we just need to tweak the outputs now.

Link to comment
Share on other sites

pwhodges
5 hours ago, rbjtech said:

This is the function branded as 'SubKiller' - it removes all the unwanted embedded subs and extracts all text based subs as external SRT's. 

So any SSA/ASS subs will have styles and positioning removed, I guess - making it useless for general anime.

Paul

Link to comment
Share on other sites

rbjtech
12 minutes ago, pwhodges said:

So any SSA/ASS subs will have styles and positioning removed, I guess - making it useless for general anime.

Paul

I don't believe so - the formatting for SSA/ASS (and SRT for that matter) is just held in the external text file instead.

ffmpeg just copies it as is - but we need to check this.

  • Agree 1
Link to comment
Share on other sites

rodainas
26 minutes ago, rbjtech said:

I don't believe so - the formatting for SSA/ASS (and SRT for that matter) is just held in the external text file instead.

ffmpeg just copies it as is - but we need to check this.

That’s correct ffmpeg extract them as it is with all the formatting, I use a script with ffmpeg for extracting every type (ass, srt, vobsub, pgs, vtt, txt, etc.)

 

4 hours ago, Cheesegeezer said:

rodainas and @kevinmd88 would you be up for it.

Sure I can test it against some of my files to experiment.

  • Like 1
Link to comment
Share on other sites

pwhodges
35 minutes ago, rodainas said:

That’s correct ffmpeg extract them as it is with all the formatting, I use a script with ffmpeg for extracting every type (ass, srt, vobsub, pgs, vtt, txt, etc.)

But what about fonts?  Some of the styling may be meaningless without.

Paul

  • Like 1
Link to comment
Share on other sites

rbjtech
4 minutes ago, pwhodges said:

But what about fonts?  Some of the styling may be meaningless without.

Paul

Fonts is a good call. 

I have very limited experience with using fonts - I'm assuming ffmpeg could extract it, but not sure if externally Emby is setup to use it if specified in the external sub file ?

Do fonts works 'today' with emby if embedded in the source file ? - if yes, then we could just recreate this step before hand.  Not sure where the font file would be held though.

The whole reasoning behind this is to reduce the possibility of transcoding/streaming - so unless the end result is direct play - we have not gained anything by doing this.

Link to comment
Share on other sites

rodainas
21 minutes ago, pwhodges said:

But what about fonts?  Some of the styling may be meaningless without.

Paul

Sure I have extracted the subs for my entire Anime library, fonts the same, what I have noticed with the extracted ass files is that the extracted one is shown with tinier fonts than the internal one in emby android tv, not sure other clients, need testing to compare that.

  • Like 1
Link to comment
Share on other sites

pwhodges
1 hour ago, rbjtech said:

Do fonts works 'today' with emby if embedded in the source file ? - if yes, then we could just recreate this step before hand.  Not sure where the font file would be held though.

Sure they do.  I've just been helping softworkz debug a case in which a particular font triggered a crash in Emby's ffmpeg.

To the best of my knowledge, if fonts are not embedded, they need to be installed in the system - and that would therefore be required for external ASS files.  It's also fair to say that a considerable proportion of ASS files don't use sophisticated styling, and work well enough with default fonts.

Paul

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

pwhodges
2 hours ago, rodainas said:

what I have noticed with the extracted ass files is that the extracted one is shown with tinier fonts than the internal one in emby android tv, not sure other clients, need testing to compare that.

ASS files contain a statement of the video size they are intended for.  Sometimes (especially if they've been taken from an SD original and transferred to a BD rip without the correct adjustment) this is incorrect, and maybe font sizes were adjusted instead of correcting the video size.  This can give rise to unexpected results in some circumstances.

Paul

  • Like 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
 Share

×
×
  • Create New...