ffmpeg打开rtsp流应该设置的几个参数

6 篇文章 0 订阅
    AVDictionary* options = NULL;
    #使用 TCP 方式
	av_dict_set(&options, "rtsp_transport", "tcp", 0);
	#设置 接收包间隔最大延迟,微秒
	av_dict_set(&options, "max_delay", "200000", 0);
	# rtmp、rtsp延迟控制到最小
	av_dict_set(&options, "fflags", "nobuffer", 0);
	# 在进行网络操作时允许的最大等待时间。5秒
	av_dict_set(&options, "timeout", "5000000", 0);
	#设置 阻塞超时,否则可能在流断开时连接发生阻塞,微秒
	av_dict_set(&options, "stimeout", "3000000", 0);
	#设置 find_stream_info 最大时长,微秒
    av_dict_set(&options, "analyzeduration", "1000000", 0);

	avformat_open_input(&in_format_context, rtsp_url.c_str(), NULL, &options);
	
	av_dict_free(&opts);

防止av_read_frame()阻塞的回调

pFmtCtx->interrupt_callback.callback = stream_noblock_cb;
pFmtCtx->interrupt_callback.opaque = &data;
  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值