Avi Mode

divx

in this mode encode2mpeg creates an avi file with MEncoder. The output video stream is mpeg4 or a copy of the input video stream, the output audio stream can be mp2, mp3, ac3, pcm  or a copy of the input audio stream.  This mode is selected with the options: -avionly -encode.
The argument of -encode selects the different audio/video encode options. It has the form n:m:i[,b]

n can be:
0 - copy of the input audio stream (-oac copy)
1 - pcm audio stream (-oac pcm)
2 - mp3lame fast (-oac mp3lame -lameopts fast)
3 - mp3lame standard (-oac mp3lame -lameopts preset=standard)
4 - mp2/libavcodec (-oac lavc -lavcopts acodec=mp2:abitrate=224)
5 - mp3/libavcodec,cbr (-oac lavc -lavcopts acodec=mp3:abitrate=128)
6 - ac3/libavcodec (-oac lavc -lavcopts acodec=ac3:abitrate=192)
7 - mp2/toolame (-oac toolame -toolameopts br=224)
8 - aac/libfaac (-oac faac -faacopts br=96)
Note: the audio bit rate can be specified in two ways: with the options -abr or with a comma and the bitrate as part of the -encode argument.
-encode 5:1:1,128
 or
-encode 5:1:1 -abr 128
are equivalent in Avi Mode

m can be:
0 - copy of the input video stream (-ovc copy)
1 - libavcodec/mpeg4 (-ovc lavc -lavcopts vcodec=mpeg4:autoaspect:vbitrate=16000:psnr)
2 - as 1 + mbd=2 (mbd=2:keyint=300)
3 - as 1 + compression options (mbd=1:vmax_b_frames=2:last_pred=5:aic:mv0:vlelim=-4:vcelim=7:v4mv:preme=2:keyint=300)
4 - as 1 + quality options (mbd=2:trell:v4mv:mv0:aic:last_pred=5:precmp=3:cmp=3:subcmp=3)

i can be 1, 2 or 3 and select the number of encoding pass.

Other options useful in Avi Mode:
-vfr or -ofps (output frame rate)
-multiaudio (avi with more than one audio stream, you need avimerge)
-monochrome
-avisplit (split the avi in chunk of fixed size, you need avisplit)
-bframes (number of B frames)
-vbr (video bit rate)
-cbr (force the use of constant bit rate video encoding)
-vcustom (custom video lavc options, used if m = 1)
-acustom (custom audio options: used if n = 2, mp3lame, or n = 8, libfaac)
-usesbr (set the size of the avi file)
-setaspect (scale the video and keep the correct aspect ratio)
-overscan <n> (add n% black border)
-rotate <n> (rotate the video)
-crop <w:h:x:y> (crop window)
-autocrop (autodetect the crop window)
-interlaced (use it if your source video is interlaced)
-cartoon (use it if your source video is a cartoon/anime)
-fixavi (fix seek or fast forward)
-fixasync (use a different encoding sequence that should avoid a/v sync problems with vbr mp3)
-cpu <1-8>
-channels <1-6> (select the number of channels in the avi audio stream, mp2/mp3 can have 1-2 channels, ac3/lpcm 1-6 channels)
-qmatrix (select kvcd or tmpgenc quantization matrices)
-turbo <0|1> (disable or force turbo mode)
-hispeed (increase the encoding speed of 25-50%, the final file will be bigger and will have lower quality)
-vcodec <mpeg1|mpeg2|mpeg4|xvid> (force the selected video codec)
-normalize (normalize to the audio stream using MPlayer's audio filter volnorm)
-burniso/-burnudf (put the avi stream on a DVD disk in a iso/udf filesystem)
-verify (verify the content of the burned DVD disk)
-profile <profile name> (select a DivX or MPEG-4 profile)
-txtsub <file name> (convert a text subtitle)
-txtsubopts <options> (subtitle conversion options)

Hint

Avi Mode is meant to be used for storage purpose. For example you have a DVD movie and you want to reduce the disk space required. You can have different goals: speed, high compression, high quality. In all cases I wanted to preserve in the avi video as much as possible the quality of the source video and then I set the video bitrate of the mpeg4 stream very high: 16000. As you will see later, putting a limitation on the video bit rate has a bad impact on the PSNR more than using other libavcodec options. So it is always better to leave it very high, unless your have no other choises and you have to reduce it (for example for a fixed size file or if the video bit rate exceed the capability of your hardware player).

Comparison

See TABLE 1 for a comparison of some -encode combinations.
See TABLE 2 for a comparison between different number of B frames with -encode 3:3:2.
See TABLE 3 for a comparison between different -encode and -setaspect optiond with -usesbr 2 (1 CD file size).
See TABLE 4 for a comparison between different -encode and -setaspect optiond with -usesbr 5 (2 CD file size).

Threads

encode2mpeg takes advantage of systems with multiple cpu. It uses as many threads as the number of cpu present. See TABLE 5 for a comparison. You can specify explicitely the number of threads (up to 8) with -cpu <n>. Linux 2.4.x has poor support for hyperthreading cpu. Because of that, on systems with kernel 2.4.x, one physical cpu and hyperthreading turnded on, the default is to use only one thread. You can override it with -cpu 2.

Examples

encode2mpeg -o fastonecd dvd://1 -aid 128 -avi -encode 3:2:2 -usesbr 2 -setaspect 4
encode a dvd to a 700MB avi with fast 2 pass mode with resolution 384x224. Log file.

encode2mpeg -o divx dvd://1 -multiaudio 128,129 -avi -encode 0:4:2 -encsid 0,2,4 -encsdx 0,1,2 -encsla en,fr,es
encode a dvd with the best quality keeping two ac3 audio streams and dumping three subtitles. Log file.

Top