Adjusting the X264 Codec

Examples of quality and file size when using X.264 (H.264) codecs
Settings in Avidemux

X264 Profile (High and Simple Profile)

To prevent problems with software players I prefer using only those options of the X264 codec that are part of the Simple Profile.

In Avidemux just load the standard settings of the X264 codec and then disable the options marked below in the Partitions & Frames register.

The packing of video data in High Profile mode ist much more efficient, but most of the hardware players and some software players have problems when rendering the resulting video. The more the video is packed the more processor power you will need to play it.

Eigenschaften von X264 für Simple Profile
Properties of X264 for Simple Profile

Comprehensive guide for X264 parameter settings in Avidemux.org Wiki

X264 – Size and visual quality using different quantizer values in H.264

The quantizer influences file size in a very wide range. But it also influences visual quality of the resulting video.

Tho show the influence of different quantizer values I have rendered a small video test sequence. The results are displayed below. You can also watch the visual impact of the value.

The test sequence originates from a pixar comic. This pixar trailer had the sharpest picture of all of my DVDs. I have chosen a short part that also contains a scene cut. This sequence had been rendered with different quantizer values. All of the other parameters remained the same.
Audio track has been retained without further compression.

Statical visual quality has been documented by screenshots. You simply will detect differences when browsing through the screen shots (see below).
Temporal resolution has been evaluated while playing the sequence with 1/4 speed and step mode.

Using quantizers greater then 23 generated increasing motion blur. With values of 25 and above you can watch a stepwise rebuilding of scene cuts that took almost 0.5 seconds with a qunatizer of Q=30!

QRC File size Percent Visual quality Screenshot
original 36388 100% 100% VOB file of DVD (MPG with AC3 audio)
18 24857 68% Q18
20 20174 55% recommended when fast scene cuts Q20
22 50%
23prog 14684 40% small short motion blur at isolated places in the picture
adequate for videos with slow movements
Q23
23interl 8660 24%
25 11956 33% 0.3 s motion blur in scene cuts Q25
30 7703 21% 0.5 s motion blur in scene cuts Q30
35 5582 15% some block artefacts in scene cuts, median JPEG artefacts
slightly blurred but sufficient for documentations (VHS quality)
Q35
40 4676 13% Google Video quality, many block artefacts in scene cuts,
strong JPEG artefacts
Q40

File size and visual quality resulting from different H.264 quantizer values

As you can see with X264 you are able to compress videos in an extreme range. But with a quantization factor of 25 and greater the visual quality also suffers in an extreme range.

Live preview

Q=18
 

Live preview of visual quality: Move mouse cursor above the quantizer values to watch differences. Q=18Q=18
Q=18 maximum quality
Q=20Q=20
Q=20 high quality, very few differences
Q=23Q=23
Q=23 some croma blur
Q=25Q=35
Q=25 loss of details and croma blur
Q=30Q=30
Q=30 blurred image, slight JPG artefacts
Q=35Q=35
Q=35 very blurred, strong JPG artefakts, blocking in scene cuts
Q=40Q=40
Q=40 very blurred and many blocks

Saving X264 settings

You can save all Avidemux settings in a Project file. This is a plain text file that can be edited with any text editor. You can delete the blocks not needed only leaving the section with codec settings or the video filters section.

Avidemux will restore those settings when loading this project file.

X264 simple.js Avidemux project file containing the codec settings mentioned above and with a Quantizer Q=24

Source: sceen shots from a teaser of Antz (Pixar)