Creating MP4 files - ISO compliant MPEG-4 streams with AAC audio

By now, many DVD players are capable of playing MPEG-4 video. The support usually only extends to the AVI container, but Nero is trying to push their NeroDigital technology into the market - and NeroDigital uses the full feature set that the MPEG-4 technology can offer: video, audio and the container. Please note that while MPEG-4 AVC content can also be created by NeroDigital, and put into the MP4 container, at this point there is no DVD player available that can play this - but there will be in the future.

Today, both MPEG-4 video and audio encoders are readily available, and I assume you know how to create such content. If not, have a look at the XviD, DivX, NeroDigital and x264 guides. Similarly, there's a guide for AAC audio encoding, and there are many other AAC encoders, like faac, or QuickTime/iTunes.

You will need the following software for this guide:

YAMB
MP4Box
Haali's media splitter

Step 0: First time setup

Extract YAMB using WinRar or 7Zip, then copy the mp4box executable to the YAMB directory. Then start up YAMB and go to the Options tab.

If you like to keep mp4box at another place, you can configure the location here.

Checking View or Edit Commandline will show the mp4box commandline YAMB generates for each option, and allows you to edit that commandline.

Overwrite an existing output file forces mp4box to write a new file each time. If not checked, if your desired output file already exists, mp4box will add streams to it, rather than overwriting it.

If you'd like to have additional information from mp4box, check View Extra Info when MP4Box is running. This can be useful for finding the cause of an error.

Step 1: Encode video

Please follow one of the abovementioned guides to encode your video. As a better alternative, you can use my very own MeGUI for encoding. You can set it to produce a raw file, which is best for what we're going to do.

Step 2: Encode the audio

Please follow the abovementioned guide to create an AAC audio file. You can also use the audio encoding facilities in MeGUI (I know I should write a guide, but I also have to develop).

Step 3: Extract subtitles (optional)

Currently, you can add text based Subtitles to MP4 files. You can use SubRip to extract subtitles from VOB files / VobSub subtitles. NeroDigital uses the VobSub format, which is not officially supported in MP4 - but since NeroDigital is the main driver for MP4 support in standalones, it is likely that this subtitle format will be widely supported.

Step 4: Extract chapters (optional)

I strongly suggest that you enable chapter extraction while ripping (in DVD Decrypter go to the Settings, IFO Mode, and check Chapter Information - OGG). Alternatively, you can use ChapterXtractor to get a chapter file on Ogg format.

Step 5: Unpack AVI (optional)

If you have created x264 content in an AVI, then you'll have to perform this step. Mp4box cannot import AVC content in AVI directly.

Start up YAMB, go to the Extract tab, and load your x264 AVI file. Check Extract, then press the Extract button to process with the extraction.

YAMB will put the extracted file into the same directory as the source file. Rename the file so that it has an extension of .264. If your AVI file contains audio tracks, you can also extract them by using the extract dropdown, but note that MP4 only supports AAC audio. While you can put certain additional audio types into an MP4 (MP3 and Vorbis), hardware players will most likely not be able to play the audio track in such files.

Step 6: Multiplex

If you haven't already done so, start up YAMB and go to the Mux tab. Alternatively, you can use MeGUI, which currently offers more features, but doesn't support non-AAC audio.

Load a Video source. If you have performed step 3, the source is your .264 file, otherwise it may be an AVI generated in Gordian Knot, an .m4v file generated in MeGUI or even an MP4 file.

Then add all your audio tracks. Note what I've previously mentioned: you can add MP3 and Vorbis audio tracks, but hardware players will most likely not play those as the MP4 container doesn't support non AAC audio.

If you have subtitle files in the proper format, you can also add those, as well as a chapter file.

Once you have added all desired streams, press Mux to start the multiplex process.



Step 7: Splitting

Finally, you may want to split your MP4 file into CD sized chunks. To do this, go to the Splitting & Joining tab in YAMB.

Select your input file, check Split by Size, enter the desired split size, and press Split.

Step 6: Multiplexing using MeGUI

I will explain MeGUI's complete feature set in an upcoming guide. For now, just copy mp4box.exe to the MeGUI directory, then start it up and press Control-4 to enter the MP4 muxer:

Then configure all your input streams. As you can see, you can assign a language for each stream, and you must assign a framerate because only RAW input is supported (that means you have to perform step 5 even with MPEG-4 ASP content).

You can also split at the same time as muxing.

When done, press Queue. Depending on your settings, muxing will start immediately. If it doesn't go to the Queue tab, and press Start.



This document was last updated on February 5, 2006