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> ( ...
随机推荐
- jackson 学习资料
源代码托管地址 https://github.com/FasterXML/jackson https://github.com/FasterXML/jackson-docs http://www.st ...
- 英语fraunce法兰西
fraunce 外文词汇,中文翻译为代指法兰西(地名) 中文名:法兰西 外文名:fraunce 目录 释义 Fraunce 读音:英 [frɑ:ns] 美 [fræns] Noun(名词) 1. ...
- mac php Swoole入门
一. swoole 扩展安装 安装前必须保证系统已经安装了下列软件 php-7.0 或更高版本 gcc-4.8 或更高版本 make autoconf pcre (CentOS系统可以执行命令:yum ...
- python语言的堆栈与队列类的实现
基于python语言的数据结构之堆栈与队列的实现 # 堆栈的实现 # -*- coding: utf-8 -*- """ 栈(stack), 是一种容器,可以存入数据元素 ...
- 微服务框架---搭建 go-micro环境
1.安装micro 需要使用GO1.11以上版本 #linux 下 export GO111MODULE=on export GOPROXY=https://goproxy.io # windows下 ...
- Windos7 安装 thumbor 遇到的python版本问题
(py36) C:\Users\Administrator>thumbor --port= Traceback (most recent call last): File , in _run_m ...
- Vue之Action
(1)同步与异步 在 mutation 中混合异步调用会导致你的程序很难调试. 例如,当你调用了两个包含异步回调的 mutation 来改变状态,你怎么知道什么时候回调和哪个先回调呢? 这就是为什么我 ...
- 201671010438王奕晗实验十四 团队项目评审&课程学习总结
个人学习总结博客 项目 内容 这个作业属于哪个课程 任课教师博客主页链接 这个作业的要求在哪里 作业链接地址 作业学习目标 完成个人软件心得总结 一.结合本学期课程学习内容,对比<实验一 软件工 ...
- 《团队名称》第八次团队作业:Alpha冲刺day2
项目 内容 这个作业属于哪个课程 2016计算机科学与工程学院软件工程(西北师范大学) 这个作业的要求在哪里 实验十二 团队作业8-软件测试与ALPHA冲刺 团队名称 快活帮 作业学习目标 (1)掌握 ...
- 使用kubeadm 安装 kubernetes 1.15.1
简介: Kubernetes作为Google开源的容器运行平台,受到了大家的热捧.搭建一套完整的kubernetes平台,也成为试用这套平台必须迈过的坎儿.kubernetes1.5版本以及之前,安装 ...