AfterDawn Blu-ray Encoding Tutorial Lesson 5
Encode AC-3 Audio
Up until now, the lessons in this tutorial have focused on video, from decoding to editing to encoding. That's natural considering how complex a subject it is. But, unless you are making silent movies, eventually you have to also consider the audio that goes with, and comes from, your video files. In Lesson 5 we will focus on preparing the audio streams you will use as assets for your Blu-ray disc.
The Complete AfterDawn Blu-ray Encoding Tutorial
Creating assets for Blu-ray authoring is relatively easy, but not necessarily simple. To make it easier to learn we have divided this tutorial into several individual lessons, each of which addresses a single step in the process. At the top and bottom of each lesson is a navigation menu where you can jump to any other lesson in the series. You can easily return to a previous section for review or skip over any future section. It is recommended that you read the entire series at least the first time through.
Official AfterDawn Blu-ray Encoding Tutorial feedback thread
We have created a dedicated discussion in our forums (open in new window) for feedback on this tutorial. We would love to hear your whatever thoughts you have. Tell us what you liked or what you didn't like. Let us know if there was something you didn't understand or even something that was just plain wrong. We strive for 100 percent accuracy in our guides, but nobody's perfect. Any help you can give us in getting a little closer to that goal is appreciated. Our goal is to help you out, and anything we can change to do a better job of that is an improvement.
There are essentially two questions you need to deal with when it comes to the audio for your Blu-ray disc. First, is it encoded to a Blu-ray compliant format. There are numerous formats which are allowed on a Blu-ray disc, but when it comes to sources which don't originate from a professionally authored disc you can generally narrow it down to just two - Dolby Digital (AC-3 or A52) and LPCM (uncompressed).
In this lesson I will not be covering LPCM. That will be the subject for a future, more advanced, installment. Instead I am assuming that you will be using Dolby Digital for your Blu-ray since it is such a common format and MeGUI includes tools for encoding it.
Cutting Audio To Match Video Edits
Besides the format, another possible concern you may need to address is matching up the length of your audio source with your video. This should only be an issue if you used the AVS Cutter to edit your video prior to encoding. That's where the Cuts file produced at the end of that process comes into play. When you encode your audio you will need to make sure to load that file and matching edits will be made to the audio stream prior to encoding. If your audio does not need to be encoded there is also a separate Audio Cutter tool which will perform the edits without altering the rest of the audio.
Possible Audio Sources
Before you can figure out what, if anything, you will need to do to process your audio, you need to figure out what type of audio source you have. There are basically three possibilities.
1. An Extracted Audio File
- If you opened your source using either the DGIndex file indexer or HD Streams Extractor you should have ended up with one or more audio files which were extracted from your source. Typically these will be Dolby Digital or LPCM files. If they are LPCM audio, they will typically be either WAV or FLAC (losslessly compressed) files.
2. Separate Audio Source
- Your audio may have already been in a separate file when you began. In that case you can treat it just like an audio file extracted via MeGUI
3. An AviSynth Script
- If you indexed your source video using FFIndex but didn't use the HD Streams Extractor first, you would have ended up with a second AviSynth script (AVS file) which you can use to read the audio from your source. Although this is not optimal if your audio is already in Dolby Digital format since it will require you to re-encode, chances are the audio was in some other format, most likely AAC (Advanced Audio Coding) which would have to be converted to AC-3 anyway. In that case having an AVS file as your source can be quite advantageous since it makes matching any edits you may have done very simple.
Whatever type of audio you have, whichever tool you used to extract it should have provided you with all the details you need to determine what, if any, processing is necessary. Below you can see examples taken from FFIndex (top left), DGIndex (top right), and the HD Streams Extractor (bottom). Notice that each one lists the encoding, number of channels, and sampling frequency. Additionally, if your audio was extracted by DGIndex the filename will include the bitrate it is encoded at.
Dolby Digital Sources
If your audio is already in Dolby Digital format and has a samplerate of 48kHz, 96kHz, or 192kHz, you can skip encoding entirely. If you did not use the AVS Cutter to trim your file you can simply stop at this point and go straight to authoring your Blu-ray disc. If you did use the AVS Cutter on your video, continue to the next step where you will edit the audio to match.
Cutting Dolby Digital Files
If you did use the AVS Cutter to edit your video, you will need to cut the audio to match. This is easily accomplished using MeGUI's Audio Cutter.
Open the Audio Cutter from MeGUI's Tools menu.
1. Source Audio File
- First open your source AC3 (Dolby Digital) file.
2. Select Cuts File
- Next you will need to open the Cuts file you created with the AVS Cutter back in Lesson 2.
3. Output File
- Finally you will set an output file which will be identical to the source, except with the sections indicated by the Cuts file removed. In other words, no encoding will be done so no quality will be lost.
4. Create Job
- Click this button to create the audio cutting job and add it to MeGUI's queue.
Once your audio cutting job completes you are ready to move on either to any additional audio streams or to authoring your Blu-ray disc.
Encoding To Dolby Digital
MeGUI has two different tools capable of encodng AC-3 (Dolby Digital) audio. One of them, Aften, has been out of development for quite some time so I recommend that you use the other tool - FFmpeg - instead. In either case, though, the encoder settings interface is identical so you can use these directions for either one.
The Audio Encoding Interface
You will find the audio encoding interface at the bottom of the main MeGUI window.
1. Audio File or AviSynth Script
- Start by opening the audio file which MeGUI extracted from your source. If you indexed with FFIndex you will have an AviSynth script (AVS file) with a name referencing a track number. This is the file you will use as your audio source.
2. Select Cuts File
- If you edited your video with the AVS Cutter, you will need to load the Cuts file created at the end of the process so the audio can be edited to match before encoding.
3. Output File
- This should be self explanatory. It's the file MeGUI will be creating for you.
4. Encoder Profile
- By now you should be familiar with MeGUI's profile-based interface. Select the FFmpeg *scratchpad* option here. Alternatively, you can select one of the Aften profiles or a custom (FFmpeg or Aften) profile you have already created for yourself.
5. Configure Audio Encoder Settings
- This will open the audio encoder settings dialog. See below for detailed instructions on configuring either of the AC-3 encoders.
6. Create Job
- Once you are satisfied with all your settings, use the Queue button to create a video encoding job and add it to the queue.
AC-3 Encoder Settings
1. New Profile
- This works essentially the same as MeGUI's other profile interfaces. Use the New button to copy the current settings into a custom profile to reuse them later.
2. Preferred Decoder
- Regardless of the source, AviSynth is used to open and process (but not encode) your audio. This setting determines what filter is used to open it. Unless you run into problems you shouldn't change it. Otherwise you can choose FFAudioSource, which uses FFmpeg libraries, or DirectShow, which attempts to use Windows' DirectShow interface.
3. Ouput Channels
- You can choose to keep the original channel configuration, downmix streams with more than two channels to stereo, or upsample stereo sources to surround. You can even convert your audio to mono. Given the extremely small size of even the largest AC-3 file compared to the space available on a Blu-ray disc, there really isn't any advantage to downmixing. Likewise, there really isn't anything to be gained from upmixing since AviSynth has no way to know what sounds should be directed to which speakers. As a general rule you should simply keep the original channels.
4. Sample Rate
- This should be set to either Keep Original or Change to 48000Hz. The other sample rates listed are not Blu-ray compliant.
5. Dynamic Range Compression & Normalization
- These options control the AC-3 settings used to prevent the difference between very quiet and very loud sounds from becoming too great. If you don't know what they do, don't mess with them.
- Typically the bitrate used for encoding stereo AC-3 files is eithe 192kbps or 224kbps. Surround streams for DVD are usually encoded at 384kbps or 448kbps. Blu-ray allows up to 640kbps. Whether it is worth going that high is something only your own ears can tell you. Once again, though, it is next to nothing compared to the size of a Blu-ray disc so it probably won't hurt.
Continue To Lesson 6
So far you have learned about techniques tailored for encoding a single title (video file) for Blu-ray, but what if you want to put multiple titles on a disc? In the next lesson you will be introduced to a technique for calculating bitrates for encoding multiple videos and some suggestions for tweaking the process to maintain even quality among sources with varying encoding requirements and complexity.
Last updated: 13 August 2012