14.4. Encoding with the Xvid codec

Chapter 14. Encoding with MEncoder

14.4. Encoding with the Xvid codec

Xvid is a free library for encoding MPEG-4 ASP video streams. Before starting to encode, you need to .

This guide mainly aims at featuring the same kind of information as x264's encoding guide. Therefore, please begin by reading of that guide.

14.4.1. What options should I use to get the best results?

Please begin by reviewing the Xvid section of MPlayer's man page. This section is intended to be a supplement to the man page.

The Xvid default settings are already a good tradeoff between speed and quality, therefore you can safely stick to them if the following section puzzles you.

14.4.2. Encoding options of Xvid

14.4.3. Encoding profiles

Xvid supports encoding profiles through the profile option, which are used to impose restrictions on the properties of the Xvid video stream such that it will be playable on anything which supports the chosen profile. The restrictions relate to resolutions, bitrates and certain MPEG-4 features. The following table shows what each profile supports.

Simple Advanced Simple DivX
Profile name 0 1 2 3 0 1 2 3 4 5 Handheld Portable NTSC Portable PAL Home Theater NTSC Home Theater PAL HDTV
Width [pixels] 176 176 352 352 176 176 352 352 352 720 176 352 352 720 720 1280
Height [pixels] 144 144 288 288 144 144 288 288 576 576 144 240 288 480 576 720
Frame rate [fps] 15 15 15 15 30 30 15 30 30 30 15 30 25 30 25 30
Max average [kbps] 64 64 128 384 128 128 384 768 3000 8000 537.6 4854 4854 4854 4854 9708.4
Peak average over 3 secs [kbps] 800 8000 8000 8000 8000 16000
Max. B-frames 0 0 0 0 0 1 1 1 1 2
MPEG quantization X X X X X X
Adaptive quantization X X X X X X X X X X X X
Interlaced encoding X X X X X X X X X
Quarterpixel X X X X X X
Global motion compensation X X X X X X

14.4.4. Encoding setting examples

The following settings are examples of different encoding option combinations that affect the speed vs quality tradeoff at the same target bitrate.

All the encoding settings were tested on a 720x448 @30000/1001 fps video sample, the target was 900kbps, and the machine was an AMD-64 3400+ at 2400 MHz in 64 mode. Each encoding setting features the measured encoding speed (in frames per second) and the PSNR loss (in dB) compared to the "very high quality" setting. Please understand that depending on your source, your machine type and development advancements, you may get very different results.

Description Encoding options speed (in fps) Relative PSNR loss (in dB)
Very high quality chroma_opt:vhq=4:bvhq=1:quant_type=mpeg 16fps 0dB
High quality vhq=2:bvhq=1:chroma_opt:quant_type=mpeg 18fps -0.1dB
Fast turbo:vhq=0 28fps -0.69dB
Realtime turbo:nochroma_me:notrellis:max_bframes=0:vhq=0 38fps -1.48dB

14.3. Encoding with the libavcodec codec family 14.5. Encoding with the x264 codec