MakeMKV

Under the Advanced settings it is possible to tweak what MakeMKV is looking for when it rips a disc.

The original string is:

-sel:all,+sel:(favlang|nolang),-sel:mvcvideo,=100:all,-10:favlang

Which basically selects favourite language files and no language files, and deselects mvcvideo (3D) files. No idea what the bit on the end does but it does explain why my 3D films never worked properly.

From looking on the MakeMKV forum I’m now using:

-sel:all,+sel:(favlang|nolang|mvcvideo),=100:all,-10:favlang

which should let me rip 3D films and, now that I’ve sent falling to English, only selects the English tracks.

Plex and Subtitles – 2

Subtitle Editor seems to be the go-to program for editing subtitles. However, being on a Mac, that’s no good for me as there are only Windows and Linux versions. The thing with having a Linux version of a tool though is that there’s a very good chance that it exists in Docker and that is, indeed, the case here.

https://hub.docker.com/r/fresta/subtitleedit

docker run --name=subtitleedit -e WIDTH=1280 -e HEIGHT=720 -p 3389:3389 -p 8080:8080 -v /media:/media fresta/subtitleedit

Just set /media to be something useful.

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.

Hello Twonky! This is Europe calling.

I’m still looking at getting the album order correct on multi-disc albums. Only now, I’m running Twonky on my T12-423 rather than the WD NAS so I can pretty much do what I want to now.

So, first things first. The Twonky calls.

I’m using HTTPie but Postman would be equally good. First, we need to construct a post to read the available albums:

POST http://192.168.3.16:9000/dev0/srv1/control

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<ObjectID>0$1$12</ObjectID>
<BrowseFlag>BrowseDirectChildren</BrowseFlag>
<Filter>*</Filter>
<StartingIndex>233</StartingIndex>
<RequestedCount>300</RequestedCount>
<SortCriteria/>
</u:Browse>
</s:Body>
</s:Envelope>

I can’t remember where the original object ID comes from (a thing for another day) but the StartingIndex and the RequestedCount are where you want to start in your list of albums and how many albums you’d like returned. Twonky only seemed to return 232 which is why I started at 233. I deliberately kept the RequestCount High because Twonky will tell me how many entries its retuned so I’m not too fussed about being accurate.

Twonky returns coded XML which looks like this:

<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:arib="urn:schemas-arib-or-jp:elements-1-0/" xmlns:dtcp="urn:schemas-dtcp-com:metadata-1-0/" xmlns:pv="http://www.pv.com/pvns/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><container id="0$1$12$4282" parentID="0$1$12" restricted="1" childCount="38" searchable="1"><dc:title>Eurovision Song Contest 2014: Copenhagen - Join Us</dc:title><upnp:genre>Pop</upnp:genre><upnp:album>Eurovision Song Contest 2014: Copenhagen - Join Us</upnp:album><dc:creator>Various Artists</dc:creator><upnp:albumArtURI dlna:profileID="JPEG_TN" >http://192.168.3.16:9000/disk/DLNA-PNJPEG_TN-OP01-CI1-FLAGS00d00000/defaa/C/O0$1$12$4282.jpg?scale=org</upnp:albumArtURI><pv:childCountContaine

Copy the body into SublimeText and find / replace the &lt; and &gt; with < and > respectively, then indent the XML to get a nicely formatted page. From this I can easily see that the object for Eurovision 2024 is:

<container childCount="37" dc:date="2024-01-01T12:00:00" id="0$1$12$5307" parentID="0$1$12" restricted="1" searchable="1">
<dc:title>Eurovision Song Contest 2024: Malmö - United By Music</dc:title>
<dc:date>2024-01-01</dc:date>
<upnp:genre>Pop</upnp:genre>
<upnp:album>Eurovision Song Contest 2024: Malmö - United By Music</upnp:album>
<dc:creator>Various Artists</dc:creator>
<upnp:albumArtURI dlna:profileID="JPEG_TN">http://192.168.3.16:9000/disk/DLNA-PNJPEG_TN-OP01-CI1-FLAGS00d00000/defaa/C/O0$1$12$5307.jpg?scale=org</upnp:albumArtURI
<pv:childCountContainer>0</pv:childCountContainer>
<upnp:artist>Various Artists</upnp:artis>
<pv:modificationTime>421989616</pv:modificationTime><pv:containerContent>object.item.audioItem.musicTrack</pv:containerContent>
<upnp:class>object.container.album.musicAlbum</upnp:class>
</container>

Now, make a call to Twonky using the same parameters as the CXN makes:

POST http://192.168.3.16:9000/dev0/srv1/control
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<ObjectID>0$1$12$5307</ObjectID>
<BrowseFlag>BrowseDirectChildren</BrowseFlag>
<Filter>dc:title,upnp:class,upnp:album,upnp:originalTrackNumber,id,res,res@protection,res@duration,upnp:searchClass,upnp:artist,upnp:genre,upnp:albumArtURI</Filter>
<StartingIndex>0</StartingIndex>
<RequestedCount>100</RequestedCount>
<SortCriteria>+upnp:originalTrackNumber,+dc:title</SortCriteria>
</u:Browse>
</s:Body>
</s:Envelope>

This returns:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:BrowseResponse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<Result>
<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:arib="urn:schemas-arib-or-jp:elements-1-0/" xmlns:dtcp="urn:schemas-dtcp-com:metadata-1-0/" xmlns:pv="http://www.pv.com/pvns/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
<item id="0$1$12$5307R891915" parentID="0$1$12$5307" restricted="1">
<dc:title>Hurricane [Israel]</dc:title>
<upnp:genre>Pop</upnp:genre>
<upnp:album>Eurovision Song Contest 2024: Malmö - United By Music</upnp:album>
<upnp:originalTrackNumber>1</upnp:originalTrackNumber>
<upnp:albumArtURI dlna:profileID="JPEG_TN" >http://192.168.3.16:9000/disk/DLNA-PNJPEG_TN-OP01-CI1-FLAGS00d00000/defaa/A/O0$1$8I891915.jpg?scale=org</upnp:albumArtURI>
<upnp:artist>Eden Golan</upnp:artist>
<res duration="0:03:01.440" protocolInfo="http-get:*:audio/x-aiff:*" >http://192.168.3.16:9000/disk/NON-DLNA-OP01-FLAGS01700000/O0$1$8I891915.aif</res>
<upnp:class>object.item.audioItem.musicTrack</upnp:class>
</item>
<item id="0$1$12$5307R887307" parentID="0$1$12$5307" restricted="1">
<dc:title>Titan [Albania]</dc:title>
<upnp:genre>Pop</upnp:genre>
<upnp:album>Eurovision Song Contest 2024: Malmö - United By Music</upnp:album>
<upnp:originalTrackNumber>1</upnp:originalTrackNumber>
<upnp:albumArtURI dlna:profileID="JPEG_TN" >http://192.168.3.16:9000/disk/DLNA-PNJPEG_TN-OP01-CI1-FLAGS00d00000/defaa/A/O0$1$8I887307.jpg?scale=org</upnp:albumArtURI>
<upnp:artist>BESA</upnp:artist>
<res duration="0:02:58.226" protocolInfo="http-get:*:audio/x-aiff:*" >http://192.168.3.16:9000/disk/NON-DLNA-OP01-FLAGS01700000/O0$1$8I887307.aif</res>
<upnp:class>object.item.audioItem.musicTrack</upnp:class>
</item>

Hurricane is not the first track for the album so this is obviously wrong.

As I can’t change what the CXN is asking for, I need to change the response the CXN is receiving (if that is even possible?)

What I think I need to do is to have the “upnp:originalTrackNumber” be a combination of the disc number and the actual track number so it becomes something like 101 and 201 for the first track on the first and second disks… I think I’m out of luck there.