Recently live very hot, a lot of friends are interested in the technology behind, so today we put together a mobile video optimization of the article, this article is my friend in a technical conference to share, more content please follow our public number: Rtcblacker
Why is the video broadcast so hot?
First of all, the demand for audio and video live, on demand has been large, including a variety of industry applications, such as video portals, entertainment live, Game live, online education, telemedicine, remote monitoring, enterprise collaboration, social applications and so on. "The previous reason is not full-blown, because the hardware conditions are not satisfied, such as network bandwidth is limited," the current speed is still rising, optical fiber popularization to the community, the cable network up and down the bandwidth has reached the requirements, "mobile network 4G access speed is also fast to meet the basic video live bandwidth requirements." and the network tariff is also relatively low, become popular acceptable. ”
Second, smart hardware devices are widely popular, especially large-screen smartphones, tablets, the basic is a manual. At the same time, the performance of these devices is becoming stronger. The hardware performance improvement solves the video codec performance bottleneck, can take the handset, the tablet as the PC machine to use.
Again, back to the nature of business is live streaming money fast, interested friends can look at what I wrote before: three angles analysis beauty video Live this industry
Next look at some of the directions for mobile Audio Video optimization:
First, the choice of general-purpose, good performance, relatively low complexity of the encoder, the mainstream is the high-frequency encoder, open source is mainly x264 and openh264, of which openh264 is the Cisco Open Source project, for real-time video call scenes are optimized. In addition, VP8 also made a lot of optimizations for the mobile side.
Second, in the selection of a coding standard, it is necessary to see whether the use of hardware coding, if the use of software coding, then it will be more CPU-intensive, showing that the device is hot, power consumption is fast, but the device compatibility is good, almost can be run on any device. If the use of hardware encoding, then good coding performance, can fully support 1080p image Full HD real-time encoding, but also power-saving, but the compatibility of the device is poor, special Android device hardware encoding mode support is poor. iOS device support is better, however, there is no open the lower level of the coding interface, difficult to get the code stream by frame, real-time live broadcast. In addition, it is difficult to do dynamic bitrate control by hardware coding. For the network broadcast and on-demand scene, in the coding phase to achieve the smoothness of the code rate fluctuations, this need to optimize the rate control algorithm.
Third, the size of the GOP should also be based on the application of the appropriate adjustment, if the interval between the key frame is small, then the code rate will appear frequent spikes, when sending data, will cause instantaneous congestion.
Finally, the problem of bit rate fluctuation can be solved by setting buffer, such as adding a send buffer at the push-flow end, sending the data according to the fixed bitrate, instead of sending it according to the data per frame. Also in the player can be set up a receive buffer, to solve the network fluctuations on the playback caused by frequent lag. However, this too large buffer will increase the delay, not suitable for the live application, more suitable for on-demand applications. For the live scene, require end-to-end delay as small as possible, the player can start quickly, see the screen. For RTMP live also to solve the cumulative delay, you can use the player actively empty buffer method.
There is an end-to-end data transmission link problem for both live and on-demand services. In the push-flow end to connect to the receiving server, this is the choice of the appropriate node, one is based on the client's DNS domain name to select the nearest node, when the DNS configuration is wrong, there may be no scheduling problem. The other is based on the client's export IP to select the node, this scheduling method will be more accurate. Similarly, for the player side, a similar approach is used to select the Edge node of the streaming media server cluster.
Six, in the entire live or on-demand process, it is best to have real-time statistics, including network type, machine information, real-time network status, frame rate, bitrate, and so on. This can analyze the various problems encountered, especially for the live scene, when the network fluctuations, the emergence of card immediately, can provide a basis for dynamic adjustment of QoS.
Seven, for the live scene, using QoS policy, dynamically adjust the encoding parameters, including frame rate, bitrate, resolution, buffer. When the live stream is sluggish, the adoption of a fast slow-rise strategy, when the network fluctuation is more severe, so that the coding parameters can avoid frequent back and forth adjustment, resulting in a vicious circle. When the encoding parameter adjustment, is generally based on the resolution of the code rate, the frame rate is divided into several grades, and then in accordance with the statistical data within a certain time period, in these groups to switch back and forth between the meetings to ensure smooth audio and video, as far as possible to improve the image quality.
Like the series of articles, welcome to scan the QR code below follow our public number: Rtcblacker
Android IOS WebRTC Audio and Video Development summary (70)--seven directions for mobile audio technology optimization