Choosing a Video Codec

Choosing which codec to use when creating your Virtual CRASH animation can be an important decision. In this post we'll review the pros and cons of a few choices.

Ideally, you should render all animations in “Full Frames” mode, but often this is impractical due to (1) the output file size which often must be compressed using ffmpeg or some other application, and (2) the often-quoted file size limitation of avi files of 2 GB. Above 2 GB, most video players will not play avi files or will play them with errors. 

The best way to see if you’re going to run into the 2 GB file size issue is to do a test animation in “current” mode, which will finish much faster than direct light or skylight. The avi file size will depend only on your screen size and length (number of frames), so don’t worry about sumpersamples yet. If you can afford the disk space, and you’re not close to the 2 GB output file size, then rendering in full frames is going to be your best option. You’ll probably want to reduce the file size afterward using something like ffmpeg (see this vCRASH Academy Blog post) or Camtasia. 

If you find your test animation is too large, then you’ll need to use a codec that compresses the output. We love (love) the Xvid codec. Xvid uses lossy compression but can compress your avi files by more than 200x! This can make it unnecessary to post-process your files since they’ll be so much smaller. Xvid is very easy to download and install. Go to: Press, "Get the Xvid Codec". Finally, just download the Windows version. 

Here we see a single frame of a daytime pedestrian impact animation rendered in both Full Frames and Xvid, where we’re toggling between them. It’s evident that there’s very little loss of quality in the Xvid rendering; however, the Full Frames version is about 3.6 MB per frame (at 1280 x 720 HD) versus an incredible 17 KB for Xvid! 

The big challenge with codecs that use some type of compression (lossy or losses) is how they handle regions of rapidly changing color values. This can make things more complicated for night time scenes. For example, let’s look at our same scene, now rendered with Full Frames, Xvid, and Intel IYUV. The differences may be subtle for a single frame, but can become very noticeable in a full video sequence. 

Here, we zoom in on the Full Frames video. Note the smooth color gradients. 

Next, let's example Xvid. Notice the pixelated effect. The individual blocks of similar color are easier to see in dark scenes. 

Finally, let's look at Intel IYUV. Here we see bands of similar color in the transition areas from light to dark, but without the cluster effect of Xvid. 

It’s always best to do test renders at smaller size and supersample size to best find the optimal solution for your animation. Scroll down to the bottom of this Wikipedia article to see comparison of the various codecs. 

Crash Animation Studios