Search This Blog

Friday, October 5, 2012

TUTORIAL: adding future-proof AAC audio to AC-3-only video files


In my previous article on iOS developers being forced to drop AC-3 support from their players, I've explained you either keep the old versions of your media players or won't be able to listen to the audio track of AC-3-only video files (MP4's, MKV's etc.). In this tutorial, I explain an alternative for people that don't want to do all the hassles of manually backing up and restoring IPA files (one of the ways of playing those files back) or just want to use the most up-to-date versions of multimedia players in the future too.

Note that this tutorial is not only meant for folks that have video files with AC-3 audio only. It's a more generic article showing you how you can use the best OS X apps to add new audio tracks to a video file so that it has multiple audio tracks.

In the article, I only discuss MP4's (basically, the same as M4V's and MOV's) and MKV's, the two most popular multimedia file ("container") formats of today when it comes to non-native camera videos or broadcast formats (this means I don't discuss (M)TS files as they aren't used in non-broadcast movie distribution / ripping). Just a quick recap on the two formats:

1, MKV's are the containers representing the freedom of putting any kind of multimedia content (even the obscurest video, audio, subtitle font, subtitle etc. formats, textual messages for humans etc.) in the same file. It's hardware playback-wise, widely supported on the more open mobile operating systems (Symbian Anna / Belle, Android) and is the native output format of immensely useful DVD / Blu-ray / HD DVD ripper tools like MakeMKV. The latter simply couldn't create MP4's (see next paragraph) out of optical discs because MP4's just can't hold some kinds of data types; for example, Blu-ray subtitles (S_HDMV/PGS).

2, MP4's (M4V's and MOV's) are of extremely high importance to iOS and Apple TV users because it's the only format that these devices can play without third-party apps or without jailbreaking, respectively. And even if you do use third-party apps on iDevices, other container formats can only be played back utilizing the vastly superior hardware acceleration only using certain tricks like behind-the-scene remuxing (dedicated article) - Apple has forbidden the direct hardware decoding of non-native (MP4) files.

MP4's, unfortunately, are really inferior to MKV's in that they can't hold even common video / audio (for example, Vorbis) formats, let alone the above-mentioned native Blu-ray subtitles (PGS). No wonder it's MKV's that MakeMKV rips your discs to and not MP4's.

Now, let's see how you can add an AAC audio track to both MKV and MP4 files originally only containing an AC-3 (Dolby Digital) audio track. Should you want to follow the tutorial, feel free to download THIS (MKV) or THIS (MP4).



MP4's

For the time being, let's start with MP4's as, for some reason,  MKVTools (neither the official nor the latest beta version doesn't seem to behave as it should - it just doesn't convert the test AC-3 audio to AAC on my Mountain Lion MBP. I will definitely return to the question and add an MKV-related section as soon as I find out why it's doing so and update the article. Hopefully I don't end up having to recommend more than one tool for MKV editing. (It's certainly possible - the workflow is just not sufficiently simple without using in-built AAC conversion in MKVTools.)

Get Subler (download HERE; you'll want to choose the latest non-CLI version). Start it.

1, Cmd + O: open the MP4 file:




2, click the + button (annotated in the above screenshot) and select the same(!) MP4 file. You'll be presented a previously not shown, new dialog:






Here, I've annotated a checkbox in the top left corner, in the "Video Track" (see the third, "Name" column) row. You must deselect it to avoid the video track included in the same target MP4 file twice. You must also check whether the "Action" column in the "Sound Track" row reads something starting with "AAC". If it reads "Passthru" (as does the video track in the above screenshot), you'll need to change it to, say, AAC - Dolby Pro Logic II. (If you do plan to add AAC tracks to several files, to avoid having to set this one-by-one, make sure you enable the "Convert: AC3 audio to AAC" checkbox under Preferences > Audio. The enabled state of this checkbox makes this default action to "convert". Of course, as with the non-selected case, you can always override the action to be taken.)

After all this, you'll see the following in the main window:




Note the third row, starting with "na" showing it's still not saved and, therefore, doesn't have a tangible ID in the target file. Don't pay attention to the last, "Format" column (still) showing "AC-3, 6ch" - Subler does know it'll need to convert this audio track to AAC upon saving.

3, Now, press Cmd + S (of course, you can also select Save As not to overwrite the original file) and the file will be saved; now, with two audio tracks. After finishing the saving, the main dialog will also change:




Can you spot the difference with the previous screenshot? If you understand the content of the paragraph starting with "Note the third row, starting with "na" showing" just above, you'll immediately know why there's a "3" instead of the "na" in the first column: this track ID now comes from a real file and not just one that will be created only later. The same stands for the "Format" column: instead of "AC-3, 6ch", it already reads "AAC, 2 ch", showing this particular track is indeed in AAC.

This file can already be played back by both via hardware decoding and from software. (Of course, with the current - rather meagre - processing power of iDevices, you won't want to use the latter with a 1080p movie like this example. Also note that, should you want to synch the video directly to the stock Videos app via iTunes, you'll also need to change its H.264 level by highlighting the Video Track and setting the lowermost "H.264 Video Profile / Level" to High @ 4.1 from the default 5.1 as can be seen in THIS screenshot of the same two-audio track file. (The drop-down menu and the optimal value is annotated.))

Also note that Subler can't directly save MKV files; however, it can remux (change the container of) an MKV to an MP4 file. (Actually, this is why Subler is by far the most recommended remuxer utility for OS X.)


No comments:

Post a Comment