gpt4 book ai didi

c++ - x264_encoder_open 始终返回 null

转载 作者:行者123 更新时间:2023-12-03 12:51:19 26 4
gpt4 key购买 nike

这是我的代码

x264_param_default(&m_X264Param);

nRet = x264_param_default_preset(&m_X264Param,"medium","zerolatency") ;
if (nRet)
{
return -1;
}
if (cpMain == Param.nProfile)
{
nRet = x264_param_apply_profile(&m_X264Param,"main") ;
}
else if (cpSimple == Param.nProfile)
{
nRet = x264_param_apply_profile(&m_X264Param,"baseline") ;
}
else if (cpComplex == Param.nProfile)
{
nRet = x264_param_apply_profile(&m_X264Param,"high");
}
if (nRet)
{
return -1;
}
m_X264Param.i_width = Param.nWidth ;
m_X264Param.i_height = Param.nHeight ;
m_X264Param.i_threads = X264_THREADS_AUTO ;
m_X264Param.i_log_level = X264_LOG_NONE ;
m_X264Param.rc.i_bitrate = Param.nBitRate ;
m_X264Param.rc.i_rc_method = X264_RC_ABR ;
m_X264Param.i_csp = X264_CSP_I420 ;

m_pX264Handle = x264_encoder_open(&m_X264Param);

但它总是返回 null 这是我第一次使用它我错过了一些关键参数吗?谁能告诉我答案啊!非常感谢您并致以最诚挚的问候

最佳答案

返回的NULL只不过是参数参数或环境中的错误指示。

举个例子:

x264_t *x264_encoder_open( x264_param_t *param )
{
// ...
if( x264_threading_init() )
{
x264_log( h, X264_LOG_ERROR, "unable to initialize threading\n" );
goto fail;
}
// ...
fail:
x264_free( h );
return NULL;
}

通过 m_X264Param.pf_log 和 friend 添加一个日志回调,并使用诊断消息来调用它,据称可以解释问题。

关于c++ - x264_encoder_open 始终返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16049974/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com