The rise of live heat in the past two years has also led to the rise of the live development industry, where everyone wants to eat live to develop the cake. But this cake is not so easy to eat, in the fierce market competition, there are several large live platform has always occupied the larger share of the market, there are some small companies can not bear the impact of falling down, only with sophisticated technology, to be able to have a place in the market. Live development is not an easy thing to do, Android and Apple are not the same as the requirements for the building, today we will first understand how to build a live system of Android.
If one comes up to build a live system, it is basically impossible, first of all we need to learn from the overall what is the broadcast. Mobile live to achieve is the video and audio collected by the mobile phone after a certain processing sent to the CDN, and then transferred to the various terminal process. The following procedures are mainly included:
First, the collection
Capture mainly includes video capture and audio capture, involving cameras and microphones and other devices. Video is mainly through the camera acquisition, involving the operation of the camera and some parameters of the settings, many Android phones have compatibility problems, need better processing. Audio is mainly collected through a microphone, and sometimes some phones need to be echo-eliminated in order to perform the function of the headset.
Second, processing
Video processing. Now live between the Chinese and American Yan function must be standard, the image of the host has a great upgrade, you can also add some fun cartoon stickers, will also attract more fans to watch. Beauty SDK based on face recognition technology to build, excellent SDK needs to add whitening skin and other beauty functions will not reduce the sharpness, not excessive grinding skin, appear too much beauty, video distortion. At present, the image of the beauty function has been more mature, video beauty function needs to be constantly improved.
Audio processing. Sometimes it can be slightly embarrassing for a person to talk to a host, and a voice is needed to relieve embarrassment, such as laughter or applause. The host can let the additional sound play directly, so that the microphone can record both the host sound and the additional sound, but this processing has a problem is that when the host put on headphones or echo cancellation processing, the additional sound will not be included in. More processing is needed for this feature later.
Third, the Code
Through the camera and microphone we can collect the corresponding data, direct transmission of these data, the occupied bandwidth will be very large, easy to cause the waste of resources. The data will need to be encoded. At the moment we are using H. 264 coding standard. With a high coding efficiency, with the same image quality, the compressed data volume of the MPEG2 is only 1/3 of the 1/8,MPEG4, and the high quality of the video picture, the high fault tolerance rate, and the less bandwidth and high economy are required in the network transmission.
Secondly, the coding is divided into soft coding and hard coding. The soft code uses the CPU to encode, realizes the simple direct parameter adjustment convenient, the upgrade is easy, but the CPU load is heavy, the performance is inferior to the hard coding. Hard coding with non-CPU encoding, high performance. Live platform If you want a little higher clarity, you generally choose hard-coded. Coding to find the best balance point in resolution, frame rate, bitrate, GOP and other parameters design.
The encoding of audio can also be divided into two types: soft and hard. The software will download the corresponding code library, write the corresponding JNI, and then pass the data to encode. The hard-Mediacodec is the use of Android itself.
Four, packaging
Data in the transmission process needs to define a certain format for transmission, so that the transmission to the end of the time can be correctly parsed out, packaging generally requires the corresponding protocol: TCP protocol (transmission Control Protocol) transmission protocol is a connection-oriented, reliable, Transmission Layer communication protocol based on byte stream. TCP in order to ensure the reliability of the file transfer, give each packet a sequence number, while the serial number also guarantees from the delivery to the receiving end of the entity packet received.
The RTMP protocol, the HTTP-HLV protocol, and so on are all protocols that need to be used in the packaging process.
Five, poor network processing
Good network conditions, video transmission is smooth, will not accumulate audio and video caused by video delay, lag, and poor network conditions, audio and video data can not be sent out, it is easy to cause the delay, we need to deal with audio and video, generally have the following ways: Buffer design, drop frame processing, network detection, reduction rate processing.
Six, send
After various processing, the data needs to be sent out, this step is more simple, whether it is rtmp or HTTP-HLV can be established through TCP connection.
The above steps is the Android side to build a live platform of the basic process, so it seems to want to build a system does not seem too realistic, the most simple and effective way to set up a live broadcast system is entrusted to the development company specializing in the establishment of live broadcasting system, can ensure that the system from the start to the final operation of stable and smooth, You can choose a company like ours, contact us can see my personal information.
Introduction to the development of live Android mobile phone system