当前位置:网站首页>sdp 协议中的packetization-mode方式和三种流传输模式
sdp 协议中的packetization-mode方式和三种流传输模式
2022-07-01 10:53:00 【qianbo_insist】
1、rtsp 中的sdp协议
sdp名称为会话描述协议,包括sip协议中也是用这个
rtsp协议中可以传输ps流,ts流 ,裸流也称为es流,es流比较常规,熟悉h264 的rtp封包方式,或者h265封包方式,h265封包RTP可以参考ffmpeg源代码
rtsp协议中 如果传输的是h264 h265
“m=” 行中的媒体名为 “video”
“a=rtpmap” 行中的编码名称是 H264 h265
“a=rtpmap” 行中的时钟频率一般是 90000,可以是别的数字,但是90000这个数字对很多帧率都是适应的,所以用它。
其他参数都包括在 “a=fmtp” .
2、pm方式
packetization-mode:
表示支持的封包模式.
1 、packetization-mode 值为 0 时或不存在时, 必须使用单一 NALU 单元模式.
2、 packetization-mode 值为 1 时使用非交错(non-interleaved)封包模式.
3、 packetization-mode 值为 2 时使用交错(interleaved)封包模式.
profile-level-id:
这个参数用于指示 H.264 流的 profile 类型和级别. 由 Base16(十六进制) 表示的 3 个字节. 第一个字节表示 H.264 的 Profile 类型, 第三个字节表示 H.264 的 Profile 级别
我们一般使用packetization-mode = 1,非交错模式
3、ps 、ts、es传输模式
以下用代码来恢复rtsp的场景传输三种不同的流
int handle_cmd(string& cmd, string& CSeq, uint32_t sessionid, char* cmdres,int ps_n_ts)
{
#define BUFSIZE 8*1024
int h26xtype = 96;
if (cmd.compare("DESCRIBE") == 0)
{
const char * psnts;
if (ps_n_ts == 1)
{
psnts = "a=rtpmap:32 MP2P/90000";
h26xtype = 32;
}
else if (ps_n_ts == 2)
{
psnts = "a=rtpmap:96 H264/90000";
h26xtype = 96;
}
else if (ps_n_ts == 3)
{
psnts = "a=rtpmap:33 MP2T/90000";
h26xtype = 33;
}
char sdp[4096];
sprintf(sdp, "v=0\r\n"
"o=shyjx 22345 22345 IN IP4 %s\r\n"
"s=H.264 Video, streamed by qb\r\n"
"t=0 0\r\n"
//"m=video 0 RTP/AVP 96\r\n"
"%s\r\n"
"c=IN IP4 0.0.0.0\r\n"
"a=rtpmap:96 H264/90000\r\n"
"a=fmtp:96 packetization-mode=1;\r\n"
"a=control:stream", m_strlocalip.c_str(), psnts, h26xtype);
return buildDescribeRes(cmdres, BUFSIZE, sdp, CSeq.c_str());
}
else if (cmd.compare("OPTIONS") == 0)
{
return buildOptionRes(cmdres, BUFSIZE, CSeq.c_str());
}
else if (cmd.compare("SETUP") == 0)
{
return buildSetupTcpRes(cmdres, BUFSIZE, 0, 1, sessionid, CSeq.c_str());
}
else if (cmd.compare("PLAY") == 0)
{
return buildPlayRes(cmdres, BUFSIZE, NULL, sessionid, CSeq.c_str());
}
else if (cmd.compare("TEARDOWN") == 0)
{
return buildTeardownRes(cmdres, BUFSIZE, sessionid, CSeq.c_str());
}
return -1;
}
边栏推荐
- 内存泄漏定位工具之 valgrind 使用
- 数字藏品平台搭建需要注意哪些法律风险及资质?
- 2022年已经过去一半了,是不是很突然呢?
- Have the bosses ever done the operation of sink shunting and writing to Clickhouse or other databases.
- Handling distributed transactions with powerful dbpack (PHP tutorial)
- How to get the maximum value of column two and regenerate the table when the SQL Server column one is the same
- 【MPC】①二次规划问题MATLAB求解器quadprog
- SQLAchemy 常用操作
- LeetCode.515. 在每个树行中找最大值___逐一BFS+DFS+按层BFS
- 使用强大的DBPack处理分布式事务(PHP使用教程)
猜你喜欢

Error: missing revert data in call exception

使用强大的DBPack处理分布式事务(PHP使用教程)

CRC check

Website source code whole site download website template source code download

Prefabricated dishes usher in the "golden age", who can lead the next trillion market

我国蜂窝物联网用户已达 15.9 亿,年内有望超越移动电话用户

Programmers want to go to state-owned enterprises? The technology is backward and the salary is low. I can't find a job after lying flat for several years

JS基础--数据类型

Recommend a JSON visualization tool artifact!

CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
随机推荐
数据库实验报告(一)
LeetCode.每日一题 剑指 Offer II 091. 粉刷房子 (DP问题)
[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》
[MPC] ① quadratic programming problem matlab solver quadprog
基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建
CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
NC | intestinal cells and lactic acid bacteria work together to prevent Candida infection
新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求
基金国际化的发展概况
Prism journal navigation button usability exploration record
106. construct binary tree from middle order and post order traversal sequence
Valgrind usage of memory leak locating tool
MySQL common commands
442. duplicate data in array
北汽蓝谷:业绩承压,极狐难期
移动硬盘驱动器读到,但不显示盘符
《百年巨匠》数字藏品中奖名单公布
毕业季·进击的技术er
Have the bosses ever done the operation of sink shunting and writing to Clickhouse or other databases.
我国蜂窝物联网用户已达 15.9 亿,年内有望超越移动电话用户