Jump to content

Extract embedded subs to srt when looking for subtitles


Alefielm
 Share

Recommended Posts

Alefielm

Hi, I currently the extract for this type of subtitles is done on the fly, while this is happening we are unable to control the video (for example pause until the subtitle is fully extracted), at least on Chromecast.
What do I do now? go to the mkv file, execute mkvinfo, and then mkvextract, I end up with an srt file that loads instantaneously.
It would be nice to have this extraction done when looking for subtitles, It would smooth the UX a lot when watching this kind of file.
Thanks!!!

 

  • Like 1
Link to comment
Share on other sites

Hi, yes it's possible for the future, but at the same time, we're also exploring better techniques that don't require the up-front process. Thanks.

Link to comment
Share on other sites

Alefielm
25 minutes ago, Luke said:

Hi, yes it's possible for the future, but at the same time, we're also exploring better techniques that don't require the up-front process. Thanks.

Another solution may be, as a patch, that the video don't start until the subtitle is extracted, so all CPU usage/disk are dedicated to this.

Or, the posibility to pause the video while extracting on the fly.

Thanks!

Link to comment
Share on other sites

rbjtech

As part of file pre-processing, it's always better to extract the subs upfront anyway - as text based SRT subs are always more compatible that PGS and in some clients will make the difference between a transcode and direct play.

Link to comment
Share on other sites

  • 3 weeks later...
LordMike

I wanted to make a FR for transcoding subtitles from whatever embedded image format they're in, into the format my TV (Samsung Tizen) can consume.. Does this mean this already happens - and I should just be patient?

Link to comment
Share on other sites

rbjtech
1 hour ago, LordMike said:

I wanted to make a FR for transcoding subtitles from whatever embedded image format they're in, into the format my TV (Samsung Tizen) can consume.. Does this mean this already happens - and I should just be patient?

This already happens where possible.  If they are SRT/TXT based and embedded (a stream in the MP4/MKV), then in the transcode settings ensure '"Allow subtitle extraction on the fly" is enabled but read the warning.

Graphical subtitles can never be extracted on the fly, as this would need OCR - so they are simply burnt in during the forced transcode.

The absolute best way to ensure no transcoding with subtitles (ie Direct Play), is to external SRT based subtitles - either got from external sources, or extracted using dedicated OCR applications such as Subtitle Edit and then saved as external SRT.

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

Changes to subtitle processing are coming up shortly. For the curious, it might be interesting to look at my recent contributions to ffmpeg. Though, not all of them may land as Emby features immediately.

  • Like 2
Link to comment
Share on other sites

In the meantime I wrote a script for exactly this purpose. If you're using Linux give it a try:
https://github.com/Nebarik/mediscripts-shared/blob/main/asub-extractor-v2.sh

What it does it go through your files and if a external subtitle file doesn't exist it extracts out a .ass and .srt (same file just different extension that chromecast prefers).
Then updates the video file by removing the default flag allowing the external file to be the default. This causes a replacement file and can take a little while, so ive got it to check if its already done it yet and it only does if its currently default. 

To run it, either run it inside the folder you keep all your files. Or specify a folder. It'll go through all subfolders. eg:

cd /Anime/Naruto
./asub-extractor-v2.sh
or
./asub-extractor-v2.sh /Anime/Naruto/




 

  • Like 1
Link to comment
Share on other sites

rodainas
14 hours ago, Nebarik said:

Then updates the video file by removing the default flag allowing the external file to be the default.

You can add to the extracted subtitle a default tag on the filename, eg. Extractedsubtitle.lang.default.srt. 

Emby will use this one as default over any embedded default one, provided that language is selected  on the client subtitles settings I do this all the time and works like a charm.

I saw you have the tag on the script, so it should work without editing the original file properties.

Edited by rodainas
Append
Link to comment
Share on other sites

Ah I didn't know Emby did that anyway.

Regardless, if you don't remove the flag, under subtitle selection while watching something the embedded subs still say "default" alongside the external "default". Can be a bit confusing to users.

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