Plex and Subtitles

I’ve spent far too much time ripping all my Blu-Rays to make sure they’ve got the full compliment of English audio and subtitle tracks. However, that might have been the wrong way of doing things. I mean, I don’t really care all that much about commentary tracks at all, I just wanted them there for the sake of completeness.

Now, the other day we were watching The Mummy, the rather excellent film with Brendan Fraser and Rachel Weisz and I was getting rather irritated because the subtitles I was expecting to see simply weren’t there. I’m pretty sure there were there before I started my “big rip” programme but they’re not there now. Well, that’s just annoying.

I started to cycle through the various subtitle tracks and not one of them was just the forced subtitles. It was everything or nothing. That was rather irritating too.

I re-ripped the disc looking for a subtitle track I might have missed but, alas, no. I’d got them all. I tried ripping just the tracks listed as “forced” but, if I took just those, then no subtitles were present in the final mkv. Selecting the subtitle track before the forced track gave me everything.

Also, The Mummy contains TextST tracks which, when ripped, completely break IINA for some reason. It turns out that The Mummy simply doesn’t have any forced subtitles at all. The Mummy Returns does, they’re easy to find, but not The Mummy.

On the MakeMKV forums I found a nice little snippet of helpful code:

mkvmerge -i <MKV File>
mkvextract tracks <MKV File> <track>:<export subtitle>

So, for The Mummy the first part looks like this:

mkvmerge -i The\ Mummy\ \(1999\).mkv 
File 'The Mummy (1999).mkv': container: Matroska
Track ID 0: video (VC-1)
Track ID 1: audio (DTS-HD Master Audio)
Track ID 2: audio (DTS)
Track ID 3: audio (AC-3)
Track ID 4: audio (AC-3)
Track ID 5: audio (AC-3)
Track ID 6: subtitles (HDMV PGS)
Track ID 7: subtitles (HDMV PGS)
Chapters: 18 entries

This shows that tracks 6 and 7 are the subtitle tracks. Now, at this point we could play the video in IINA and see which one of the two is the better extract possibility. Doing that we can see that track 6 aligns with the speech and track 7 appears to be the commentary. So, that means, we want track 6.

If we’re going to create an external subtitle file we really want our subtitles to be in an SRT format so we’ll name the file accordingly. The extract might take a while, especially if the extract is taking place over the network.

 mkvextract tracks The\ Mummy\ \(1999\).mkv 6:English_1.srt
Extracting track 6 with the CodecID 'S_HDMV/PGS' to the file 'English_1.sup'. Container format: SUP
Progress: 100%

We can see that the container format is actually SUP and not SRT so the file should be renamed to reflect that.

mv English_1.srt English_1.sup

Now, somehow, we just need to convert the SUP to SRT. Fortunately, there’s a website that can help with that:

https://subtitletools.com

The problem now is that the file just downloaded is the whole of the subtitle track which means that it is now necessary to go through the entire file and rip out all the entries that are not needed. It’s a bit of a painful process but, fortunately, in the case of The Mummy, it is possible to use “Egyptian” as a marker for where to look for the forced subtitles.

Once we have a file that looks reasonable, we just have to give it a sensible name, for Plex this looks like:

The Mummy (1999).eng.forced.srt

And, once that is done, The Mummy now has forced subtitles in all the right places. Well, not “all” the right places because the source file still appears to be missing the occasional entry but it’s a good as it’s going to get.