ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.57k stars 5.37k forks source link

PUSH RTSP is removed, does not support RTSP streaming #2304

Closed winlinvip closed 3 years ago

winlinvip commented 3 years ago

Push RTSP to SRS is removed by https://github.com/ossrs/srs/commit/2fa5a0bee8c950f669ff3c6b22496eb40becc412

Regarding RTSP, let's start with the conclusion: SRS does not directly support RTSP. The existing feature of pushing RTSP to SRS will be marked as deprecated and eventually removed. SRS can use Ingester (FFmpeg) to pull RTSP streams and convert them to RTMP before pushing them to SRS. However, this functionality is actually supported by FFmpeg.

Wikis: v2_EN_Streamer, v2_CN_Streamer, v3_EN_Streamer, v3_CN_Streamer, v4_EN_Streamer, v4_CN_Streamer

Discussion: From the perspective of media transmission, why do IPCs (Internet Protocol Cameras) support different methods for GB (Great Britain) and RTSP? One method is to pull the stream from the IPC using RTSP, while the other is for the IPC to push the stream out using GB28181.

Note: SRS 5.0 has already merged some of the capabilities of GB. For details, please refer to https://github.com/ossrs/srs/issues/3176.

RTSP

For the RTSP part, many friends have discussed it for a long time, and we will maintain the current approach of SRS.

  1. Clients push streams to SRS via RTSP, and SRS converts them to RTMP. Generally, GB28181 is used for pushing streams, and RTSP pushing is rarely used. Currently, SRS supports RTSP pushing, but there have been sporadic issues reported.
  2. SRS pulls streams via RTSP and converts them to RTMP. SRS achieves this through FFmpeg implementation. SRS does not have plans to directly support it because this belongs to the client-side mode, which is best suited for FFmpeg. If there is a need for optimization, it will be done based on FFmpeg.

The flowchart for RTSP stream processing should be as follows:

+-----------+               +----------------------+                +--------+  
| IP Camera +--->--RTSP-->--+ SRS Ingester(FFmpeg) +--->--RTMP-->---+  SRS   +
+-----------+               +----------------------+                +--------+ 

Note: IPC (IP Camera) and SRS Ingester (FFmpeg) are usually in the internal network, and FFmpeg pushes the stream to the internal or public network SRS.

GB28181: Reverse Gateway

According to reports, there is a scenario where the RTSP stream of a camera from the public network is pulled and pushed to an internal network server for viewing by internal network users. Due to the fact that it is a one-way gateway from the public network to the internal network (only allowing connections initiated from the public network to the internal network, and not vice versa), it is said that the GB protocol is needed to push the stream to the internal network server (all using UDP), as shown in the following diagram:

                          |
+-----------+             |     +---------------+  
| IP Camera +-->--GB28181-+->---+  SRS Server   +
+-----------+      (UDP)  |     +---------------+ 
                          |

Public Network Reverse Gateway Internal Network

> Note: The main limitation of this situation is that the reverse gateway can only open UDP ports to the outside. The GB28181 protocol uses UDP ports for signaling and media, which means that two UDP ports need to be opened for the camera to stream to the SRS shown above.
> Note: In this scenario, it is also not possible to use RTSP to stream to SRS because RTSP signaling uses the TCP protocol, while only the GB28181 protocol is fully UDP-based.

OBS

Supplementing the next scenario, OBS can also support pulling streams from IPC via RTSP, and after mixing with desktop or other streams (optional), it can be pushed to SRS via RTMP.
For example, in a teaching scenario, OBS can be used to pull streams from an IPC facing the teacher, another IPC facing the students, capture the desktop (displaying PPT), the sound from the local sound card, and even play files. After setting up the layout, OBS encodes and pushes the stream to SRS.

NVR

In addition, there is the scenario of NVR, which involves recording and playback in surveillance monitoring.
NVR can use the RTSP protocol to pull streams from IPC, then record them, or convert them to RTMP and push them to SRS.
Technically, it is as described above. For example, an NVR system can be built based on FFmpeg to pull streams and transcode them.
NVR supports multiple protocols and can also pull streams from cameras using the SDK provided by the manufacturer.

Plan

Future plan: Remove the built-in SIP signaling in SRS and use external signaling to avoid users using the SIP signaling used in SRS internal demos.
Reason: Signaling is a very important aspect of business attributes, and users must maintain it themselves. Open source projects are not suitable for this purpose.

TRANS_BY_GPT3

winlinvip commented 3 years ago

https://github.com/ossrs/srs/issues/2304#issue-865962340

winlinvip commented 3 years ago

https://github.com/ossrs/srs/issues/2304#issue-865962340

winlinvip commented 3 years ago

https://github.com/ossrs/srs/issues/2304#issue-865962340