Compressing to H.264 using Zarx264gui

Note: The version of Zarx264gui currently in the AMVapp is buggy. You can download the latest one here.

Introduction

Zarx264gui is a program designed to make encoding to H.264 extremely easy. It is designed with AMVs in mind, and is only available in the AMVApp. Zarx264gui requires you to have the Microsoft .NET framework installed, and if you want to encode audio, you will need the nero AAC encoder. Both of these things should also be installed along with the AMV App, but if something went wrong with the installation, here are some problems you may want to look out for:

1. Ensure that the Microsoft .NET framework version 2.0 or later is installed on your PC.

Zarx264gui requires .NET in order to run. The easiest way to determine if you have it installed is to try running Zarx264gui. If the program opens, then you have it installed already. However, if you get a cryptic error message, then you will need to download and install the .NET Framework. You can get it here.

2. You need the Nero AAC Encoder.

The Nero AAC encoder is a free, high-quality AAC audio encoder that will allow you to compress your audio from within Zarx264gui. Because of the license this software is released under, the encoder could not be directly included in the AMVApp, but the AMVApp will attempt to download and install it automatically. If it failed to install properly, then you should see a message in the program stating that the Nero AAC encoder is not installed. If you see that message, then it can be downloaded here.

After clicking the link, you need to click on the word "Agree" to start the download. It will prompt you to save a file called "NeroDigitalAudio.zip". Save this archive to your computer, and then unzip the file called "NeroAacEnc.exe". You need to place "NeroAacEnc.exe" in the same folder that Zarx264gui is located. The default location is ~/Program Files/AMVApp/H264 Tools/


Using Zarx264gui

You can start Zarx264gui by going to AMVapp > H264 Tools > Zarx264gui from the Start Menu. If you see an error message upon trying to start it, or if you see a link saying that the Nero AAC Encoder is not detected, you need to see the two points noted above. If everything is set up properly, you should see a window that looks like this:

Loading Files

The first thing you need to do is load your input video. Zarx264gui only accepts AviSynth scripts. If your AviSynth script contains audio, it will automatically be loaded as well. If you exported your audio from your editing program as a wav file, you can load it instead. You also have the option of loading an MP3 or AAC audio file. In this case, the MP3 or AAC audio will simply be copied instead of re-encoded. Lastly, you want to specify where to save your output MP4 file to.

Now, Zarx264gui is set up so that all you really need to do is press the encode button, and you will get a great encode without having to really mess with anything. Of course, there are a few settings available that we can tweak, and it's a good idea to learn about them, so let's take a look at what they can do:

Mode

The mode setting lets you select one of three different encoding modes--Bitrate, Constant Quantizer, and Constant Quality. Constant Quality is the recommended setting here. What is the difference between these three modes? Well, let's see.

Bitrate: This mode lets you specify a bitrate at which to encode the video. This is the only mode that allows you to estimate how large the output file will be, so if you need your file to be a specific size, then this is the mode that you should select. If hitting a particular filesize isn't important to you, then you should definately go with Constant Quality instead of this. The main downside of using the bitrate mode is that you will typically need to do 2 passes in order to maximize the quality.

Constant Quantizer: This mode works by encoding every frame of the video at a particular quantizer. In simple terms, the quantizer determines how much detail is removed from the image. Lower quantizers will result in less detail being lost, but the filesizes will be larger, and higher quantizers mean more detail will be lost, but filesizes will be lower. Because this mode encodes every single frame at the same quantizer, it typically results in rather inefficient encodes. You shouldn't use this mode unless you have a specific reason for doing so.

Constant Quality: The constant quality mode works similarly to the constant quantizer mode, but it is MUCH better. Rather than encode every frame to the same quantizer, this mode allows for a bit of variation. Some frames might be encoded with a slightly higher quantizer, and some with a slightly lower quantizer. In practice, this results in smaller files than using Constant Quantizer mode, but at similar visual quality. This is the mode you should normally use.

Quantizer/Bitrate: This setting is basically a trade-off between visual quality and filesize. If you are using bitrate mode, then you simply set the bitrate that you want to encode your video at. Higher bitrates increase the size of your output file, and you can see the estimated filesize as you modify the bitrate value. If you are using either constant quantizer or constant quality mode, then this is where you select the quantizer to use. Valid values are from 0-51, with lower values giving better quality, but larger filesizes. A quantizer of 18 is generally considered the lowest that you should select, as it's unlikely that you will see much visual improvement by going any lower. For those of you familiar with Xvid, a quantizer of 18 here is equivalent to Xvid's quantizer 2. The default quantizer value is 20, which gives a rather decent tradeoff between quality and size.

Audio Bitrate: This sets how much bitrate will be given to the audio. If you loaded an MP3 or AAC audio file, then this setting will not be available. Higher bitrates result in better audio quality. The default of 128 is recommended. Audio is encoded into the AAC format, which is more efficient than MP3.

Passes: This setting is only available when you are using the bitrate mode. Extra passes will basically multiply the total encoding time. For instance, two passes will take twice as long to encode as one pass, and three passes will take three times as long to encode as 1 pass. Doing more passes will help boost the visual quality, and helps you hit the target filesize more closely. It is recommended to do two passes, as a third pass usually doesn't bring much, if any, improvement.

Those of you who are familiar with encoding with codecs such as xvid, where you routinely encode using two passes, might be thinking that a 2 or 3 pass encode using the Bitrate mode would be better than a 1 pass encode using Constant Quality. In practice however, the Constant Quality mode produces output with quality that is equivalent to a multi-pass bitrate-based encode. For this reason, it is simply a waste of time to use multiple passes, unless you need to hit a target filesize.

Insane Settings: Selecting this checkbox will turn on some settings which will significantly slow down the encoding, but gives you a small boost to quality. In most of my tests, this results in about a 5% boost to quality, but takes 3-4 times longer to encode. The difference in quality isn't huge, so it really just depends on whether you want to spend the extra time or not.

Normalize: Checking this box will normalize the audio. This option is not available if you loaded MP3 or AAC audio.

Advanced Settings

Deblocking: This helps to reduce the appearance of blocks in your encode. It is recommended to leave this at the default value. Some people have suggested that values as high as 3 might be good for anime, though.

Use Multithreading: If you have multiple processors, or a multi-core processor, you can enable this for a nice speed boost. This setting can potentially reduce quality (or increase filesize) by a small amount, but it is typically negligable, considering the speed increase that you can get.

Limit Min Quant to 18: This is only activated when you are using the bitrate mode. It is basically just a safeguard so that if you set the bitrate too high, it won't waste unnecessary bits. This setting can cause undersized files.

Sample Aspect Ratio

The sample aspect ratio is different from a pixel aspect ratio or a display aspect ratio. The sample aspect ratio defines a ratio by which your video will be stretched on playback. Because it can be slightly difficult to calculate, you can select a target display aspect ratio from the drop down box, and the appropriate sample aspect ratio will be automatically filled in.

I strongly recommend that you use this feature if your source was 16:9 anamorphic footage. Instead of having to resize your video to a large 16:9 resolution like 848x480, you can instead keep it at the DVD resolution of 720x480, and it will be stretched to the proper aspect ratio on playback. This will result in smaller filesizes, and will allow your video to be played on slightly weaker PCs, to boot.

Command Line

For advanced users, this allows you to view the commandline settings that are used to encode your video, and you can also select to save a batch file, so you can modify the settings manually.

Zarxrax - September 2006