Encode your video in H.264

After you create an animation, you should consider encoding another version using H.264 and AAC. You get great-quality video and audio and incredibly small filesizes, and the file will play on QuickTime, MPlayer, VLC, or Windows Media Player (WMP may need extra codecs). This guide uses only open-source software. You will not be asked to download some 30-day shareware trial or pay money for something that can be done for free. These programs are very useful and versatile; you may find them useful in future projects.

Preparing your source files

You probably know that when producing an animation, all of your renders should be stored losslessly, usually as individual frames. This guide assumes that you have already edited, cut, and mixed your video into a video file, such as an AVI. For the sake of this guide, I will call this animation.avi. Personally, I recommend the lossless Huffyuv codec, which is freely available for Windows. It is simple, fast, and a good intermediate codec.

Also, you'll want to render your audio separately as a lossless WAV file. The video and audio will be muxed together later so they should sync up. This method allows you to have multiple audio tracks (perhaps you have different languages) for a single video stream. I'll call this audio stream animation.wav.

Installing the necessary software

MeGUI

MeGUI is a nice GUI for encoding video. Grab the MeGUI installer from SourceForge and install it. When it first runs, it will update itself—grab all the presets it offers—and it will ask you to install AviSynth (which does the actual processing).

AviSynth

AviSynth is a very flexible scripted frameserver for post-production processing, and it is what powers MeGUI. This guide uses the 2.5-stable version of AviSynth from SourceForge.

YAMB

YAMB is a GUI for MP4Box, which is used to mux the audio and video into an MP4 container. MeGUI might be able to do this itself, but I don't trust myself to experiment. Regardless, the file that MP4Box produced was playable by QuickTime, and that validates it in my eye.

Encode the video

Video

Open up MeGUI. It doesn't work on a straight input file, but rather on AviSynth scripts. Go to Tools→AVS Script Creator. Set Video Input to your raw animation.avi video. It will preview it for you to make sure it's reading it correctly. Go to the Edit tab and add ConvertToYV12() to a new line at the end of the script. Save the script as animation.avs.

If you don't have this so-called x264 Unrestricted 2pass balanced preset, just use the default x264 settings with 2pass encoding turned on and the bitrate of your choice.

Hit that Enqueue button.

Audio

Audio is more straightforward. For Audio Input, choose your uncompressed animation.wav file. For the extension, choose Raw-AAC. Choose an output file name like animation.aac. For the encoder settings, choose FAAC and Config it with ABR and a bitrate of 128.

Hit that Enqueue button.

Encoding

Your jobs are now queued up to be processed. On MeGUI's Queue tab, look at the list. There should be three jobs: two video passes and the audio encoding. Run the jobs with the Start button at the bottom, and wait for them to run.

Muxing the MP4

Now that you have your nicely-encoded animation.264 and animation.aac files, it's time to put them together in a container format. AVI, MOV, MKV, etc. are all container formats that can store (sometimes multiple) video tracks and audio tracks, each track encoded in any variety of codecs. You could put H.264 video and AAC audio in an AVI, but it's not recommended. MP4 is a popular container nowadays for, well, MPEG-4 video. It's flexible and open and supported by QuickTime.

YAMB is specifically for muxing MP4s. Open it up and pick the first option, Click to create an MP4 file …. Add in your animation.264 and animation.aac files. Right-click the video file and and go to Properties. Set its frame rate (29.97, 24, and 30 are common framerates). Choose an output file, like animation.mp4. Next. Processing is relatively quick because it only needs to combine the two files without doing any encoding or decoding.

Try opening up your shiny new MP4 in QuickTime. Additionally, if your video has the dimensions 1280 by 720, many video sites such as YouTube and Vimeo will create a 720p encode of your video. This offers your viewers to watch your video in high-definition with the ease of an embedded Flash interface.

All contents are © 2005-2009 Xedium3D.com. You may not reproduce or distribute the content within unless otherwise noted. Xedium3D.com hereby disclaims all liability for provided content.