x264编码帧速率限制

时间:2014-09-30 12:10:17

标签: c video x264

我使用以下参数使用x264 lib对.mp4视频进行编码:

int fps = 30;
x264_param_default_preset(&x.params, "ultrafast", "stillimage,zerolatency");
x.params.i_threads = 1;
x.params.i_fps_num = fps;
x.params.i_fps_den = 1;
x.params.i_timebase_num = 1;
x.params.i_timebase_den = fps;

如果我将fps设置为等于或小于25,则视频以正确的帧速率进行编码,但是如果我尝试编码超过25 fps,帧速率将降至25 fps。

这是一个日志输出,请注意,有两个视频同时被编码:

x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile Constrained Baseline, level 4.0
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile Constrained Baseline, level 4.0
x264 [info]: frame I:2     Avg QP:20.50  size:401756
x264 [info]: frame P:318   Avg QP:24.04  size: 87631
x264 [info]: mb I  I16..4: 100.0%  0.0%  0.0%
x264 [info]: mb P  I16..4:  2.5%  0.0%  0.0%  P16..4: 73.3%  0.0%  0.0%  0.0%  0.0%    skip:24.2%
x264 [info]: coded y,uvDC,uvAC intra: 50.6% 59.2% 15.8% inter: 40.1% 21.6% 0.2%
x264 [info]: i16 v,h,dc,p: 14% 34% 40% 12%
x264 [info]: i8c dc,h,v,p: 39% 28% 19% 13%
x264 [info]: kb/s:21502.55
x264 [info]: frame I:2     Avg QP:20.50  size:380898
x264 [info]: frame P:318   Avg QP:24.01  size: 82754
x264 [info]: mb I  I16..4: 100.0%  0.0%  0.0%
x264 [info]: mb P  I16..4:  2.5%  0.0%  0.0%  P16..4: 73.1%  0.0%  0.0%  0.0%  0.0%    skip:24.4%
x264 [info]: coded y,uvDC,uvAC intra: 50.0% 56.0% 14.9% inter: 38.4% 21.8% 0.2%
x264 [info]: i16 v,h,dc,p: 14% 34% 40% 12%
x264 [info]: i8c dc,h,v,p: 39% 29% 19% 13%
x264 [info]: kb/s:20308.27

1 个答案:

答案 0 :(得分:1)

我自己设法解决了这个问题。因为我正在为流编码一系列图像,所以我需要在所有其他选项之前给avconv一个特殊的-framerate选项,除了常规-r选项以指定编码的帧速率。