Transcoding MKV

Discussion in 'Digital Video' started by MadDoc, Sep 23, 2012.

  1. MadDoc macrumors 6502

    MadDoc

    Joined:
    Apr 25, 2005
    Location:
    UK
    #1
    I have a collection of about 300 Blu-ray discs which I've ripped to 720p h264 MKV format with either DTS or AC3 passthru audio. I have been using Plex to play them and everything has worked great.

    Due to a change in my home theatre setup, I can no longer use Plex and have to use an Apple TV (the new version 3). Obviously, the ATV doesn't handle MKV files. I'm looking for a suggestion on how I can transcode the files to a format the ATV can play. I don't want to lose video quality and I'm assuming there must be some way to transcode the h264 and audio to a different container format.

    Any ideas how to do this on a Mac?

    Thanks a lot.
     
  2. simsaladimbamba

    Joined:
    Nov 28, 2010
    Location:
    located
  3. HobeSoundDarryl macrumors 603

    HobeSoundDarryl

    Joined:
    Feb 8, 2004
    Location:
    Hobe Sound, FL (20 miles north of Palm Beach)
    #3
    If you do want to transcode, Handbrake. Subler maintains the video exactly "as is" which yields file sizes just about exactly the same size as your MKVs. Handbrake processes the file (and with HD movies it can take a long time (hours) even on a fast Mac) but you end up with much smaller files (maybe 1/4 to 1/2 the size) vs. the MKVs with a difficult-to-see difference in quality (even on a big screen HDTV).

    While you're at it- and since you have an :apple:TV3 anyway, you should consider redoing them all at 1080p? Even if you have a 720p HDTV now, your next one will probably be 1080p, and higher quality files will deconvert to 720p and look great (while upscaling from 720p to 1080p will not work as well).

    A third option is to return or sell the "3", buy a "2", jailbreak it to install Plex and continue on as it has been for you. "2" is hardware capped at 720p but you've already got your collection set up like that right now. The "3" should sell for close to what it would cost to buy a "2". And all 300 would be ready to play very soon thereafter.
     
  4. floh macrumors 6502

    Joined:
    Nov 28, 2011
    Location:
    Stuttgart, Germany
    #4
    Wow, I didn't know about Subler, but it seems to be exactly what you were looking for.

    If (for some reason) it doesn't work for your files, you can try this little program I wrote because I didn't know about Subler. It also just changes video containers without affecting the stream, but it is very simple and in "just released" stage, so definitely try Subler first.
     
  5. simsaladimbamba

    Joined:
    Nov 28, 2010
    Location:
    located
    #5
    I wanna try that, but it tells me, that I have to use 10.7. I am still on 10.2.8, ahem, 10.6.8, could there be a version for 10.6.8, even an unstable one, or is Xcode, or whatever application you use to program with, not allowing you to make it compatible with 10.6?
     
  6. floh macrumors 6502

    Joined:
    Nov 28, 2011
    Location:
    Stuttgart, Germany
    #6
    Sorry, this was the first Cocoa app I ever programmed ("usually" I program strange command line theoretical physics simulation software...). I built it for 10.7 and only have this system available to test it. I just uploaded a build for 10.6 to the sourcforge page, and hope that you can now try it out.

    (und Grüße aus Stuttgart, wie üblich... ;) )
     
  7. JasonA macrumors member

    Joined:
    Feb 18, 2009
    #7
    Thanks for that, I'm still using 10.6 too. Great app!
     
  8. Menneisyys2 macrumors 603

    Joined:
    Jun 7, 2011
    #8
    Cool! You should have advertised it more actively (e.g., here at the forum) as not even I heard of your app. I will definitely test and report on it!
     
  9. MadDoc thread starter macrumors 6502

    MadDoc

    Joined:
    Apr 25, 2005
    Location:
    UK
    #9
    @floh,

    I'll definitely take a look at your app. Especially since Subler is broken on Mountain Lion :(
     
  10. Menneisyys2 macrumors 603

    Joined:
    Jun 7, 2011
    #10
    It isn't - just need some manual codec copying. Following is my tutorial:

    This is Part III of my article series of my MKV remuxing series, with two main subects: Perian (and the Perian-dependent Subler) on Mountain Lion and selecting the right version of one of the most recommended MKV remuxers, MP4Tools. Let's start with the former.

    1. This is how you can still use Perian on Mountain Lion – and remux all your MKV's with Subler

    I've very thoroughly examined Perian's more or less broken compatibility (of which I've talked quite a bit in the previous part) with the latest-and-greatest Mac OS X operating system version Mountain Lion (ML for short). One of the reasons for this was simple: during benchmarking and testing, I've found Subler still the best (fastest, most reliable, non-crashing) free remuxer, particularly if you need to keep subtitles. (A lot of other, free or very cheap remuxers – for example, the non-beta version of MP4Tools and Smart Converter - discard or mess up subtitle tracks.)

    As has been pointed out in the previous part of this series, without installing Perian, Subler won't be able to convert either AC3 or DTS original soundtracks into AAC ones required by iOS devices. The Apple TV can also play AC3 audio tracks so, should you not want to play back your videos on iPhones or iPads, you don't need to convert AC3 tracks to AAC ones at all. That is, if your MKV input files only have (an) AC3 track(s) and you only target Apple TV's, you can safely skip this article. However, for both DTS tracks and iPhone / iPad / iPod touch users, this article will be of extreme importance.

    Fortunately, while Perian is indeed not fully compatible with Mountain Lion by default, with some manual “hacking”, it's very easy to make it work with Subler for both AC3 and DTS conversion. Here's how.

    1.1 First, you'll need to download two files:

    THIS file is the AC3 encoder and (after decompressing) must be placed under ~/Library/Audio/Plug-Ins/Components in your home directory. I'll later explain when this needs to be done – the order of file copying / overwriting is very important! (Discussion links also linking to the file: thread on Subler's page; another one; and a Russian one with a decent Subler tutorial.)

    THIS is the DTS decoder (current, 1.2.3 version; if it becomes unavailable some time in the future, you'll find the working link at Perian's main page). Just install it by clicking “Perian.prefPane” in it, which installs a new preference pane in the Other group of system-level System Preferences:

    [​IMG]

    In the screenshot above, I've annotated the button you'll need to click, should you want to quickly disable Perian. Enabling it will be done via clicking it again when it shows “Install Perian”.

    1.2 After installing and enabling Perian...

    …you'll already be able to convert DTS (but not AC3!) audio tracks. Give a try to converting THIS file (it has both a DTS and an AC3 audio track) with Subler, making sure you don't untick anything in the “Select Tracks” dialog box. It's the first checkbox list, immediately displayed after selecting the file to load. I've annotated the checkbox showing, by default, Subler imports all tracks, including both AC3 and DTS, from the MKV file you open:

    [​IMG]

    You can quickly learn the audio format a given track is using by casting a glance at the sixth, “Info” column. In this case, it's “DTS” in the annotated row.

    The next, “Action” column tells Subler what to do with the given track. With DTS audio tracks, it'll always be “AAC – Dolby Pro Logic II” as DTS must be converted as it can't be natively included in target MP4 / MOV / M4V files, unlike AC3 tracks. In this column, you can also change the output format; generally, only change this if, for some reason, you need to use some other output downmixing. (You'll rarely need to – I don't know of any MP4 player hardware not being able to play back the default, most advanced, MOV container-compliant Dolby Pro Logic II audio.)

    Now, let's take a look at the next row, the one with “AC3” type and “2” ID. In the “Action” column, we see the same “AAC – Dolby Pro Logic II”, meaning the AC3 audio track will also be converted into a Dolby Pro Logic II AAC track. Note that, unlike the one with the DTS audio tracks, the default value you'll see here depends on the state of a checkbox and a drop-down list in Preferences. You'll see the same if you enable the "Convert AC3 Audio to AAC" checkbox in Preferences > Audio, annotated by a rectangle in the following screenshot:

    [​IMG]

    Note that if you don't check in this checkbox, you'll see “Passthru” upon the next file opening. Before learning how to enable the AC3 → AAC conversion under Mountain Lion, make sure you see this in this dialog by either making sure the "Convert AC3 Audio to AAC" checkbox is disabled or you manually click “AAC – Dolby Pro Logic II” in the “Action” column and set it to “Passthru”. Then, no failing AC3 -> AAC conversion attempts (which, again, makes it necessary to manually overwrite a file in the file system, which will be later explained) will take place – the input AC3 track will be simply written to the output. (Alternatively, you can just disable the entire AC3 track by unticking the checkbox in the first row.)

    Also note that, should you enable the "Convert AC3 Audio to AAC" checkbox, the item you select “Downmix audio to:” drop-down list directly under it will be listed in the Action column:

    [​IMG]

    The screenshot above shows opening files with AC3 tracks with the downmixing default set to “Stereo” (and with the AAC conversion enabled, of course):
    [​IMG]

    Again, you can always override the default setting by directly clicking the entry in the Info column – no need to change the setting in Preferences.

    1.2.1 All in all,

    if you install Perian only (and make sure you enable it in System Preferences), you'll be able to convert DTS tracks to AAC and also convert MKV files with AC3 audio track(s), assuming you only “passthru” them (or disable them entirely).

    1.3 Now, for the AC3 -> AAC conversion part...

    As I've already hinted on, should you want to convert your AC3 track(s) to AAC('s) instead of just “pass-thruing” them into the target MP4 file, AC3 support must be separately enabled under Mountain Lion – as opposed to earlier OS X versions.

    To do this, copy the (decompressed) AC3 encoder file I've linked to in Section 1.1, A52Codec.component to ~/Library/Audio/Plug-Ins/Components. There won't be anything in that directory if you haven't installed Perian before. The directory should look like as follows after you've done copying:

    [​IMG]

    Note that, in the screenshot, I've also right-clicked the directory name to show you the entire path – it's under my home directory (/Users/werner in this case).

    Also note the date of the file I've annotated. The ML-compatible A52Codec.component will have a timestamp of Jul 27, 2012.

    If you have installed Perian, it'll put its own version of A52Codec.component with the timestamp Jul 23, 2011 (it's based on these timestamps that you can easily know which version is currently installed):

    [​IMG]

    You can safely overwrite this file.

    Note that, when you, in System Preferences, disable Perian (if it's installed), A52Codec.component will be immediately removed, regardless of its source (Perian or the updated, ML-compliant, new file). In addition, when you (re-)enable Perian, it'll overwrite the updated A52Codec.component file. Therefore, it's always best to make sure you do copy back the newer (2012), ML-friendly file to the directory after re-enabling Perian. This can easily be done manually – or with a script if you write one.

    2. MP4Tools tips and tricks

    In the last part of this series, I've recommended MP4Tools as one of the best MKV remuxers. However, there's a clear difference between the two versions you should be aware of.

    There's a stable version (last updated this Spring) and a beta (last updated, as of beta13, early Septermber). The latter is much more powerful, faster and reliable than the stable version but has its own shortcomings. The latter mostly mean (still) missing track editing capabilities, which, when “only” remuxing MKV's to MP4's, won't be an issue. The developer has listed the still-not-reimplemented functionality on its beta download page. It's this very page that you should download the beta from.

    The two versions can safely co-exist. The serial number originally purchased for the old version will work with the beta too.

    Note that there are also MKV videos incompatible with the new and, otherwise, far more recommended version. An example of them is HERE (warning: 390M download!), the direct Blue-Ray rip of the official Iron Sky (IMDb link) trailer I've made from the Finland-only, official Blue-Ray disc of the (BTW, great – after all, it's Finnish ;-) ) flick. It just can't be converted by the beta version properly – it creates a useless, 4 kByte-file in 1-2 second, totally independent of audio selection. BTW, speaking of this Blue-Ray disc, the “behind-the-scenes” MKV rip isn't converted by the beta either. The main title (17 Gbytes) is.

    All in all, whenever possible, use the beta version – it's so much superior. However, when you do encounter problems, switch back to the old one. Or use Subler, which, now that the DTS / AC3 audio conversion problems are fixed under ML, should be preferred in most cases to the old version of MP4Tools: much faster, much more reliable: no crashes, as opposed to the constant crashing of the old version of MP4Tools etc. And yes, it doesn't mess up the (textual) subtitles either - the old version of MP4Tools does if there're more than one track in the source MKV file.

    I've also talked about the differences between the two versions HERE (full thread).
     
  11. MadDoc thread starter macrumors 6502

    MadDoc

    Joined:
    Apr 25, 2005
    Location:
    UK
    #11
    @Menneisyys2

    Wonderful post. Thank you so much!

    On a related note, a lot of the MKV's I have ripped only have a DTS track. Does the conversion of DTS -> AAC (as I understand from your post is mandatory as the MP4 contrainer cannot contain a DTS track) preserve surround sound or does it "downgrade" it to stereo?

    Primarily I want to watch these MKVs on the AppleTV 3. Since I am going to have to go through the effort of converting the files to put them into iTunes, I might as well configure them so they can also be played on my iPad. Is it possible to include two audio tracks in an MP4 file so that the best one (the surround sound track) is played by the ATV and a "lesser" or stereo track is played by the iPad?
     
  12. Menneisyys2 macrumors 603

    Joined:
    Jun 7, 2011
    #12
    Sorry, that (DTS) was a mistake on my part (will fix it in the writeup). MP4's can also contain DTS tracks. They won't be played back by iTunes / iOS / ATV, of course, "only" VLC and other, advanced players.
     
  13. MadDoc thread starter macrumors 6502

    MadDoc

    Joined:
    Apr 25, 2005
    Location:
    UK
    #13
    Ah I see. Can Subler convert the DTS track into a different form of surround sound track that can be played by ATV?
     
  14. daybreak macrumors 6502a

    Joined:
    Sep 4, 2009
    #14
    I might be wrong but i think Perian have stopped trading. 4 months ago i got a e-mail saying due to cost they are closing down.
     

Share This Page