加速x264编码

时间:2012-07-12 09:28:48

标签: iphone objective-c codec x264

我正在使用x264来编码从iphone相机捕获的原始数据..但编码非常慢。任何人都可以帮助我加快编码速度。

我使用以下设置来构建x264 lib:

// for armv6

CC = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / gcc ./configure --host = arm-apple-darwin --sysroot = / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS4.3.sdk --prefix ='dist' - extra-cflags =' - arch armv6'-extra-ldflags = -L / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS4.3.sdk / usr / lib / system / --extra-ldflags =' - arch armv6' - enable-pic --disable-asm

// for armv7

CC = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / gcc ./configure --host = arm-apple-darwin --sysroot = / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS4.3.sdk --prefix ='dist' - extra-cflags =' - arch armv7'-extra-ldflags = -L / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS4.3.sdk / usr / lib / system / --extra-ldflags =' - arch armv7'--enable-pic

我正在使用默认预设:

x264_param_default_preset(param, "slow", "zerolatency");

并设置一些参数:

param->i_bframe = 0;
param->analyse.i_me_method = X264_ME_HEX;
param->analyse.i_subpel_refine = 2;
param->i_frame_reference = 1;
param->analyse.b_mixed_references = 0;
param->analyse.i_trellis = 0;
param->rc.b_mb_tree = 0;
param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;


param->rc.i_bitrate = 180;
param->rc.i_qp_min = 20; 
param->rc.i_qp_max = 26; 

param->i_keyint_max = 15; 
param->i_keyint_min = 15;


param->i_width = w;
param->i_height = h;

x264_param_apply_profile(param, "baseline");
x264_picture_alloc( &(enc->pic), X264_CSP_I420, param->i_width, param->i_height );

1 个答案:

答案 0 :(得分:0)

如果您使用默认预设为:

x264_param_default_preset(param, "veryfast", "zerolatency");

可能你会有一些速度上的提升。但我不认为iPhone能够以非常高的速度使用x264对视频进行编码。我从未为iPhone开发任何东西,但通常这些嵌入式系统都有一个硬件编码器,可以使用API​​为您的应用程序提供。