I. Comparison of four common streaming media transmission protocols
Common streaming media transmission protocols are mainly the following four categories: RTSP protocol, RTMP protocol, SRT protocol and RIST protocol, on the detailed description of these four protocols see the previous article, "Using RTMP protocol to build a computer and cell phone live Demo", here will not repeat.
Among the above four streaming protocols, RTSP appeared the earliest, and in the PC Internet era, RTSP live broadcast was once the mainstream means of live video. The following is an example of how to do RTSP live streaming to a streaming media server via EasyPusher-Android with RTSP protocol.
Second, the computer side through the OBS Studio RTSP live push streaming
OBS Studio doesn't support RTSP protocol by default, you need to install OBS-RTSPServer plugin before you can realize RTSP push streaming. If you are interested, you can configure OBS Studio by yourself to realize RTSP live streaming on your computer.
Third, the cell phone through the EasyPusher-Android RTSP live push streaming
Since EasyPusher only supports RTSP push streaming and SRS does not support RTSP protocol, the server side can only use ZLMediaKit. first start the streaming server ZLMediaKit on the cloud service, deploying and starting ZLMediaKit on the cloud server is more troublesome, which is impossible to be explained in a few words. If you want to figure out how to operate ZLMediaKit on the cloud server, see the previous article "Linux environment to install ZLMediaKit to realize the video push streaming" for detailed steps.
Then start the cell phone on the live recording software EasyPusher-Android, the specific operation steps see the previous article "mobile domestic live recording tool EasyPusher". In the debugging process, found that EasyPusher-Android can not normally parse the shape of "rtsp://124.70.***. ***/live/test", we need to modify EasyPusher-Android's app code to make it support common RTSP push stream address. The modification is described below:
Open the EasyPusher-Android project and put the following lines of RTSP link parsing code:
Change to the following RTSP link parsing code for the purpose of properly parsing the server IP, port number, and service name in the RTSP link:
Then open it up and put the following line
Replace it with the following line:
Save the code, recompile and run it again, install the app on the test phone, wait for EasyPusher-Android to start, click the "Push Stream" button at the bottom left corner of the screen, and let EasyPusher-Android to the rtsp address of ZLMediaKit. "rtsp://124.70.***. ***/live/test", the EasyPusher-Android recording interface of the pushing process is shown below.
Observing the ZLMediaKit logs on Huawei Cloud as follows, you can see that EasyPusher-Android is pushing live streams to the back-end streaming server:
Then start the streaming media player VLC media player on your computer, open the network stream "rtsp://124.70.***. ***/live/test", at this time the video playback interface of VLC media player is shown in the figure below.
Observing the ZLMediaKit logs on Huawei Cloud as follows, you can see that VLC media player is pulling live streams from the back-end streaming server:
Combining the live recording screen of EasyPusher-Android and the live viewing interface of VLC media player, it can be seen that EasyPusher-Android has successfully realized the live broadcast function of RTSP protocol.Can.
For more details on FFmpeg development seeFFmpeg Development in Action: From Zero Basics to Short Video OnlineA book.