AnimeMusicVideos.org > Guide Index
Compressing to H.264 using Zarx264gui
The H.264 standard is the best video compression technology available today, and it has a free implementation through the great x264 codec. However, compressing to H.264 properly has typically been a fairly complex proceedure, so in order to encourage more people to use it, I wrote a program called Zarx264gui which makes the entire process extremely simple.
Zarx264gui is designed with AMVs in mind, and is available in the AMVApp, but you can always find the most up to date version here. Zarx264gui requires you to have the Microsoft .NET framework installed. If you have Windows Vista or better then you already have .NET, but if you are running Windows XP then you may need to download it seperately. 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.
When you start up Zarx264gui, you should see a window that looks like this:
The first thing you need to do is load your input video. Zarx264gui only accepts AviSynth scripts. However if you try to load a normal media file, Zarx264Gui will automatically generate an avisynth script for you. 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 in the second box. 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:
The mode setting lets you select between two different encoding modes--Constant Quality, and Bitrate (2 pass). Constant Quality is the recommended setting here. What is the difference between these modes? Well, let's see.
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 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 15-16 is generally considered the lowest that you should select, as it's unlikely that you will see much visual improvement by going any lower. The default quantizer value is 20, which gives a rather decent tradeoff between quality and size.
Audio: The first box here lets you change between quality based encoding, and bitrate based encoding. The quality-based setting is recommended. The 2nd box lets you specify that quality or the bitrate that you will encode at. Higher values result in better audio quality (but larger size). The default values are recommended.
Preset: The options here basically give you a quality versus speed tradeoff. The default setting is "very slow" which is obviously very slow, but will give you great quality. The "placebo" setting will make things MUCH slower for very little gain, so it's not usually worth using. If you need to make a quick encode for yourself or just to show a friend, you might want to use one of the faster settings. For making your final distrubution copy though, you definitely want to go with "very slow".
Tune: This setting will tune the encoder for different types of content. The default is "Animation", which is ideal for the majority of AMVs. "Film" is intended for live action films, but can also help retain grain and details if your AMV has a lot of noise. The "grain" setting is intended for sources that have extremely heavy film grain or noise.
Normalize: Checking this box will normalize the audio volume.
The settings here are mostly recommended for people who know what they are doing. If you don't understand a setting, then you probably shouldn't mess with it. Changing the "Tune" setting on the first tab will modify some of the settings here.
Deblocking: These two settings can help to reduce the appearance of blocks in your encode. Setting them both to 1 can be good for anime. In general higher values make the video more smoothed and blurry, while lower values make it sharper, but more tendency to block.
Variance AQ: This is the strength of the adaptive quantization, which will compress some parts of the frame more heavily than others. In general this tends to help quality, but sometimes it might look better with a smaller value, or turned off altogether. The "auto-variance" setting is an alternative that you might wish to try.
Psy-RDO: The RD and trellis options here are additional adaptive quantization settings. RD can be helpful at very low values, but the trellis is almost always bad for anime. These options can help preserve noise and grain, so if you video contains a lot of noise then you may want to play with them some. They may also be very helpful on live action video.
Sample 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 manually, you can select a target display aspect ratio from the drop down box, and the appropriate sample aspect ratio will be automatically filled in.
Fade Compensation: This setting will increase the bitrate allocated to scenes that have fades. Some people experience poor quality or blocking during these types of scenes, so this setting can help to remedy that. In general, I wouldn't use this unless you specifically notice a problem with fades. 0.6 seems to be a good value for this.
Display PSNR/SSIM stats: This will just display the PSN and SSIM after the encoding is completed. If you don't know what those are, then you don't need to use this setting!
Only Use Keyframes: x264 could potentially make a good editing codec, if your editing application lets you load MP4 files natively. In such a case, you would want to make sure that all of the frames are keyframes. I've never actually tried editing like this, so it might not work well. For the most part though, you should never need this option.
Level: This setting can restrict certain aspects of the encoder in order to meet the requirements of certain types of devices. If you set this to "4.1", then your videos should be playable on an Xbox360 or a PS3. 4.1 also happens to be the level that Blu-ray video uses. If you would like your encodes to be compatable with an iPhone or iPod, you can select the "3.0 / Baseline" setting here. But that setting will SEVERELY impact the quality of your encode. Also, note that the iPhone/iPod can't handle large resolutions. Finally, this setting is not guaranteed to make your video compatable with any particular device, it will just make a best effort at restricting itself.
For advanced users, this allows you to view the commandline settings that are used to encode your video, and you can also specify custom commandline parameters here.