ffmpeg fails with error "max delay reached. need to consume packet"
rtsp服务默认使用udp协议,容易丢包,报这个错误。改为tcp,则解决。
ffmpeg-设置rtsp推流/拉流使用的协议类型(TCP/UDP)(转)
拉流(设置TCP/UDP)
//设置参数
AVDictionary *format_opts = NULL;
av_dict_set(&format_opts, "stimeout", std::to_string( * ).c_str(), ); //设置链接超时时间(us)
av_dict_set(&format_opts, "rtsp_transport", "tcp", ); //设置推流的方式,默认udp。
//初始化输入上下文
AVFormatContext * m_InputContext = avformat_alloc_context();
//打开输入流。
avformat_open_input(&m_InputContext, "rtsp://127.0.0.1:554/", NULL, &format_opts);
// ......
推流(设置TCP/UDP)
//初始化输出流上下文。
AVFormatContext * output_format_context_ = NULL;
avformat_alloc_output_context2(&output_format_context_, NULL, "rtsp", "rtsp://127.0.0.1:554/");
/*
添加流信息
//TODO
*/
//设置参数,设置为TCP推流, 默认UDP
AVDictionary *format_opts = NULL;
av_dict_set(&format_opts, "stimeout", std::to_string( * ).c_str(), );
av_dict_set(&format_opts, "rtsp_transport", "tcp", );
//写入输出头(建立rtsp连接)
avformat_write_header(output_format_context_, &format_opts); while()
{
AVPakcet media_pkt;
/*
初始化PKT,
读取数据,
填充数据,
*/
//发送数据, 多个流时需要使用 av_interleaved_write_frame, 另附ret部分错误码,见其他文章。
int ret = av_interleaved_write_frame(output_format_context_, &media_pkt);
//释放数据
av_packet_unref(&media_pkt);
av_free_packet(&media_pkt);
}
ffmpeg fails with error "max delay reached. need to consume packet"的更多相关文章
- 解决ffmpeg拉流转发频繁丢包问题max delay reached. need to consume packet
软件: 1.流媒体服务器EasyDarwin-windows-8.1.0-1901141151 2.ffmpeg-20181001-dcbd89e-win64-static 3.直播源:rtsp:// ...
- Shell script fails: Syntax error: “(” unexpected
Shell script fails: Syntax error: “(” unexpected google 一下. http://unix.stackexchange.com/questions/ ...
- Windows Task Scheduler Fails With Error Code 2147943785
Problem: Windows Task Scheduler Fails With Error Code 2147943785 Solution: This is usually due to a ...
- response.sendfile() fails with Error: Forbidden
[response.sendfile() fails with Error: Forbidden] 参考:https://github.com/expressjs/express/issues/146 ...
- RFC destination fails with error Incomplete Logon Data after system copy
1. 问题现象 1.1在system copy后,提示RFC报错Unable to configure STMS 2. 重要的参考文件: 2.1RFC passwords not available ...
- 用g++ 编译 ffmpeg 编译出现 error: 'UINT64_C' was not declared in this scope 或 missing -D__STDC_CONSTANT_MACROS
在 libavutil/common.h 下 添加如下,即可解决 #ifdef __cplusplus#define __STDC_CONSTANT_MACROS#ifdef _STDINT_H#un ...
- Windows UDP sockets: recvfrom() fails with error 10054
https://stackoverflow.com/questions/34242622/windows-udp-sockets-recvfrom-fails-with-error-10054 #in ...
- 自动化部署之搭建yum仓
一.导言 YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系.要成功的使用YUM工具安装更新软件或系统,就需要有一个包含各种rpm软件包的repository(软件仓库 ...
- Troubleshooting ORA-1628 - max # extents (32765) reached for rollback segment <SEGMENT_NAME> (Doc ID 1580182.1)
Troubleshooting ORA-1628 - max # extents (32765) reached for rollback segment <SEGMENT_NAME> ( ...
随机推荐
- 13、vue如何解决跨域问题
开发环境:配置config文件夹中index.js文件: proxyTable: { '/api': { target: 'http://10.10.1.242:8245',//后端地址 // sec ...
- Java 之 LinkedHashSet 集合
一.概述 java.util.LinkedHahset 集合 extends HashSet 集合 在HashSet下面有一个子类java.util.LinkedHashSet,它的底层是一个哈希表( ...
- Java并发面试问题之volatile到底是什么?
本文转载自公众号:石杉的架构笔记,阅读大约需要7分钟. 一.写在前面 前段时间把几年前带过的一个项目架构演进的过程整理了一个系列出来,参见(<亿级流量架构系列专栏总结>). 不过很多同学看 ...
- YUM方法安装mysql5.7版本
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/kabolee/article/deta ...
- python之路第三天
2018年 7月 13 日 while循环语句: 输出1-5的数 s = 1 whlie s < 6: print(s) 用while循环输入 1 2 3 4 5 6 8 9 10 while ...
- 快速了解MongoDB
简介 MongoDB是一款为广泛的现代应用程序设计的高性能.可扩展.分布式数据库系统.MongoDB可用于不同规模大小的组织,为那些对系统低延迟.高吞吐量以及可持续性有很高要求的应用提供稳定关键的服务 ...
- xshell链接ubuntu16
用xshell 链接 ubuntu16 失败 ,是因为没有装 ssh 服务 sudo apt-get install openssh-server //安装ssh服务 ps -ef | ...
- Linux运维技术之讲解RAID
RAID: 独立冗余磁盘阵列 ,将多块磁盘组合起来,组合成一个阵列,当成一个逻辑设备来使用的机制! RAID级别:仅代表磁盘组织不同,没有上下之分,组合raid时,不仅要考虑速度,还要考虑可用性. 磁 ...
- 浅谈flask源码之请求过程
更新时间:2018年07月26日 09:51:36 作者:Dear. 我要评论 这篇文章主要介绍了浅谈flask源码之请求过程,小编觉得挺不错的,现在分享给大家,也给大家做个参考.一起跟随 ...
- 《团队名称》第八次团队作业:Alpha冲刺day5
项目 内容 这个作业属于哪个课程 2016计算机科学与工程学院软件工程(西北师范大学) 这个作业的要求在哪里 实验十二 团队作业8-软件测试与ALPHA冲刺 团队名称 快活帮 作业学习目标 (1)掌握 ...