通用选项
列出所有选项:mencoder −list−options
不加载配置文件:−noconfig system/user/gui/all
加载不同的profile:−profile my-profile
显示所有定义的profile:-profile help
显示某个指定profile的内容:-show-profile myprofile
现实很少的输出信息:−really−quiet
Demux/Stream选项
指定结束时间或位置:−endpos<[[hh:]mm:]ss[.ms]|size[b|kb|mb]> (also see −ssand −sb)
指定帧率:−fps <float value>
指定从开始起转换的帧数:−frames<number>
DECODING/FILTERING OPTIONS
强制宽高比:−aspect <ratio>,例如−aspect 4:3 or−aspect 1.3333
不编码音频:−nosound
不编码视频:−novideo
指定软件scaler的参数:−ssf<mode>,例如−vf scale −ssflgb=3.0
lgb=<0−100>
gaussian blur filter (luma)
cgb=<0−100>
gaussian blur filter(chroma)
ls=<−100−100>
sharpen filter (luma)
cs=<−100−100>
sharpen filter (chroma)
chs=<h>
chroma horizontal shifting
cvs=<v>
chroma vertical shifting
立体声输出模式: −stereo<mode>软件缩放算法选择:−sws <softwarescaler type>,该选项指定了使用-zoom时,进行软件缩放的算法。
缩放比例设定:−xy <value>,value<=8时表示缩放比例,value>8时表示宽度,高度按比例计算得到。
-y <value>:指定高度而不是宽度
启用缩放:−zoom
VIDEO FILTERS
显示所有的视频滤波器:-vf help
一般用法:−vf<filter1[=parameter1:parameter2:...],filter2,...>
crop[=w:h:x:y]
cropdetect[=limit:round[:reset]]
rectangle[=w:h:x:y]:画矩形
flip:上下颠倒
mirror:上下镜像
scale[=w:h[:interlaced[:chr_drop[:par[:par2[:presize[:noup[:arnd]]]]]]]]
通用编码选项
指定输出文件的fourcc:−ffourcc
输出文件名:-o,可以在默认配置文件中指定本选项,则每次输出的文件都是指定的名字。
音频编码器的名字:−oac,可选参数为copy, pcm, mp3lame, lavc, faac
视频编码器的名字:-avc,可选参数为copy, frameno, raw, lavc, vfw, qtvideo, xvid, x264,其中如果指定为raw,则需要指定fourcc选项。
输出格式:-of,可选参数为avi, mpeg, lavf, rawvideo, rawaudio,后两种格式不会将音视频复用。
输出帧率:-ofps
指定firstpass的输出文件:−passlogfile<filename>
mp3编码器
帮助:mencoder -oac mp3lame -lameopts help
一般可以用abr模式,preset=172
faac编码器
指定码率:-br=bitrate
指定档次:-object=1/2/3/4, 对应main, low, ssr, ltp(默认main)
哪种算法:-mpeg=2/4,默认是4
x264编码器
bitrate=<value>
crf=<1.0 - 50.0>
pass=<1-3>
profile=baseline/main/high
preset=ultrafast/superfast/veryfast/faster/fast/medium/slow/slower/veryslow/placebo,medium为缺省设置。
keyint=<value>,IDR的间隔帧数
keyint_min=<1 - keyint/2>,最小IDR的间隔帧数,默认值为25。如果在此之内发生场景切换,则该帧被编码为I帧,而不是IDR帧。
frameref=<1-16>,参考帧数量,默认是3
bframes=<1-16>,I帧和P帧之间的B帧数量,默认值3
(no)b_adapt,B帧数量自适应,默认打开,如果关闭,则使用上面的bframes指定的参数
b_bias=<−100−100>,B帧数量判决依据,大的值产生更多的B帧,默认为0。
b_pyramid=<normal|strict|none>,是否允许B帧作为参考帧,要求bframes>=2
(no)mbtree: 使能或禁止宏块树率控,在多通道模式下,写入到一个单独的统计文件:<passlogfile>.mbtree
rc_lookahead=<0−250>:调整mbtree前瞻的距离(默认值:40)。较大的值将降低编码速度,并且导致X264消耗更多的内存,但可以产生更高的质量。
ratetol=<0.1−100.0> (ABR or two pass):平均码率设定下允许的码率变化范围,(default: 1.0)
vbv_maxrate=<value> (ABR or two pass):最大码率,单位kbps,(default: disabled)
vbv_bufsize=<value> (ABR or two pass):表示计算vbv_maxrate的平均周期,单位是kbits,没有默认值,如果vbv_maxrate使能,则本选项必须设置。
vbv_init=<0.0−1.0> (ABR or two pass):表示起始阶段vbv_bufsize的占用率。(default: 0.9)
ip_factor=<value>,I和P之间的量化值比例。(default: 1.4)
pb_factor=<value>,P和B之间的量化值比例。(default: 1.3)
qcomp=<0−1> (ABR or two pass),量化压缩值,(default: 0.6)。小的值使码率更恒定,大的值使量化值更固定。
cplx_blur=<0−999> (two pass only),
Temporal blur of the estimated frame complexity, before curve compression (default: 20). Lower values allow the quantizer value to jump around more, higher values force it to vary more smoothly. cplx_blur ensures that each I-frame has quality comparable to the following P-frames, and ensures that alternating high and low complexity frames (e.g. low fps animation) do not waste bits on fluctuating quantizer.
qblur=<0−99> (two pass only)
Temporal blur of the quantization parameter, after curve compression (default: 0.5). Lower values allow the quantizer value to jump around more, higher values force it to vary more smoothly.
direct_pred=none/spatial/temporal/auto,默认spatial。当使用multi-pass模式时,最好使用auto。none无论速度还是效率都不高。
partitions=<list>:(default: p8x8,b8x8,i8x8,i4x4),对于小图像,可以加上p4x4
(no)8x8dct
(no)mixed_refs,允许一个宏块的16x8,8x16,8x8分块选择不同的参考帧。
level_idc=<10−51>
threads=<0−16>,默认0,表示编码器自动选择。
(no)sliced_threads,默认禁止。
(no)global_header,是否只在文件开头保存SPS和PPS。默认禁止,即在每个IDR之前都保存SPS和PPS。
(no)interlaced,视频源是否是隔行扫描的。
lavf复用器
-of lavf -lavfopts
format=<container_format>, 可输出flv, mp4, mkv等格式。
mencoder用法举例
Encode DVD title #2, only selected chapters:mencoder dvd://2 −chapter 10−15 −o title2.avi −oac copy −ovc lavc −lavcopts vcodec=mpeg4
Encode DVD title #2, resizing to 640x480:
mencoder dvd://2 −vf scale=640:480 −o title2.avi −oac copy −ovc lavc −lavcopts vcodec=mpeg4
Encode DVD title #2, resizing to 512xHHH (keep aspect ratio):
mencoder dvd://2 −vf scale −zoom −xy 512 −o title2.avi −oac copy −ovc lavc −lavcopts vcodec=mpeg4
The same, but with bitrate set to 1800kbit and optimized macroblocks:
mencoder dvd://2 −o title2.avi −oac copy −ovc lavc −lavcopts vcodec=mpeg4:mbd=1:vbitrate=1800
The same, but with MJPEG compression:
mencoder dvd://2 −o title2.avi −oac copy −ovc lavc −lavcopts vcodec=mjpeg:mbd=1:vbitrate=1800
Encode all *.jpg files in the current directory:
mencoder "mf://*.jpg" −mf fps=25 −o output.avi −ovc lavc −lavcopts vcodec=mpeg4
Encode from a tuner (specify a format with −vf format):
mencoder −tv driver=v4l:width=640:height=480 tv:// −o tv.avi −ovc raw
Encode from a pipe:
rar p test-SVCD.rar | mencoder −ovc lavc −lavcopts vcodec=mpeg4:vbitrate=800 −ofps 24 −