From time to time I need to rip a DVD, due to my fascination with
compression I'm interested in knowing about how they work and
which codec is the best. I began looking for a visual
comparison between XviD and X264 and couldn't find anything
so I thought it would be fun to create my own comparison.
In the encoding community a PNSR represents the mathematical
measurement for how much loss occurs during encoding, and there
are plenty of ways to automate this analysis but I am more interested in
how things look visually once decoded.
Normally if I had some encoding to do I would simply open
up AutoGK but I've had
issues with XviD at low bit rates which made me interested in comparing
it to newer alternatives. XviD is an MPEG4ASP compliant
encoder, which many consider to be the best ASP codec. There is
another profile in the MPEG4 spec however called AVC
which HD-DVD and Apple's QuickTime use. For
testing MPEG4 AVC I decided to use the wildly popular X264 which is
distributed as a command line tool that takes AVISynth input and
outputs MP4 files. AVC has advanced compression algorithms that go
beyond what ASP offers, and XviD generally suffers from the constraints
of the commonly used AVI container for things like encoding B-frames.
For this test we will be comparing the output from AutoGK with X264
using the same AVISync script to keep the sources consistent. For
X264 I will be using a 2 pass encoding with the same target bit rate for 1400 MB,
and reasonable settings for encoding speed and quality. QuickTime does not support AVC features such as b-pyramids or
8x8dct so these were dropped, and I've kept B-frames to a modest amount.
This film has an aspect ratio of 2.35 so there is a decent amount
cropped out of the original. The bit-rate for this encode was about 1800kbs.
I chose this particular scene because the motion of the water makes it
difficult to encode when combined with the film grain.
Both codecs do a great job, but in frame 9873 with XviD
you can see macro blocks on Lara's face.
This film is 16:9 native which stretches the birate. At first glance the XviD encode actually
has more detail, but when you enlarge you can see significant macro
blocking in some areas.
It won't shock anyone that AVC in an MP4 container is
better than ASP in AVI.
The images above at least provide a rough reference point for how
much better the quality you can expect between the different
mpeg4 profiles encoding the same content. This article doesn't explore
all the sophisticated options and profiles of the AVC codec so it's intended
for education only. It's also worth mentioning that AVC encoding is slower by
nearly a factor of 10x compared to ASP, obviously you are not getting 2x the quality for