Overlay DVD subtitles over a separate Video file?

Anything and everything to do with DCP-o-matic.
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

Overlay DVD subtitles over a separate Video file?

Post by Carsten »

I have some (quite graphical) bitmap subtitles in an MKV, from a DVD RIP. I want to overlay these over a different MKV file (HD). Is there any way DOM can use these subs separately, ignoring the video and audio that comes with it, and burning them into a separate video file?
If I go to timeline view with the original MKV, I can see video, audio and subtitle track. I can remove audio track, but I can't remove the video track without also removing the subtitle track.

I was able to extract the subs to IDX and SUB file, but it seems DCP-o-matic can not use these?

- Carsten
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

Re: Overlay DVD subtitles over a separate Video file?

Post by Carsten »

I was finally able to accomplish this. Although it took me a while to research software and workflows. But in the end, it turned out to be actually easy, using only two free applications running under OS X. I extraced the VOB/DVD bitmap subtitles with iMKVextract. This gave me a sub (bitmap) file and idx (config/timing) file. While DOM is not able to work with sub/idx files directly (WHY?) - I was able to multiplex the sub/idx file into a HD/Bluray derived MKV file (video + DTS audio). This was done using the OS X GUI version of MKVToolNix (what a nerdish name for such a useful and capable piece of software). MKVToolNix is the SwissArmyKnife for getting individual streams of video, audio, and subtitles into and out of MKV containers. There is also a windows version available. This can be quite handy if you have a multistream MKV that causes trouble in DOM (e.g. if it contains Dolby TrueHD tracks or certain anomalies).

Initially, I was concerned I would need to perform an additional step of adjusting the sub/idx from 25fps to 24 fps (as the original sub/idx originates from a 25fps DVD, while the HD video comes from a 23.97 Bluray. However, I soon noticed that the subtitle timing in the idx file is based on absolute time, not frame/fractional frames. So, as long as the video frame rate is not changed, the absolute times should match - which they did. The only adjustment needed was a fixed delay for the subtitles, as the Bluray had about 4-5s of additional black at the start. I was puzzled to find out that MKVToolNix has options to introduce a delay per individual stream very easily - and it turned out, that after multiplexing video/audio with the subtitles, the timing was perfect and stable from beginning to the end of the 1h50m feature. Nice to experience that sometimes, things just work.
So, after performing the video/audio and sub/idx multiplex with a delay of 4300ms, DCP-o-matic found video, audio and subtitles in the MKV, ready to be burnt into a DCP.
The sub bitmaps had DVD resolution, but DCP-o-matic instantly applied proper scaling to fit to HD/2k. I was then able to adjust some parameters of the subtitle display for burn-in: Shift the subtitles into the black bar above the image, disable a light-grey alpha/transparency border, and adjust some colors. Perfect.

This is for a single showing, but the result is well worth the effort, as it turned out, the VOB subtitles are animated rythmically to the music song lines, and are much nicer than the plain text titles of the Bluray version.

I also tried SubtitleEdit (windows software) to get a grip on these subtitles, however, I noticed that, while it is able to import VOB/sub titles from MKV/VOB files, it can only deal with these bitmap files after it has performed a character recognition (OCR) and text conversion process. A mighty tool as well, hats off, but useless for my application, as the OCR has trouble to deal with these animated bitmap subs, and if I bypass/cancle the OCR, I am left with nothing. Still, highly recommended for all 'ordinary' subtitle work.

- Carsten