x264编码有3个重要的相关参数,preset-tune-profile
参数设置相关函数:
x264_param_t* pParam = (x264_param_t*)malloc(sizeof(x264_param_t));
x264_param_default(pParam); //给参数结构体pParam 赋默认值
x264_param_default_preset(pParam, "fast" , "zerolatency" ); //设置preset和tunex264_param_apply_profile(pParam, "baseline"); //设置profile
preset是编码速度
可选项"ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo",从最快到最慢。无特殊要求选fast即可。
tune是编码质量和画面细节相关的参数。
可选项"film"电影, "animation"动画, "grain"颗粒, "stillimage"静态图像, "psnr"PSNR测试, "ssim"SSIM测试, "fastdecode"快速解码, "zerolatency"零延迟这几种。
profile是约束条件
从多到少排的"baseline", "main", "high", "high10", "high422", "high444",下面是从其他地方找的,介绍的有点老了。
H.264有四种画质级别,分别是baseline, extended, main, high:
- 1、Baseline Profile:基本画质。支持I/P 帧,只支持无交错(Progressive)和CAVLC;
- 2、Extended profile:进阶画质。支持I/P/B/SP/SI 帧,只支持无交错(Progressive)和CAVLC;(用的少)
- 3、Main profile:主流画质。提供I/P/B 帧,支持无交错(Progressive)和交错(Interlaced), 也支持CAVLC 和CABAC 的支持;
- 4、High profile:高级画质。在main Profile 的基础上增加了8x8内部预测、自定义量化、 无损视频编码和更多的YUV 格式;
H.264 Baseline profile、Extended profile和Main profile都是针对8位样本数据、4:2:0格式(YUV)的视频序列。在相同配置情况下,High profile(HP)可以比Main profile(MP)降低10%的码率。 根据应用领域的不同,Baseline profile多应用于实时通信领域,Main profile多应用于流媒体领域,High profile则多应用于广