RTSP流(传输RTP包)的传输方式有两种:

  • RTP/AVP/UDP
  • RTP/AVP/TCP
    默认传输方式为: RTP/AVP. 即RTP/AVP/UDP.
    RTP/AVP stand for RTP A/V Profile.
    采用那种方式传输是由 客户端 来决定的.
  • 客户端在RTSP的SETUP命令中需要确定是使用TCP传输还是建立UDP传输

    RTP/AVP

    C->S: SETUP rtsp://example.com/foo/bar/baz.rm RTSP/1.0
    CSeq: 302
    Transport: RTP/AVP;unicast;client_port=4588-4589S->C: RTSP/1.0 200 OK
    CSeq: 302
    Date: 23 Jan 1997 15:35:06 GMT
    Session: 47112344
    Transport: RTP/AVP;unicast; client_port=4588-4589;server_port=6256-6257

    在RTP/AVP情况下, RTSP Client向RTSP Server提出SETUP申请时,指定client端用于接收RTP和RTCP交互的端口:client_port=4588-4589.

    • 偶数(4588)
      用于接收RTP数据.
    • 奇数(4589)
      用于进行RTCP交互.
      RTSP Server响应时, 会指定服务器端用于交互的端口:server_port=6256-6257. 其中偶数(6256)用于发送RTP数据, 奇数(6257)用于RTCP交互.

    视频和音频分别执行SETUP指令, 故它们有自己独自的RTP和RTCP端口.

    RTP/AVP/UDP中视频或音频的RTP和RTCP交互示意

    RTP/AVP/UDP 视频传输框图示意

    • 基本流程: RTP打包->UDP传输->RTP解包.
    • RTCP用于质量控制, 通过QoS反馈到RTP打包和RTP解包.

    RTP/AVP/TCP

    Certain firewall designs and other circumstances may force a server to interleave RTSP methods and stream data.
    This interleaving should generally be avoided unless necessary since it complicates client and server operation and imposes additional overhead.
    Interleaved binary data SHOULD only be used if RTSP is carried over TCP.

    • 有时候处于安全设计, 防火墙可能要求RTSP控制方法和流数据公用一个通信通道,进行交错传输.
    • 仅在RTSP控制方法通过TCP方式传输时,才可以交错传输二进制数据.
    interleaved

    When the transport choice is RTP, RTCP messages are also interleaved
    by the server over the TCP connection.
    As a default, RTCP packets are sent on the first available channel higher than the RTP channel.
    The client MAY explicitly request RTCP packets on another channel.
    This is done by specifying two channels in the interleaved parameter of the Transport header.

    既然是在同一个通道传输,怎么区分RTP通道(channel)和RTCP通道呢?
    答案是 在RTP层之上增加一层, 叫做:RTSP Interleaved Frame层.
    该层在RFC2326中的描述是:

    Stream data such as RTP packets is

    • encapsulated by an ASCII dollar sign (24 hexadecimal),
    • followed by a one-byte channel identifier,
    • followed by the length of the encapsulated binary data as a binary, two-byte integer in network byte order.
      The stream data follows immediately afterwards, without a CRLF, but including the upper-layer protocol headers. Each $ block contains exactly one upper-layer protocol data unit, e.g., one RTP packet.

    RTSP Interleaved Frame

    用wireshark抓包,示意如下:

    RTP层上又封装了一层:RTSP Interleaved Frame层

    以上数据中看到Payload type等于97, 一般为音频(视频的Payload type一般为96).

    视频的RTSP Interleaved Frame数据分析

    interleaved参数详解

    The interleaved parameter implies mixing the media stream with
    the control stream in whatever protocol is being used by the
    control stream, using the mechanism defined in Section 10.12.
    The argument provides the channel number to be used in the $
    statement.
    This parameter may be specified as a range, e.g.,
    interleaved=4-5 in cases where the transport choice for the
    media stream requires it.
    This allows RTP/RTCP to be handled similarly to the way that it is
    done with UDP, i.e., one channel for RTP and the other for RTCP.

    SETUP请求和响应的示意如下:

    C->S: SETUP rtsp://foo.com/bar.file RTSP/1.0
    CSeq: 2
    Transport: RTP/AVP/TCP;interleaved=0-1S->C: RTSP/1.0 200 OK
    CSeq: 2
    Date: 05 Jun 1997 18:57:18 GMT
    Transport: RTP/AVP/TCP;interleaved=0-1

    可看出Transport: RTP/AVP/TCP;interleaved=0-1interleaved=一般指定为一个范围: 0-12-3
    一般偶数用于标示RTP数据
    奇数用于标示RTCP数据.

    openRTSP (live555)

    • -t参数
      Transport: RTP/AVP/TCP
    • -t参数
      Transport: RTP/AVP

    References:
    http://blog.sina.com.cn/s/blog_4c2bf01a0100xc47.html
    http://www.ithao123.cn/content-8129332.html
    http://zhidao.baidu.com/link?url=f7yWE9pL67sf4vj0Vni0UiYGsNJ98v-u0Ybfubo12CjqRrSTcQEwBYBgTZrs_tMX6moSSOBVR_XIFYRZC03HJffJmCKuzpFvnHEk5TKhZwC
    https://tools.ietf.org/pdf/rfc3550.pdf
    https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol

RTP/AVP RTP/AVP/TCP相关推荐

  1. send/receive h264/aac file/data by rtp/rtsp over udp/tcp

    一.安装一些必要的调试工具 1.vlc安装 sudo apt-get install vlc sudo apt-get install vlc-nox 2.ffmpeg安装,带ffplay,ffpla ...

  2. c语言rtp协议,RTP系列:RTP协议详解和分析

    1.RTP概述 实时传输协议(Real-time Transport Protocol或简写RTP)是一个网络传输协议,作为因特网标准在RFC 3550(该文档的旧版本是RFC 1889)有详细说明. ...

  3. 【转载】 了解实时媒体的播放(RTP/RTCP 和 RTSP)

    http://blog.csdn.net/span76/article/details/12913307 离线媒体只是用 Http协议去读取服务器端文件而已,而对于实时直播如何实现, 这里就要用到 R ...

  4. 关于RTP的一些背景知识

    原文来自 rtp-i-intro-rtp-and-sdp rtp-ii-streaming-ffmpeg 周末本来想弄一下译文的,然后堂弟过来,消耗了不少时间在社交上,另一半时间是在研究turn se ...

  5. 基于RTP协议的IP电话QoS监测及提高策略

    基于RTP协议的IP电话QoS监测及提高策略 本文转自 http://jxic.jiangxi.gov.cn/Html/2008321143656-1.html 1. 概述  随着Internet和多 ...

  6. RTP/RTCP工程实践与问题解决方案(合集)

    基于RTP协议的IP电话QoS监测及提高策略 本文转自 http://jxic.jiangxi.gov.cn/Html/2008321143656-1.html 1. 概述  随着Internet和多 ...

  7. RTSP,RTP,RTCP协议

    一 RTSP 1 简介 实时流传输协议,是一个应用层协议(TCP/IP网络体系中),它是一个多媒体播放控制协议,主要用来使用户在播放流媒体时可以像操作本地的影碟机一样进行控制,即可以对流媒体进行暂停/ ...

  8. RTSP/RTP/RTCP协议流程及分析

    RTSP(实时流协议) RTSP中使用会话概念代替连接,由于它本身不与传输层绑定,因此RTSP会话在传输层支持TCP与UDP协议发送请求.RTSP客户机和服务器都可以发出请求,本身并不携带传输的媒体数 ...

  9. RTP Payload Format for High Efficiency Video Coding (HEVC)

    版权申明:未经允许请勿转载.转载前请先联系作者(hello@yeshen.org) This memo describes an RTP payload format for the video co ...

最新文章

  1. iOS逆向(4)-代码注入,非越狱窃取微信密码
  2. 简述Field,Attribute,Property的区别
  3. 如何使用MatPlotLib绘制出具有两个 Y 轴的曲线图?
  4. mysql 新增更新_MySQL新增数据,存在就更新,不存在就添加(转帖加实测)
  5. C语言指针和链表的体会
  6. 好插件·用户造【CSND超好用插件】·【机械键盘大放送】
  7. WCF自我学习之(一)
  8. ElasticSearch 文档路由,你的数据到底存在哪一个分片上_06
  9. UI设计师必定需要了解的sketch素材
  10. 前端 鼠标一次移动半个像素_小猿圈分享2019年前端JavaScript面试题(三)
  11. 工程力学考研 可以转计算机专业吗,跨专业考研我是工程力学的本科生,想要考飞行 – 手机爱问...
  12. 史上最简单的Mybatis教程(5天就够了)
  13. 计算机创新设计2大赛获奖作品3Done,走向3D创意世界——3Done创客设计比赛
  14. 美国弗吉尼亚大学计算机科学,2017美国弗吉尼亚大学计算机科学专业
  15. 微信java tools_微信开发工具包(weixin-java-tools)
  16. 启动Storm的nimbus和supervisor时报错: ImportError: No module named argparse
  17. webpack 热更新
  18. Python校园网定时自动登录-锐捷
  19. c语言二级指针内存释放,详解C语言-二级指针三种内存模型
  20. 手把手教程:零基础使用MATLAB完成基于深度学习U-Net模型的遥感影像分类

热门文章

  1. matlab 虚拟测量实验报告,实验报告格式
  2. 遨博协作机器人ROS开发 - Gazebo仿真与控制真实机器人
  3. Java模块化的守护神-OSGi就是这么简单!
  4. 优化方法之最速下降法(Python实现)
  5. 全球及中国汽车座椅加热行业现状分析及前景发展规划研究报告2021年版
  6. opencv4android编译静态库,Android Studio链接OpenCV静态库
  7. 新能源车市场及动力系统、电机电控、功率半导体技术探讨!
  8. html自动跳转到action,html中form标签的action属性
  9. 拙著《大象-Thinking in UML》已在互动出版网http://www.china-pub.com/129881开始出售,12月1日全国各大书店有售,敬请关注!^_^
  10. 【项目精选】百货中心供应链管理系统