流媒体服务器中的 RTP 或 RTSP 有什么区别?

发布于 2024-10-05 03:56:23 字数 304 浏览 6 评论 0原文

我正在考虑开发一个流媒体服务器,我有以下问题,通过 RTSP 进行(示例网址:rtsp://192.168.0.184/myvideo.mpg)或 RTP(示例网址:rtp://192.168.0.184)。

据我了解,RTSP 服务器主要用于流式传输已经存在的文件,即非实时文件。 RTP服务器用于广播。

如果我错了,有人纠正我,对吗?

我想开发一个服务器来在计算机屏幕上播放直播内容,即在流媒体播放时显示的内容。

I'm thinking about developing a streaming server and I have the following question, do over RTSP (example url: rtsp://192.168.0.184/myvideo.mpg) or RTP (example url: rtp://192.168.0.184).

As I have understood, an RTSP server is mainly used for streaming of files that already exist, ie, not live. RTP server is used to broadcast.

Somebody correct me if I'm wrong, am I right?.

What I want to develop a server to broadcast live content on the computer screen, that is, which is displayed at the time that is broadcast in streaming.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

皇甫轩 2024-10-12 03:56:23

您遇到了问题... RTSP 是一种实时流协议。这意味着,您可以实时传输任何您想要的内容。因此,您可以使用它来流式传输直播内容(无论是什么,视频、音频、文本、演示文稿......)。 RTP 是一种传输协议,用于传输通过 RTSP 协商的媒体数据。

您可以使用 RTSP 来控制通过 RTP 的媒体传输。您可以使用它来设置、播放、暂停、拆卸流...

因此,如果您希望服务器在请求 URL 时开始流式传输,则可以实现某种仅支持 RTP 的服务器。但如果您想要更多控制并且正在流式传输实时视频,则必须使用 RTSP,因为它传输 SDP 和其他重要的解码数据。

阅读我在此处链接的文档,它们是一个很好的起点。

You are getting something wrong... RTSP is a realtime streaming protocol. Meaning, you can stream whatever you want in real time. So you can use it to stream LIVE content (no matter what it is, video, audio, text, presentation...). RTP is a transport protocol which is used to transport media data which is negotiated over RTSP.

You use RTSP to control media transmission over RTP. You use it to setup, play, pause, teardown the stream...

So, if you want your server to just start streaming when the URL is requested, you can implement some sort of RTP-only server. But if you want more control and if you are streaming live video, you must use RTSP, because it transmits SDP and other important decoding data.

Read the documents I linked here, they are a good starting point.

椵侞 2024-10-12 03:56:23

AFAIK,RTSP根本不传输流,它只是一个带有PLAY和STOP等功能的带外控制协议。

原始 UDP 或 RTP over UDP 是流传输协议,就像原始 TCP 或 HTTP over TCP 一样。

为了能够通过给定的传输协议传输特定节目,必须为您的容器格式定义封装方法。例如,TS 容器可以通过 UDP 传输,但 Matroska 不能。

几乎所有东西都可以通过 TCP 传输。

(您使用哪种编解码器这一事实也间接重要,因为它限制了您可以使用的容器格式。)

AFAIK, RTSP does not transmit streams at all, it is just an out-of-band control protocol with functions like PLAY and STOP.

Raw UDP or RTP over UDP are transmission protocols for streams just like raw TCP or HTTP over TCP.

To be able to stream a certain program over the given transmission protocol, an encapsulation method has to be defined for your container format. For example TS container can be transmitted over UDP but Matroska can not.

Pretty much everything can be transported through TCP though.

(The fact that which codec do you use also matters indirectly as it restricts the container formats you can use.)

柒夜笙歌凉 2024-10-12 03:56:23

一些基础知识:

RTSP 服务器可用于死源和实时源。 RTSP 协议为您提供命令(如 VCR 遥控器),功能取决于您的实现。

RTP是用于实时传输音频和视频的实时协议。使用的传输可以是单播、多播或广播,具体取决于传输地址和端口。除了传输 RTP 之外,还可以为您做很多事情,例如打包、重新排序、抖动控制、QoS、支持唇形同步......

在您的情况下,如果您想要广播流媒体服务器,那么您需要 RTSP(用于控制)和 RTP (广播音频和视频)

首先,您可以查看 live555 提供的示例代码

Some basics:

RTSP server can be used for dead source as well as for live source. RTSP protocols provides you commands (Like your VCR Remote), and functionality depends upon your implementation.

RTP is real time protocol used for transporting audio and video in real time. Transport used can be unicast, multicast or broadcast, depending upon transport address and port. Besides transporting RTP does lots of things for you like packetization, reordering, jitter control, QoS, support for Lip sync.....

In your case if you want broadcasting streaming server then you need both RTSP (for control) as well as RTP (broadcasting audio and video)

To start with you can go through sample code provided by live555

地狱即天堂 2024-10-12 03:56:23

我听到你的痛苦。我现在(几年后)正在经历这个。
据我所知,您可以将 RTSP 视为“VCR 控制器”,该协议允许您指定要播放的流(演示文稿),然后它会向您发送媒体描述,然后您可以使用RTSP来播放、停止、暂停和录制远程流。媒体本身通过 RTP 进行处理。 RTSP 通常是在不同的套接字或通信层上实现的。尽管它只是一个协议,但大多数情况下它是由服务器通过套接字实现的。对于直播流,您请求的 RTSP 流只是流的名称。它不需要引用服务器上的文件,服务器的 RTSP 实现可以解析该流,组合实时图形​​,然后提供该流名称的 SDP(描述)。但是,这当然特定于 RTSP 服务器的实现方式。对于“实时”流,仅使用 RTP 可能更简单,但您需要一种方法将 SDP 从 RTP 服务器传输到想要播放该流的客户端。

I hear your pain. I'm going through this right now (years later).
From what I've learned, you can think of RTSP as a "VCR controller", the protocol allows you to specify which streams (presentations) you want to play, it will then send you a description of the media, and then you can use RTSP to play, stop, pause, and record the remote stream. The media itself goes over RTP. RTSP is normally implemented over a different socket or communication layer. Although it is simply a protocol, most often it's implemented by a server over a socket. For live streams, the RTSP stream you request is simply a name of a stream. It doesn't need to refer to a file on the server, the server's RTSP implementation can parse that stream, put together a live graph, and then provide the SDP (description) for that stream name. But, this is of course specific to the way the RTSP server has been implemented. For "live" streams, it's probably simpler to just use RTP, but you'll need a way to transfer the SDP from the RTP server to the client that wants to play that stream.

缘字诀 2024-10-12 03:56:23

RTSP广泛应用于IP摄像机,在摄像机中作为RTSP服务器运行,以便用户可以从摄像机中播放(拉取)RTSP流。这是一种低成本解决方案,因为我们不需要中央媒体服务器(想想数千个摄像机流)。架构如下:

IP Camera      ----RTSP(pull)--->    Player
(RTSP server)                      (User Agent)

RTSP 协议实际上包含:

  • 在端口 554 上通过 TCP 发送的信令,用于交换有关媒体功能的 SDP(也用于 WebRTC)。
  • UDP/TCP 通过多个端口进行流传输,通常有两个端口,一个用于 RTCP,一个用于 RTP(也用于 WebRTC)。

与 H5 中现已提供的 WebRTC 相比:

  • 通过 HTTP/WebSocket 发送信号或通过任何其他协议进行交换,用于交换 SDP。
  • UDP 流(RTP/RTCP)通过一个或多个端口,通常绑定到一个端口,以使云服务负载均衡器满意。

从协议来看,RTSP和WebRTC很相似,但使用场景却有很大不同,因为偏离了主题,我们简单地讲一下,WebRTC是为网络会议而设计的,而RTSP是用于IP摄像头系统的。

由此可见,RTSP 和 WebRTC 都是解决方案和协议,用于不同的场景。虽然RTP是传输协议,但它也可以用于WebRTC的实时流媒体传输。

注意:RTSP 不适用于 H5 或互联网直播,但我们可以通过 FFmpeg 和网关服务器来隐藏它,请参阅 在这里

RTSP is widely used in IP camera, running as RTSP server in camera, so that user could play(pull) the RTSP stream from camera. It is a low cost solution, because we don't need a central media server (think about thousands of camera streams). The arch is bellow:

IP Camera      ----RTSP(pull)--->    Player
(RTSP server)                      (User Agent)

The RTSP protocol actually contains:

  • A signaling over TCP, at port 554, used to exchange the SDP (also used in WebRTC), about media capabilities.
  • UDP/TCP streams over serval ports, generally two ports, one for RTCP and one for RTP (also used in WebRTC).

Comparing to WebRTC, which is now available in H5:

  • A signaling over HTTP/WebSocket or exchange by any other protocols, used to exchange the SDP.
  • UDP streams(RTP/RTCP) over one or many ports, generally bind to one port, to make cloud services load balancer happy.

In protocol view, RTSP and WebRTC are similar, but the use scenario is very different, because it's off the topic, let's grossly simplified, WebRTC is design for web conference, while RTSP is used for IP camera systems.

So it's clear both RTSP and WebRTC are solution and protocol, used in different scenario. While RTP is transport protocol, also it can be used in live streaming by WebRTC.

Note: RTSP is not available for H5 or internet live streaming, but we could covert it by FFmpeg and a gateway server, please see here.

愿与i 2024-10-12 03:56:23

我认为这是正确的。 RTSP 可以在内部使用 RTP。

I think thats correct. RTSP may use RTP internally.

不念旧人 2024-10-12 03:56:23

RTP是实时数据的传输协议。它提供时间戳、序列号等方式来处理实时数据传输中的时序问题。

RTSP 是一种控制协议,用于启动和指导媒体服务器传输流媒体数据。它是“互联网VCR远程控制协议”。其作用是提供远程控制;然而,实际的数据传输是单独完成的,很可能是通过 RTP 完成的。

此外,RTCP 是 RTP 的控制部分,有助于提高服务质量和会员管理。

这三个相关协议用于互联网上的实时多媒体数据。请通过以下链接阅读优秀的完整文档:RTP、RTCP 和 RTP、RTCP RTSP

RTP is the transport protocol for real-time data. It provides timestamp, sequence number, and other means to handle the timing issues in real-time data transport.

RTSP is a control protocol that initiates and directs delivery of streaming multimedia data from media servers. It is the "Internet VCR remote control protocol." Its role is to provide the remote control; how­ever, the actual data delivery is done separately, most likely by RTP.

also, RTCP is the control part of RTP that helps with quality of service and membership management.

These three related protocols are used for real-time multimedia data over the Internet. Read the excellent full documentation at this link: RTP, RTCP & RTSP

风启觞 2024-10-12 03:56:23

RTSP(实际上是 RTP)可用于流视频,也可用于许多其他类型的媒体,包括实时演示。 Rtsp 只是用于建立 RTP 会话的协议。

有关所有详细信息,您可以在以下地址查看我的开源 RTSP 服务器实现: https://net7mma.codeplex.com /

或者我的文章@ http: //www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

它支持资源流以及流的动态创建,实现了各种 RFC与 FFMPEG 以及传输层中的任何其他解决方案相比,该库实现了更好的性能和更少的内存,因此使其成为大多数场景下用作集中访问点的良好候选者。

RTSP (actually RTP) can be used for streaming video, but also many other types of media including live presentations. Rtsp is just the protocol used to setup the RTP session.

For all the details you can check out my open source RTSP Server implementation on the following address: https://net7mma.codeplex.com/

Or my article @ http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

It supports re-sourcing streams as well as the dynamic creation of streams, various RFC's are implemented and the library achieves better performance and less memory then FFMPEG and just about any other solutions in the transport layer and thus makes it a good candidate to use as a centralized point of access for most scenarios.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文