CSS Recording

Last updated: 2021-03-12 11:06:37

    CSS supports recording live streams and storing recording files in VOD for download and preview. This document describes how to create, bind, unbind, modify, and delete recording templates.
    You can create a recording template in the following two methods:


    • The recorded video files are stored in the VOD console by default. We recommend you activate the VOD service in advance. For more information, please see Getting Started with VOD.
    • After enabling the recording feature, please make sure that your VOD service is in normal status. If it is not activated or is suspended due to overdue payment, CSS recording will not be available, no recording files will be generated, and no recording fees will be incurred.
    • During the live streaming, you can get a recording file in about 5 minutes after the recording process ends. For example, if a recording starts at 12:00 and ends at 12:30, you can get the segment of 12:00-12:30 at around 12:35.
    • As video format only supports .flv, .mp4, and .hls, video codec can only be H.264 and audio codec can only be AAC.
    • After a recording template is created successfully, it can be bound with push domain names. For more information, please see Recording Configuration. The binding will take effect in about 5-10 minutes.
    • For the naming rules of generated recording files, please see VodFileName.
    • Binding, unbinding, and modifying a template affect only new live streams after the update but not ongoing ones. To make the new rule take effect for ongoing live streams, you need to interrupt them and push them again.


    Creating a Recording Template

    1. Log in to the CSS console and select Feature Configuration > CSS Recording.
    2. Click Create Recording Template to set template information and configure as follows:
      Configuration ItemConfiguration Description
      Default Template Default template type for CSS recording, which can be FLV, MP4, or HLS.
      Template Name Custom CSS recording template name, which can contain letters, digits, underscores (_), and hyphens (-).
      Template Description Custom CSS recording template description, which can contain letters, digits, underscores (_), and hyphens (-).
      Recording File Type Videos are recorded in the original bitrate of the live stream and can be outputted in formats of .hls, .mp4, .flv, and .aac (for audio recording).
      Single File Duration (min)
      • There is no upper limit for .hls format. If the recording duration of a file exceeds the timeout period for resumption, a new file will be created to continue recording.
      • The duration of a single file recorded in .mp4, .flv, or .aac format ranges from 5 to 120 minutes.
      Retention Period (day) A single recording file can be retained up to 1,080 days. A retention period of 0 means "never expire".
      Resumption Timeout Period (sec) Only the .hls format supports recording resumption after push interruption, and the timeout period for resumption can be set between 0 and 1800 seconds.
      Recording to Subapplication Live streams can be recorded to a specified subapplication in VOD. They are recorded to the primary application under the account by default. Only writable subapplications are supported.
    3. Click Save.

    Binding a Template with Domain Names

    1. Log in to the CSS console and select Feature Configuration > CSS Recording.
      • Directly bind a domain name: click Bind Domain Name in the top-left corner.
      • Bind a domain name after creating a recording template: after successfully creating a recording template, click Bind Domain Name in the pop-up window.
    2. Select a recording template and a push domain name in the domain name binding window and then click Confirm.


    You can click Add to bind multiple push domain names with this template.

    Unbinding a Template from a Domain Name

    1. Log in to the CSS console and select Feature Configuration > CSS Recording.
    2. Select a recording template with bound domain names, and click Unbind for the target domain name.
    3. Confirm whether to unbind the domain name and click Confirm to unbind it.


    • Unbinding the recording template will not affect ongoing live streams.
    • To make the unbinding take effect, interrupt ongoing live streams and push them again. The new live streams will not generate recording files.

    Modifying a Template

    1. Go to Feature Configuration > CSS Recording.
    2. Select the target recording template and click Edit on the right to modify the template information.
    3. Click Save.

    Deleting a Template

    1. Go to Feature Configuration > CSS Recording.
    2. Select the target recording template and click at the top.
    3. Confirm whether to delete the selected recording template and click OK to delete it.


    • If the template has been bound with domain names, you need to unbind the template before deleting it.
    • The recording templates are managed at the domain name level in the console, and rules created by APIs cannot be canceled there for the time being. If you have bound the recording configuration with a specified stream through the recording management API and want to unbind them, you need to call the DeleteLiveRecordRule API.


    For more information about binding and unbinding a domain name with a recording template, see Recording Configuration.


    How are videos generated by CSS recording named?

    Recording files generated by the callback of a recording template created in the console are named in the following format by default:

    Placeholder Description
    {StreamID} Stream ID
    {StartYear} Start time - year
    {StartMonth} Start time - month
    {StartDay} Start time - day
    {StartHour} Start time - hour
    {StartMinute} Start time - minute
    {StartSecond} Start time - second
    {EndYear} End time - year
    {EndMonth} End time - month
    {EndDay} End time - day
    {EndHour} End time - hour
    {EndMinute} End time - minute
    {EndSecond} End time - second