Thursday, September 18, 2008

MEncoder - crf - qp - bitrate usage examples

MEncoder Sherpya-SVN-r27323-4.2.4 (C) 2000-2008 MPlayer Team

CPU: Intel(R) Core(TM)2 Duo CPU     T9300  @ 2.50GHz (Family: 6, Model: 23, Stepping: 6)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1


constant quantizer:

MEncoder.exe -sws 9 -vf crop=640:272:0:0,scale -ovc x264 -x264encopts frameref=6:bframes=3:me=3:subq=7:brdo:deblock:deblockalpha=0:deblockbeta=0:bime:b_adapt:cabac:b_pyramid:weight_b:mixed_refs:chroma_me:trellis=1:i4x4:i8x8:8x8mv:b8x8mv:4x4mv:8x8dct:nopsnr:qp=22 -oac mp3lame -lameopts cbr:br=96:aq=0 -noskip -priority belownormal -of avi -o "x264.avi" "hn.avi"



constant quality:

MEncoder.exe -sws 9 -vf crop=630:270:10:0,scale -ovc x264 -x264encopts frameref=6:bframes=3:me=3:subq=7:brdo:deblock:deblockalpha=0:deblockbeta=0:bime:b_adapt:cabac:b_pyramid:weight_b:mixed_refs:chroma_me:trellis=1:i4x4:i8x8:8x8mv:b8x8mv:4x4mv:8x8dct:nopsnr:crf=22 -oac mp3lame -lameopts cbr:br=96:aq=0 -noskip -priority belownormal -of avi -o "x264.avi" "hn.avi"


constant bitrate, 1st pass:

MEncoder.exe -sws 9 -vf crop=640:272:0:0,scale -ovc x264 -x264encopts frameref=6:bframes=3:me=3:subq=7:brdo:deblock:deblockalpha=0:deblockbeta=0:bime:b_adapt:cabac:b_pyramid:weight_b:mixed_refs:chroma_me:trellis=1:i4x4:i8x8:8x8mv:b8x8mv:4x4mv:8x8dct:nopsnr:bitrate=700:pass=1:turbo=1 -nosound -noskip -priority belownormal -passlogfile "D:\m\jd\data\Achterbahn.x264.avi.stats" -of avi -o "x264.avi" "hn.avi"




constant quality and bitrate:

mencoder -ovc x264 -x264encopts crf=18:subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:threads=auto:bitrate=700 -oac copy -o 18-700.avi "-XviD.avi"


MEncoder264 v1.1.9



-qp means : give me the quality I asked for, no matter how many bits it needs (same quantizer for all frames).
-crf does the same, but instead of choosing a quantizer for each frame, it determines a "visual perception" factor (based on the initial QP you specified), and once again, it means "give me the visual quality I asked for, no matter how many bits it needs".



What's the difference between Constant Quantizer and Constant Quality

These two modes are variations on the generic idea of "unknown filesize/bitrate, known quality" where the encoder aims to encode to a specified quality level. This is opposed to the normal "known bitrate/filesize, unknown quality" model where the encoder is given an average bitrate and must produce the best file possible with that. The advatage of the former is obviously that the quality can be precisely set, while the latter allows precise filesize control. Which one is right for you is your decision. Note that a 2pass encode to the same bitrate will look better.

In x264, there are two modes of "known quality", Constant Quantizer (CQ) and Constant Quality (aka CRF, Constant Ratefactor).

* Constant quantizer: every frame is encoded with a mathematically identical quantizer. Constant quantizerproduces a file that for the x264 program is of perfect constant quality (it would be 'interpreted' in a similar fashion by other video encoder programs).
* Constant quality (aka constant rate factor): the video is encoded to a nominal quantizer, but the encoder varies the quantizer on different frames to give a higher percieved quality for human eyes. The output will be the same size as a CQ encode, but it will look subjectively better to humans and is therefore generally the more used of these two modes.










No comments: