Live recording is a solution that stores the files remuxed from original streams (without modifying audio/video data, timestamp etc.) to VOD, and then processes, distributes, plays back the recorded files. For details, see Live Recording.
To use the live recording feature, you need to create a recording template first. The configuration of live recording is saved in the recording template. You can create recording templates with different configurations to record files into different formats or of different durations.
Creation in the console:
Log in to the CSS console and select Feature Configuration > Live Recording.
Click Create Recording Template and select the desired recording file type (select at least one). For more information on the configuration items, please see Creating a Recording Template.
Click Save to create a template.
Creation through an API:
You can call the CreateLiveRecordTemplate API to create a recording template. The corresponding template ID will be returned after the template is created successfully.
CSS offers the following schemes for calling the live recording feature in different scenarios:
You can bind your live recording template to a push domain name in the CSS console or by calling an API, and streams pushed through the domain name will be recorded automatically.
Use cases: show live streaming, e-commerce live streaming, online classroom, and video surveillance.
Steps:
After creating a recording template, you will be prompted to bind a domain name. You can click Bind Domain Name and select a push domain name.
In Domain Management, click your live push domain name to enter the push details page. Select Template Configuration > Recording Configuration and click Edit to bind the push domain name. For more information, please see Binding Recording Template.
Pass in the template ID of the recording template and the push domain name through the CreateLiveRecordRule API.
You can bind your live recording template to a specified live stream through an API for recording.
StreamName
(exact matching is required). This way you can bind your recording template to a specified live stream.You can set the start time and end time through API calls to initiate a task for recording within the specified time period.
StreamName
(exact matching is required), and start time and end time for recording.In the simplest case, you only need to specify StreamName
, DomainName
, AppName
, and EndTime
to record live streams.
The following sample code creates a video recording task in .flv format for 8 AM to 10 AM, August 10, 2020, with 30-minute segments, and the recording files will be retained permanently.
Sample request:
https://live.tencentcloudapi.com/?Action=CreateRecordTask&AppName=live&DomainName=mytest.live.push.com&StreamName=livetest&StartTime=1597017600&EndTime=1597024800&TemplateId=0&<common request parameters>
You can also specify the recording format, recording type, and storage parameters.
The following sample code creates a recording task in .mp4 format for 8 AM to 10 AM, August 10, 2020, with 1-hour segments, and the recording files will be retained permanently.
Call the CreateLiveRecordTemplate API to create a recording template.
Sample request:
https://live.tencentcloudapi.com/?Action=CreateLiveRecordTemplate&TemplateName=templat&Description=test&Mp4Param.Enable=1&Mp4Param.RecordInterval=3600&Mp4Param.StorageTime=0&<common request parameters>
Sample response:
{"Response": {"RequestId": "839d12da-95a9-43b2-a9a0-03366d01b532","TemplateId": 17016}}
Call the CreateRecordTask API to create a recording task.
Sample request:
https://live.tencentcloudapi.com/?Action=CreateRecordTask&StreamName=livetest&AppName=live&DomainName=mytest.live.push.com&StartTime=1597017600&EndTime=1597024800&TemplateId=17016&<common request parameters>
You can record any frame of a stream in real time through API calls.
https://live.tencentcloudapi.com/?Action=CreateRecordTask&StreamName=test&AppName=live&DomainName=mytest.live.push.com&EndTime=1597024800&<common request parameters>
You can configure audio recording in .acc format if only audio is pushed.
Note:A binding rule will take effect in about 5 to 10 minutes after creation. Any change of the binding rule will not affect live streams that are being pushed and will apply only to new live streams.
After binding the recording template with the push domain name as instructed in Step 2, generate the corresponding push domain name from the push address and start live push.
After the live stream is over, the recording file will be stored on the VOD platform.
Note:
- If you have selected "Recording to subapplication" in your recording template, the recording file will be stored in the corresponding subapplication.
- If you want to call back the address information of the recording file, you need to create a callback template before the push, enter the recording callback address and save it, and bind the target push domain name. For more information, please see Recording Event Notification.
You can query and get a recording file through:
FileId
.Use cases: if you only want to store the recording file of a live stream to VOD without transcoding it right away, you can create a recording task without adding other operations. If you want to transcode the video later, you can trigger the transcoding operation manually and use the on-cloud clipping feature in combination to achieve better results.
Steps:
FileId
.Use cases: if you have high requirements for video security that cannot be satisfied through HLS encryption, you can use self-adaption and superplayer in combination to further enhance the video security. This scheme is highly suitable for online education and corporate training.
Steps:
FileId
.FileId
.
Was this page helpful?