Recording to VOD and Processing Video

Last updated: 2021-11-19 11:12:36

    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.

    Features

    • Based on the capabilities of CSS, it can quickly record and store live streaming content on the VOD platform for secondary production and distribution.
    • Relying on Tencent Cloud's leading AI technologies in audio and video and globally deployed cache nodes, it provides top-notch audiovisual services such as professional and stable live push, transcoding, distribution, and playback that fully meet the requirements for ultra-low latency, ultra-high image quality, and ultra-high performance to sustain massive volumes of concurrent requests.
    • It can quickly distribute your live streaming events to various scenarios and applications.
    • It is suitable for many industry-specific scenarios such as corporate live streaming, ecommerce live streaming, and education live streaming. It can deliver video content through many channels such as Tencent Video.

    Prerequisites

    • You have signed up and logged in to a Tencent Cloud account, and completed identity verification. Unverified users cannot purchase instances of live recording to VOD for Chinese mainland.
    • You have activated both the CSS and VOD services. If not, please go to CSS and VOD consoles to activate.

    Directions

    Step 1. Create a recording template

    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:

      1. Log in to the CSS console and select Feature Configuration > Live Recording.

      2. 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.

      3. 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.

    Step 2. Select a recording scheme

    CSS offers the following schemes for calling the live recording feature in different scenarios:

    Scheme 1. Specified domain name global recording

    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:

      1. 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.

        1. 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.

        2. Pass in the template ID of the recording template and the push domain name through the CreateLiveRecordRule API.

    Scheme 2. Specified stream recording

    You can bind your live recording template to a specified live stream through an API for recording.

    • Use cases: event live streaming, exhibition live streaming, sports live streaming, and live streaming through co-anchoring.
    • Steps: you can create a recording rule through the CreateLiveRecordRule API by passing in the template ID of the recording template and the target domain name, path, and StreamName (exact matching is required). This way you can bind your recording template to a specified live stream.

    Scheme 3. Specified time period recording

    You can set the start time and end time through API calls to initiate a task for recording within the specified time period.

    • Use cases: news live streaming and event live streaming.
    • Steps: you can create a recording task through the CreateRecordTask API by passing in the template ID of the recording template and the target domain name, path, StreamName (exact matching is required), and start time and end time for recording.
    • Example:
      1. 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>
        
      2. 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.
      3. 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}}
        
      4. 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>
        

    Scheme 4. Real-time recording (stream mix-based recording is supported)

    You can record any frame of a stream in real time through API calls.

    • Use cases: scenarios where only segments need to be recorded (or clipped after global recording), such as sports live streaming and game live streaming.
    • Steps: you can create a recording task through the CreateRecordTask API by passing in the template ID of the recording template and the target domain name, path, StreamName (exact matching is required), and end time for recording.
    • Example:
      https://live.tencentcloudapi.com/?Action=CreateRecordTask&StreamName=test&AppName=live&DomainName=mytest.live.push.com&EndTime=1597024800&<common request parameters>
      

    Scheme 5. Audio-only recording

    You can configure audio recording in .acc format if only audio is pushed.

    • Use cases: audio live streaming and audio mic connect.
    • Steps: you can select the .aac format as the recording file type and bind the corresponding push address when creating a recording template.
      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.

    Step 3. Push a live stream

    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 CSS 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.

    Step 4. Get a recording file

    You can query and get a recording file through:

    • Recording callback: before pushing a live stream, you need to configure a callback template (with a recording callback address). The file will be sent to the callback server through a callback when the recording file is generated. For more information, please see Recording Event Notification.
    • VOD console: you can query a recording file in the VOD console. For more information, please see Viewing Videos.
    • VOD API: you can call the SearchMedia API to query files.

    Step 5. Process a recording file

    Scheme 1. Live recording + automatic transcoding + video playback acceleration

    • Use cases: the recording file of a live stream can be immediately transcoded and accelerated automatically for viewers to play back on demand. This scheme is suitable for most live streaming scenarios where no video processing is required.
    • Steps:
      1. When creating a recording template before a live stream is pushed, click Advanced Configuration to configure a task flow.
      2. Bind the template to a task flow created in the VOD console.
      3. Push the live stream. For details, see CSS Push.
      4. After the recording is finished, get the FileId.
      5. Get the URL for playback.

    Scheme 2. Live recording + manual transcoding + video playback acceleration

    • 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:

      1. Push a live stream. For details, see CSS Push.
      2. Record the file automatically to VOD.
      3. Get the FileId.
      4. Configure a transcoding template or task flow to manually transcode the stream. For details, see Template Settings.
      5. Process the video based on your needs.
      6. Get the URL for subsequent playback after the transcoding and processing are finished.

    Scheme 3. Live recording + adaptive bitrate streaming + video delivery acceleration + superplayer

    • 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:

      1. Push a live stream. For details, see CSS Push.
      2. Record the file automatically to VOD.
      3. Get the VOD FileId.
      4. Configure a task flow to generate an adaptive bitrate stream. For details, see Task Flow Settings.
      5. Configure the superplayer: select the adaptive bitrate stream generated for playback.
      6. Play back the video through FileId.