H264编码,隔行,不支持宽度不为4的情况。如编码参数为720x486,就编码失败了。
代码实现在x264编码器里.
错误信息为:
x264_log( h, X264_LOG_ERROR, "height not divisible by %d (%dx%d)\n", h_mod, h->param.i_width, h->param.i_height );
FFmpeg 代码 avcodec_open2() 函数中
x4->enc = x264_encoder_open(&x4->params);
x264_validate_parameters( h, 1 )
{
#define X264_CSP_I422 0x0005 /* yuv 4:2:2 planar */
#define PARAM_INTERLACED h->param.b_interlaced ==> 1
int h_mod = (i_csp < X264_CSP_I422 ? 2 : 1) << PARAM_INTERLACED;
if( h->param.i_height % h_mod )
{
x264_log( h, X264_LOG_ERROR, "height not divisible by %d (%dx%d)\n", h_mod, h->param.i_width, h->param.i_height );
return -1;
}
}