Advanced features in Live Streaming with Tencent Cloud CSS

Tencent Cloud Team
Tencent Cloud
Published in
6 min readNov 29, 2023

In the previous blog, I introduced some common and basic capabilities in the live streaming scenario, including the live transcoding and live recording features. For the modern live streaming platforms, some advanced features are also required in order to give viewers a better user experience which could also greatly reduce the effort and complexity of the platform developers.

In this blog, I will give you a quick guidance on the advanced features for modern live streaming platforms with Tencent Cloud CSS and other related products. Those features are as follows:

  • Live streaming watermark
  • Live streaming time-shifting
  • Live streaming highlights editing
  • Live streaming screen capture
  • Live streaming mix

Prerequisites:

  • You have already activated the CSS product and created your own push and playback domain.
  • You have already activated the VoD product.

1) Live streaming watermark

You can create a watermark template in the following ways:

Log in to the CSS console and select Feature Configuration > Live Watermarking, and Create Watermark Template.

Bind a domain name after creating the watermark template: after the watermark template is created, click Bind Domain Name in the pop-up window.

2) Live Streaming time-shifting

Time-shifting is powered by the recording capability of CSS. It allows users to rewind and play earlier parts of a live stream. This is commonly used to play back highlights of live streamed sports events.

CSS enables time-shifting by saving live streams as TS segments and information about the playback time of each TS segment in the cloud. This feature is often used to replay TV programs or highlights of sports events. Content is distributed to clients over HLS. You can specify the exact playback time by setting the M3U8 request parameters.

Log in to the CSS console and select Feature Configuration > Time Shifting on the left sidebar.

Click Create template to set the template information and configure the following settings:

Bind a domain after creating a template: After creating a template, click Bind Domain Name in the dialog box that pops up.

Select a time shifting template and a push domain and then click Confirm.

3) Live streaming highlights editing

Live streaming highlights relies on the time-shifting capabilities, which means that during or after the live stream, a viewer can select an exciting segment from the past live content, generate a time-shifted playback address, and conveniently redistribute the highlights. Additionally, through media processing capabilities, live streaming highlights can be solidified into object storage for long-term preservation.

After using the domain name bound to the time-shifting template for streaming, select Feature Configuration > Time shifting > Time shifting details in the left menu bar to enter the index information page.

Select the live stream you want to clip, and click on Details on the right side to enter the time-shift details page.

4) Live streaming screen capture

The live screen capture feature takes screenshots of a real-time live stream at regular intervals and generates images. You can get the screenshot information through the callback notification. These screenshots have various uses, such as porn detection and thumbnails.

You can specify the screen capturing frequency based on your business needs, i.e., the screen capturing interval (SnapshotInterval). The available range is between 2–300 seconds with a default interval of 2 seconds.

Log in to the CSS console, and select Feature Configuration > Live Screencapture & Porn Detection on the left sidebar. Click “Create Screen Capture” and “Porn Detection Template”. If it is the first time you do so, click “Authorize Now” to create a service role and grant CSS read and write access to COS so that screenshots can be stored in COS.

Bind a domain name after creating a screen-capture and porn detection template: After successfully creating a screen-capture and porn detection template, click Bind Domain Name in the pop-up window.

5) Live streaming mix

CSS provides a live stream mix feature, which can synchronously mix multiple streams of input sources into a new stream based on the configured stream mix layout for interactive live streaming. In addition, the stream mix feature has been connected to TencentCloud API 3.0.

Supported Features:

  • Up to 16 concurrent streams can be mixed.
  • Up to 5 types of input sources (audio and video, pure audio, pure video, image, and canvas) can be mixed.
  • Mixed streams can be output as a new stream.
  • Cropping and watermarking are supported.
  • Template configuration is supported.
  • Recording based on stream mix is supported.
  • Automatic stream mix is supported.
  • Stream mix types and positions can be switched in real time.
  • Stream mix can be started/canceled seamlessly.

Common templates include 10, 30, 40, 310,410, 510, and 610. When using them, you do not need to enter the position and length/width parameters of the input stream, and the original image will be auto-scaled. You only need to pass in the template ID.

Scenario 1. Applying for stream mix — using template 20

This example shows you how to use a preset stream mix template to mix streams.

Sample input code:

Sample output code:

Stream mix effect for mic connect:

For more detailed information and configuration, you can refer to Stream Mix for full supported documentation.

Author: Hang Zhang

Hang Zhang is a Principal Solution Architect of Tencent Cloud. He is taking charge of business development of Tencent Cloud International in Canada, and focusing on Go-China & Gaming strategy for companies headquartered in Canada.

--

--

Tencent Cloud Team
Tencent Cloud

Tencent Cloud technical team has the experience with global customers, and wants to share the best practices.