Advanced eac3to Remuxing of Blu-Ray and HD-DVD to MKV
Inspired by Remux Blu-ray HD DVD Main Movie for Playback - Credit to jj666
Use this guide to remux Blu-Ray and HD-DVD to a matroska file (.mkv) to play on you NMT. This guide assumes you are comfortable using system command lines to run eac3to, if you would prefer a GUI based approach, try using HdBrStreamExtractor to drive eac3to or look at Remux Blu-ray HD DVD Main Movie for Playback although the latter approach uses a .ts container, which does not support chapters and requires the subtitles to be located next to the .ts file in a separate .srt file.
Matroska has been chosen as the container for this guide, because the resulting .mkv file will contain:
- subtitles (including forced subtitles)
What You Need
Tools and Apps:
Step 1: Rip the Blu-Ray or HD-DVD to hard disk
Whilst eac3to will happily manipulate the video, audio, chapter and subtitles from the Blu-Ray or HD-DVD disk itself, this will substantially slow down the process. It is recommended that the disk is first ripped using AnyDVD HD to a directory on the hard drive. Detailed instuctions on how to rip the disk using AnyDVD HD can be found here Rip the DVD to hard disk
Step 2: Run eac3to to find out what titles are contained on the Blu-Ray or HD-DVD
We need to find out how many titles are on the source disk, then decide which title to select for processing - some disks have seamless branching with multiple versions of the same movie, or include supporting features such as behind the scene documentaries as well as the main title. To list what is on the disk, run the following command:
For example, we get the following result
This is a typical simple Blu-Ray disk, as it contains:
- first playlist (the main movie)
- second playlist (a supporting feature, e.g. a documentary about making the film)
- third playlist (yet another supporting feature)
We want just the main movie, thus we run the following command to find out what streams are contained in the first playlist:
eac3to source_directory playlist_no)
We must take note of any delay reported by eac3to for the audio or video streams, as this must be input into mkvmerge later to ensure everything is in sync. For example, this HD-DVD has a substantial audio delay of 4571ms on English audio track 4, whereas the Italian audio track 5 is advanced by 32ms:
Step 3: Extract the required streams
As we wish to create a full function .mkv, we must extract the following streams from the first playlist:
- h264/AVC video
- ac3 audio (in the example that follows, not TrueHD as the target Home Cinema system does not yet support TrueHD or DTD-HD)
For this, we run the following command:
eac3to source_directory playlist_no) chapters_no: chapters.txt video_no: video.mkv audio_no: audio.ac3 subtitles_no: subtitles.sup
To extract TrueHD audio instead, we would change the audio.ac3 parameter for audio.thd as follows:
eac3to source_directory playlist_no) chapters_no: chapters.txt video_no: video.mkv audio_no: audio.thd subtitles_no: subtitles.sup
If the source audio was DTS, we would use audio.dts, for DTS-MA, we would use audio.dtsma
As standard, eac3to can convert audio formats from DTS to ac3, without any other codecs installed; eac3to will convert between other audio formats if the appropriate codecs are installed. For example, converting ac3 to DTS requires a DTS encoder such as surcode which is expensive.
To make eac3to convert audio standards, change the audio suffix in the eac3to command line to the desired audio format. For example, if the source was DTS-MA and you wanted an ac3 audio track, specify audio.ac3 for the DTS-MA stream; eac3to will extract the DTS core, then convert the DTS to ac3.
Step 4: Extracting Forced Subtitles
Here we have a movie that has forced subtitles (tracks 39-44):
It is important to select and extract the forced subtitles, rip as shown in Converting the subtitle from a .sup to a .srt to create a .srt file, then add the .srt to the .mkv file as a subtitle with the 'Forced track flag' set to 'yes' as shown in Mux the files together into the .mkv
Step 5: How to handle seamless branching videos
This example Blu-Ray disk has numerous playlists, the challenge is to work out which playlist to choose for the version of the movie you want to extract:
Unfortunately there is no other solution than to extract each playlist in turn until you find the one you want. Try extracting just the video and inspect the end result on your PC with something like Videolan. In the example above, the 1st, 2nd and 3rd playlists all have the same first video branch 0 (which corresponds to 00000.m2ts), the 4th, 5th and 6th playlists start with video branch 93 (00093.m2ts). Therefore if the 1st playlist is not the result you want, try skipping to the 4th playlist as the 2nd and 3rd playlists will be similar to the 1st playlist.
Step 6: Convert the subtitles from a .sup to a .srt
Subtitles are stored as bitmaps on the Blu-Ray and HD-DVD, we need to convert them into .srt files, which are text versions of the subtitles, with timing information for when and how long each subtitle should be displayed. If you are lucky, you can find a corresponding .srt file from the internet for your movie that someonelse has prepared - this can be fraught with difficulty as the quality of the ripping can vary and you cannot be sure if the timing information is correct. Run SupRip and open the .sup file that we extracted earlier, you will be presented with the following screen:
SupRip has done a pretty good job at optical character recognising most of the characters, but there are 5 characters it cannot recognise:
- the 'o' in 'Who'
- the 'you' in 'you'
- the 'n' in 'men'
We need to train SupRip and this will seem tedious at first, but after a while SupRip can recognise more and more of the subtitles without intervention. Click on the first character highlighted in subtitle as a colour other than green, this will display the character below the subtitle, then type in the correct character into the box to the left of the 'Ok' button. If you need to use some other character than is on your keyboard, click on the 'Character Map' button and you can copy the desired character and paste it into the box to the left of the 'Ok' button.
When you are happy, click 'Ok' and the next unknown character should be displayed, keep doing this until all the characters have been corrected, then hit the 'OCR' button, which will move onto the next subtitle that SupRip cannot fully OCR.
Where italics have been used for the subtitle, you will have to train SupRip in almost all of the characters.
When you have corrected all the subtitles, click on the 'SRT' tab to look at the .srt file before saving this to hard disk. Here you can see that a .srt file is just a text file containing each subtitle with a start time and duration. Quickly check the .srt file to see if there are any mistakes, if there are, note the subtitle number, click on the 'Image' tab, type in the subtitle number into the box above the subtitle and correct the mistake by clicking on the corresponding character in the subtitle and correcting the character that is in the box to the left of the 'Ok' button.
Once satisfied that the subtitle is correct, click on the 'Save' button on the SRT tab and save your .srt file.
Whilst SupRip does a pretty good OCR job, it's biggest weakness is that it cannot differentiate between an 'l' and a capital 'i' because of the font used for the subtitle bitmaps - the easiest (but tedious) way to correct this is to open the .srt file within notepad, and search and replace for every 'l' and replace with a capital 'i' if SupRip has got it wrong.
Step 7: Mux the files together into the .mkv
Now we need to put all the components of our movie into a container; for this guide we have chosen the matroska container as this will allow all of the four components (video, audio, chapters and subtitles) to be put into the single container, which makes it easy to administer the movies. It is easy enough to move the components to a different container at a later date if this is required, so this is not a one-way process. We are using the mkvmerge GUI to drive mkvmerge - start by adding the video, audio and subtitles into mkvmerge GUI from the Input tab
Click on each stream in the 'Track' box in turn to set any parameters relevant to that stream. For example, the audio stream should have the language set in the 'General Track Options' tab, and any audio delay noted from the earlier eac3to extraction process should be entered into the 'Format Specific Options' tab. If you have added multiple audio tracks, ensure you select one of them as the default in the 'General Track Options' tab.
For subtitles, at least set the language in the 'General Track Options' tab. If the movie is originally in a foreign langauage, you could set the 'Forced track flag' in the 'General Track Options' tab to 'yes' to ensure that the subtitles are displayed without the user switching them on. If you have ripped a forced subtitle track (as shown earlier in ExtractingForced Subtitles), ensure that the 'Forced track flag' is set ot 'yes'.
To add the chapters we go to the 'Global' tab and input the chapters file we created earlier when extratcing the movie. It is worth setting the language type for the chapters
Now we are ready to mux the components into one file:
The file is complete, we can now test it on the PC with Videolan or transfer it to the NMT and test it there.
- See Eac3to/How to Use for more details on the eac3to command line parameters
- See Blu-ray to Mkv Converter for more details on this software (Note: this link refers to commercial software and does not have official endorsement or affiliation)
- See Comparison of container formats for more on the pros and cons of each container format