Welcome to Tencent Cloud + community, get more Tencent mass technology practice dry goods oh ~

The author of this article, RexChang (Chang Qing), is the technical director of Tencent Video Cloud terminal. He graduated and joined Tencent in 2008. He has been engaged in client r&d and has participated in PC QQ, mobile QQ, QQ Internet of Things and other product projects. Our product line includes: interactive live broadcast, on-demand, short video, real-time video call, image processing, AI and so on.

Recently, Tencent cloud mobile live broadcasting team has been “idle” to create small program audio and video solutions. One of our main businesses — show live broadcasting has been a little “idle” in the past few months. However, with the recent replenishment of manpower and the gradual stability of wechat version, we will further accelerate our pace in the live broadcast program. We hope that you can continue to maintain your recognition of us.

Today we are going to introduce the anchorman PK program. Through this article, we will come to understand what anchorman PK is. And how to quickly achieve the host between the PK?

What is Linmac PK?

Lianmai PK is the two anchors in the live broadcast, through mutual negotiation or background matching to enter the PK state. Once PK status, originally live alone two anchors, can video call each other. At the same time, the screen that the audience can see is also divided into two parts, from one anchor to two anchors. This live broadcast mode can increase the active atmosphere of the live broadcast room and bring more interaction to the platform.

  • Before entering PK: Two anchors independently push streams, each anchor has its own audience, and each audience sees only one anchor in their current live broadcast room.
  • After entering PK: Video calls can be made between two anchors. Audiences can only see one anchor before, but now they can see two anchors PK each other (video calls).

How to achieve lianmai PK

Let’s start with the initial requirements and see what the simplest implementation is. We can see from the front of a picture, to achieve a PK, the simplest answer isThe two anchors mixed the two screens together, as shown in the figure below:

Anchor A mixed the local(A) of her mobile phone camera with the remote(B) of anchor B from the Internet, encoded and compressed it again and pushed it to the cloud. In this way, the audience of anchor A can see anchor B’s image in the screen. At the same time, if host B performs similar operations, he can mix the screen of his own camera, Local (B), with the screen of host A from the Internet, remote(A). In this way, anchor B’s audience can see both A and B’s pictures at the same time.

But there’s a small problem with this approach — the host’s phone has too much to do:

  • Job 1: The mobile phone of the anchor needs to encode and compress the local camera images, which are transmitted to another anchor.
  • Job 2: The mobile phone of the anchor should decode and render the opposite screen from the network, which is from another anchor;
  • Job 3: the above two pictures should be superimposed together for the splicing of pictures.
  • Job 4: The assembled picture should be coded again and pushed to the audience so that the audience can see the two pictures.

How to solve the performance problem?

To solve the performance problem, what we need to do is to lighten the load on the anchor.

So how do you reduce the burden? Can we get rid of job one and job two?

No, no, no. These two jobs are for video calls, and if you take them off, there’s no way to talk about the PK of the anchor.

Are job 3 and job 4 ok subtract?

We can’t subtract it, but we can move it to the cloud and do the splicing and calculation on the server instead of on the terminal.

As shown in the image above: When anchor A and anchor B begin to PK, the audience on both sides will no longer continue to watch from the original line, but from the new real-time audio and video cloud streaming (the orange arrow in the image above). This way, we can mix and re-encode images in the cloud.

However, this scheme is not the most perfect, because in the process of entering PK state from ordinary live broadcast, the picture of the audience will be stuck for a period of time due to the reason of line switching.

Tencent cloud even mai PK scheme

Tencent cloud lianmai PK solution is a good solution to the line switching problem:

Tencent cloud has both conventional live broadcasting solutions supporting Douyu and Huya and years of ACCUMULATION of QQ video calling technology, so Tencent’s video cloud itself is a hybrid cloud, which can not only realize conventional CDN distribution of live broadcasting, but also support high-quality and low-delay real-time audio and video lines. Therefore, our plan is very clear and simple: directly superimpose PK pictures on the original live broadcast line:

In this way, the audience originally watching anchor A and anchor B will not encounter any screen reloading and lag waiting, but will see the original picture divided into two parts and naturally enter the PK state.

The supporting technology behind the solution

Tencent Cloud adopts two sets of audio and video channels to realize the function of anchors connecting MCPK. One set is the CDN line adopted by standard live broadcasting, with low bandwidth cost and no concurrent limitation. The video calls that PK anchors rely on adopt private UDP transmission protocol and use dedicated lines specially prepared to reduce communication delay.



Quick access to live PK function

If you want to use the live PK function of Tencent Cloud, you can refer to our access documentationLiveRoom(PK). In particular, this package also supportsConnecting the audience with the anchor, and the terminal and background code are open source, support self-deployment, can let you have a very full customization space.

What audio and video solutions can q&A applet achieve? Yang Chunwen: How to realize hand-painted gifts in live broadcast? Besides live streaming, what other ways can VR+ Sports open?


This article has been published by Tencent Cloud + community authorized by the author.Cloud.tencent.com/developer/a…