您的位置:首页 > 其它

ffmpeg, demux, avformt_find_stream_info,解决卡住的问题

2015-01-31 18:13 330 查看

用ffmpeg做demux,网上很多参考文章。对于网络流,avformt_find_stream_info()函数默认需要花费较长的时间进行流格式探测,

那么,如何减少探测时间内?可以通过设置AVFotmatContext的probesize和max_analyze_duration属性进行调节:

.............

if (avformat_open_input(&(handle->pFormatContext), "", handle->pInputFormat, NULL) < 0) {

av_free(handle->inputBuffer);

*errorCode = -4;

return FALSE;

}

(handle->fpState)(handle, 51);

AVDictionary* pOptions = NULL;

handle->pFormatContext->probesize = 100 *1024;

handle->pFormatContext->max_analyze_duration = 5 * AV_TIME_BASE;

if (avformat_find_stream_info(handle->pFormatContext, &pOptions) < 0) {

.........

return FALSE;

}

...............
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: