x264的二进制文件
x264的官网x264, the best H.264/AVC encoder - VideoLAN上有编译好的Windows、Linux、Mac平台对应的二进制文件,比如Windows下是exe文件,可以直接用该文件来进行编码的操作。
x264 --help
C:\Users\ZL Guo\Desktop\x264>x264-r2901-7d0ff22.exe --help
x264 core:155 r2901 7d0ff22
Syntax: x264 [options] -o outfile infile
Infile can be raw (in which case resolution is required),
or YUV4MPEG (*.y4m),
or Avisynth if compiled with support (yes).
or libav* formats if compiled with lavf support (yes) or ffms support (no).
Outfile type is selected by filename:
.264 -> Raw bytestream
.mkv -> Matroska
.flv -> Flash Video
.mp4 -> MP4 if compiled with GPAC or L-SMASH support (no)
Output bit depth: 8/10
.
Options:
-h, --help List basic options
--longhelp List more options
--fullhelp List all options
Example usage:
Constant quality mode:
x264 --crf 24 -o
可以看出命令行的基本用法如下:
Syntax: x264 [options] -o outfile infile
可以输出为以下四种格式:
Outfile type is selected by filename:
.264 -> Raw bytestream
.mkv -> Matroska
.flv -> Flash Video
.mp4 -> MP4 if compiled with GPAC or L-SMASH support (no)
用法举例
基本用法
用MediaInfo可查看生成的264文件的信息。
可以看出默认编码的帧率为25帧/秒,启用了8*8dct变换,qp的最小值为0,qp的最大值为69,qp的步长为4等信息。
指定码率 --bitrate
x264 --bitrate 1000 -o output.264 input_640x360_yuv420p.yuv
指定帧率 --fps
x264 --fps 10 -o output.264 input_640x360_yuv420p.yuv
指定编码速度 --preset
--preset的参数主要调节编码速度和质量的平衡。
--preset Use a preset to select encoding settings [medium]
Overridden by user settings.
- ultrafast,superfast,veryfast,faster,fast
- medium,slow,slower,veryslow,placebo
x264 --preset ultrafast -o output.264 input_640x360_yuv420p.yuv
可以看出,使用ultrafast参数时,速度非常快,只有I帧和P帧,没有B帧,而且码率也比较大。 个人理解是以空间换时间。
x264 --preset placebo -o output.264 input_640x360_yuv420p.yuv
可以看到使用了更多的编码参数,速度也非常慢,但码率得到了有效控制。 个人理解是提高算法复杂度,以时间换空间。
配合视觉优化 --tune
--tune Tune the settings for a particular type of source
or situation
Overridden by user settings.
Multiple tunings are separated by commas.
Only one psy tuning can be used at a time.
- psy tunings:
film,
animation,
grain,
stillimage,
psnr,
ssim
- other tunings:
fastdecode,
zerolatency
References:
http://blog.csdn.net/daixinmei/article/details/51886850