Closed winlinvip closed 1 year ago
I can't understand some of the multi-line configurations for the SRS live broadcast aggregation router.
Looking at your architecture diagram, the approximate effect achieved is that the SRS server shunts the push and the receiving end selects the best link for forwarding? In this case, it serves as a redundancy, while MPTCP serves to stack the speed of multiple links, such as stacking three 10M broadband lines to achieve 30M to increase available bandwidth. I've looked at the latest documentation for openmptcprouter, and it seems to have added hot standby redundancy features. I haven't studied the specific implementation yet, but in any case, it should be a different direction from what you're saying. However, integrating SRS aggregation should effectively reduce fault points and lower latency?
@MattUan Yes, it's different from MPTCP. If it were the same, there would be no need to do it, and MPTCP would be good enough.
What I want to do mainly addresses the redundancy issue when bandwidth requirements are met, and of course, redundancy can also be achieved with multiple camera positions.
In addition, MPQUIC may be more suitable than MPTCP, but it is not yet mature.
First, the most important thing: Currently, SRS does not support aggregation routers, and is still in development, so please stay tuned...
Now, there will be a live broadcast every week, mainly for SRS Q&A, pushing RTMP streams to video numbers, and sometimes network jitter can cause stuttering.
If the uplink push stream has poor network quality, it will cause everyone to freeze. Therefore, live broadcasts basically need to guarantee uplink push streams, unless it is a scenario where a network camera streams 24 hours a day and no one watches.
Solution
The current market solution is aggregation routers, which generally involve plugging multiple network cards into a router and deploying a dedicated server to aggregate the streams from these network cards and then push them to the live source station. There are several issues with this:
So, I think the application layer aggregation router solution would be better. For a specific solution, refer to: Architecture Diagram
Goal
This is an open-source aggregation router solution, with the main goals being:
This is not a commercial product, and the goal is not to produce a directly commercializable product. Because to truly make it a commercial product, many things need to be considered, and this is not something an open-source project should do.
What open source needs to do is to run the link and show various possibilities. Main tasks:
HiWifi Y1 + EC20
HiWifi has a low configuration but is widely available, with a USB port that can plug in an EC20 4G network card, enabling WiFi + 4G dual-channel transmission.
First, flash the HiWifi Y1 to the OpenWRT system, refer to the following OpenWRT Install.
Then, you need to install the USB 4G network card driver. Windows uses RNDIS, and Linux uses CDC-ECM. The difference is explained here. In OpenWRT, you can install it like this:
Next, restart the router. Plug the EC20 into the USB port, and you can see that it is recognized, and a new network card called
usb0
is available:Finally, add a new network interface.
OpenWRT Install
If the official download is slow, you can download the flashing image and kmod from the domestic Tencent or Tsinghua mirror sites.
For the flashing image, select the version and your router model from the download page. You can find it from Targets, for example, HiWifi Y1 is
ramips/mt7620
, and then find the corresponding brand image, such ashiwifi_hc5661
on the download page:After flashing the router, you can first connect to another WiFi to access the network, and then you can use opkg to install.
First, back up the official opkg source and set it to the Tencent Cloud mirror:
Finally, update and install:
Explain other packages that may be used:
kmod-usb-net-cdc-ether
: This is the USB network card driver, CDC ECM mode. Installingkmod-usb-net-rndis
will install this package by default. For details, please check CDC-ECM and RNDIS.kmod-usb-serial-option
: If you need to operate the EC20 module, such as AT serial command operation/dev/ttyUSB2
, set the EC20 mode, you need to install this module. Generally, this module is not needed.libstdcpp
: This is the C++ dynamic library. If the program uses C++, you need to install this library.libopenssl
: This is the openssl dynamic library, which is used for encryption and decryption.gdb
: You can debug programs on OpenWRT.OpenWRT Build
The router is definitely based on OpenWRT, and basically, all current routers are developed based on this open-source project.
Since OpenWRT is quite large, downloading it in China is either slow or fails. I found some mirror sources to speed up the download. Please refer to openwrt-docker.
This Docker is an Ubuntu 20 environment. The Dockerfile will download the OpenWRT code and the dependent feeds code. After the image is built, you can directly configure and compile it. Subsequently, you can directly
git pull
to update the code, which is much faster.OpenWRT: srs-server
SRS can run on OpenWRT, refer to Build package srs-server.
Start the SRS server:
Push the stream to SRS:
Watch HTTP-FLV: http://192.168.1.1:8080/live/livestream.flv
MPTCP
Currently, live aggregation routers use a transport layer multi-path transmission solution. Related projects are as follows:
MPTCP is a protocol based on TCP, as shown in the figure below:
The following is the architecture diagram:
The main purpose of multi-path transmission is to increase the transmission bandwidth, and incidentally, improve the jitter resistance.
Here is a test plan Wireless 4G Video Transmission Solution, using 3 4G network cards with a speed limit of 800Kbps to transmit a 2Mbps live stream. Note that when plugging and unplugging the network card, there will be a second-level freeze and mosaic (maybe commercial products can solve this).
MP-QUIC
Zhihong mentioned that QUIC also has a multipath version, referring to multipath-quic.org. The official says that the quic-go QUIC library already supports it.
I think there are several key advantages of MP-QUIC over MPTCP:
Application layer protocol, no need to go through a very long upgrade chain, App can use it by writing its own code, which greatly speeds up the popularization. No need to modify the kernel, routers, or underlying libraries, it can be done at the application layer.
UDP protocol, which is naturally easy to support. QUIC itself has also considered connection migration, but not simultaneous transmission. From the RFC, we can see that MP-QUIC is only 28 pages, while MPTCP has 58 pages.
QUIC is the foundation of the future Internet, and multipath can be applied far beyond just TCP, and can be used by all applications.
The impact this can bring is very different. It's fast, simple, and widespread.
Commercial Products
There are quite a few aggregation router products on the market, mainly aimed at increasing transmission bandwidth, and of course, supporting transmission fault tolerance.