Demux Audio

Before any audio will qualify as a DVD asset it will need to at least be demuxed. While it may be possible for your authoring software to accept an MPEG-2 file that's already muxed, it's safer to start with elementary files. Elementary files only contain a single audio or video stream. AC-3 audio that's demuxed from a source file can be moved to wherever you're storing your audio assets. I'm putting all of mine in a single Audio folder because that will help later when I'm opening many audio assets at once. Since the only files we have with AC-3 audio are MPEG-2 files, we can use DGIndex to demux them.

Speed Changes

Any audio that's going to be sped up will need to have that done before it's demuxed. Regardless of how it's done, even AC-3 audio requires resampling as part of this process. That means decoding the audio to an uncompressed format and then compressing it again afterward. AviSynth can handle the speed change and resampling, but we'll be using TMPGEnc's AC-3 Encoder Plugin to compress our altered audio to Dolby Digital.

NTSC Audio

Audio for our NTSC DVD will be fairly straight forward. The only file that isn't already at the correct framerate is The 39 Steps, and through the magic of pulldown we can avoid any speed changes. For MPEG-2 files that already have AC-3 audio the only thing that must be done is to demux the audio into a separate file using the procedure outlined for DGIndex. The resulting file will be a DVD asset. Other MPEG-2 files with MPA audio will also need to be demuxed with DGIndex. The resulting MPA files will need encoded to AC-3 format. Fortunately, the TMPGEnc encoder can accept MPA files as input. The MPEG-4 sources will need their audio decoded from AAC format to create uncompressed Wave files. Those files can be encoded to AC-3 as well.

MPEG-2 Files

Demux all the MPEG-2 source files. Set aside the AC-3 files as DVD assets. Encode the MPA files to AC-3 using the instructions on the next page of this guide.

MP4/M4V Files

Use AvsP to open each file individually and then VirtualDub as an external viewer to save the audio. Encode the audio files to AC-3 using the instructions on the next page of this guide.

Sample NTSC Scripts

Scripts for demuxing audio should look like these.

29.97fps Source

DirectShowSource("D:\Storage 3\Basic DVD Project\Cartoons\arctic_giant.m4v",fps=29.87)

23.976fps Source

DirectShowSource("D:\Storage 3\Basic DVD Project\Cartoons\Superman-01-The_Mad_Scientist.mp4", fps=23.976)

PAL - A Case Of Conversion

Since most of our source files are encoded as NTSC right now, we have to know how we're going to be changing them to PAL. The key is realizing that the source videos are originally from film sources. Unlike NTSC, which has a much higher framerate than PAL, film runs slightly slower. We're going to use the method generally accepted as "correct" for this procedure. Fi

MPEG Files

We'll start with the easiest source file. The 39 Steps has already been sped up to PAL framerate. All we'll need to do is use DGIndex to demux the audio. Encode the MPA file to AC-3 using the instructions on the next page of this guide. Since all of the other MPEG files will have to be sped up, they won't need demuxed with DGIndex.

Converting Audio With AviSynth

Although AviSynth isn't the best tool for speeding up audio to match a framerate increase, it's still good at it, and for the beginner an excellent starting point. There will basically be two steps in each script. The first will be opening the file. Since we want to get audio and video together, even for the remaining MPEG-2 files we'll use ffdshow, or some other DirectShow based MPEG decoder to accomplish this.

Opening The Files

Each file can be opened with the instructions in the AviSynth section. We're using DirectShowSource because we know it will deliver the audio with the video.

Restoring Film Frames

Our interlaced source files encoded at 29.97fps are actually 23.976fps progressive video with a telecine pattern used to duplicate fields. We'll need to use IVTC (Inverse Telecine) to return it to the original framerate. If we were doing this to prepare for video encoding we'd need to be careful of what settings we use. At this stage no video is actually being used, so the only important thing is to get to end up with the right number of frames playing at the correct framerate. Adding these lines to your script will accomplish this. Simply copy them from this guide and paste into AvsP:


Speeding Up

Next we'll need to convert the framerate to 25fps. This line, added to a script with 23.976fps progressive video, will speed it up approximately 4% and keep the audio in sync with the video by re-allocating samples:


Finally we need to resample. Compressing the audio into a shorter period also changes the samplerate. Since we need exactly 48kHz sampling, we'll need ot resample with this line:
There is one file this won't work for. The arctic giant has audio sampled at 44,100kHz (audio CD sampling), so the line for it will read as follows:

MP4 Files

Since the MP4 files (but not the M4V file) are already encoded at 23.976fps progressive, there's no need to IVTC them. Simply speed them up to 25fps and resample to 48kHz.


Once you have each source file loaded and converted, use VirtualDub as an external viewer to save the audio. Encode all the files to AC-3 using the instructions on the next page of this guide.

Sample PAL Scripts

Scripts for converting sources to PAL should look like these.

29.97fps Source

DirectShowSource("D:\Storage 3\Basic DVD Project\Cartoons\destruction_inc.mpeg", fps=29.97)

AssumeFps(25, sync_audio=true)

23.976fps Source

DirectShowSource("D:\Storage 3\Basic DVD Project\Cartoons\Superman-01-The_Mad_Scientist.mp4")

AssumeFps(25, sync_audio=true)
previous  | next

Table of Contents

  1. 1. Introduction
  2. 2. Preparation
  3. 3. Software
  4. 4. DGIndex
  5. 5. AviSynth
  6. 6. Demux
  7. 7. Encoding AC-3
Written by: Rich Fiscus