为了账号安全,请及时绑定邮箱和手机立即绑定

ffmpeg在avformatfindstreaminfo执行时间太长该怎么处理

ffmpeg在avformatfindstreaminfo执行时间太长该怎么处理

九州编程 2018-10-01 12:12:18

1 回答

?
宝慕林4294392

TA贡献2021条经验 获得超8个赞

对于网络流,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;
}

查看完整回答
反对 回复 2018-10-11

没有找到匹配的内容?试试慕课网站内搜索吧

添加回答

代码语言

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号