当前位置:网站首页>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;
}
边栏推荐
- 基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建
- Handling distributed transactions with powerful dbpack (PHP tutorial)
- Database experiment report (II)
- 新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求
- What should I learn in the zero foundation entry test? It's the most comprehensive. Just learn from it
- flutter path_provider: ^2.0.10可以获取临时目录
- bash: ln: command not found
- prism journal导航按钮的可用性探索记录
- 【邂逅Django】——(二)数据库配置
- Want to open an account, is it safe to open an account of Huatai Securities online?
猜你喜欢
Error: missing revert data in call exception
CRC 校验
Suggest collecting | what to do when encountering slow SQL on opengauss?
The Lantern Festival is held on the fifteenth day of the first month, and the Lantern Festival begins to celebrate the reunion
. Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks
New situation of digital collection market
12款大家都在用的產品管理平臺
12款大家都在用的产品管理平台
.NET 5.0+ 无需依赖第三方 原生实现定时任务
新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求
随机推荐
北汽蓝谷:业绩承压,极狐难期
[MPC] ② quadprog solves positive definite, semi positive definite and negative definite quadratic programming
12. Gateway new generation gateway
Want to open an account, is it safe to open an account of Huatai Securities online?
MySQL common commands
Project0: Games
内存泄漏定位工具之 valgrind 使用
华为HMS Core携手超图为三维GIS注入新动能
Error: missing revert data in call exception
New situation of digital collection market
Mobile hard drive reads but does not display drive letter
Valgrind usage of memory leak locating tool
Kotlin 协程调度切换线程是时候解开真相了
基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建
Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》
LeetCode 438. Find all letter ectopic words in the string__ sliding window
[.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
Simulink simulation circuit model of open loop buck buck buck chopper circuit based on MATLAB
SQL server2014 failed to delete the database, with an error offset of 0x0000