ApsaraVideo Live allows you to record live streams. You can store live recordings in Alibaba Cloud Object Storage Service (OSS) or Alibaba Cloud ApsaraVideo VOD (VOD). This topic describes how to store live recordings in OSS.

Prerequisites

An OSS bucket is created. For more information, see Configure OSS.

Note The OSS bucket must reside in the same region as the region in which the live center that you select is deployed when you add the domain name. Cross-region recording is not supported.

Background information

If you want to watch or modify the live stream after live streaming ends, you can use the live recording feature that is provided by ApsaraVideo Live. You must create a recording template before you store live recordings in OSS. You can configure parameters in the recording template. The parameters include the storage location, recording duration, storage format such as M3U8, MP4, or Flash Video (FLV), and whether to enable transcoded stream recording.

Notice You can store the recordings of a live stream only in VOD or OSS. For more information about how to store live recordings in VOD, see Store live recordings in ApsaraVideo VOD.

Create a recording template

  1. Log on to the ApsaraVideo Live console.
  2. In the left-side navigation pane, click Domains to go to the Domain Management page.
  3. Find the streaming domain that you want to configure and click Domain Settings.
    Domain name configuration
  4. Click Templates > Recording Settings > OSS > Add.
  5. Create a recording template.
    Recording template
    Table 1. Recording template
    Parameter Description
    Application Name The name of the video application. The value of the Application Name parameter must be the same as the application name that is specified in the ingest URL. Otherwise, the recording configuration does not take effect. If you want to record live streams for all applications in your domain name, enter a wildcard character (*).
    Stream Name You can store the recordings of a specific live stream in OSS by specifying the stream name. If you want to record all live streams under the application that you specified for the Application Name parameter, enter a wildcard character (*).
    Note The value of the Application Name parameter or the Stream Name parameter can be up to 255 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).
    Storage Location The storage location.
    Note Buckets include standard buckets and media buckets. Standard buckets are OSS buckets that are used for storage. Media buckets are buckets that are customized for ApsaraVideo for Media Processing. Videos that are stored in media buckets can be transcoded by ApsaraVideo for Media Processing. Standard buckets and media buckets are not distinguished in the bucket list. If you want to process input videos in ApsaraVideo for Media Processing, you must remember the name of the media bucket that you use. You can select the media bucket to store output videos.
    Storage Format Valid values: flv, m3u8, and mp4.
    Naming Conventions The default storage paths for live recordings in different formats.
    • M3U8: record/{AppName}/{StreamName}/{EscapedStartTime }_{EscapedEndTime }
    • TS: record/{AppName}/{StreamName}/{UnixTimestamp}_{Sequence}
    • MP4: record/{AppName}/{StreamName}/{EscapedStartTime }_{EscapedEndTime }
    • FLV: record/{AppName}/{StreamName}/{EscapedStartTime }_{EscapedEndTime }

    Example:

    If you set Application Name to liveApp**** and Stream Name to liveStream****, the storage path of live recordings in the M3U8 format is record/liveApp****/liveStream****/{EscapedStartTime}_{EscapedEndTime }.

    TS File Duration By default, the duration of a TS file is 30 seconds. The duration of a TS file can range from 5 to 30 seconds.
    Recording Duration The recording duration can range from 15 to 360 minutes. If the recording duration exceeds the specified duration, the system generates a new file based on the recording naming conventions.
    Note The recording duration specifies the maximum length of a VOD file that is converted from the specified live stream.
    222
    Table 2. Transcoded stream recording
    Parameter Description
    Transcoded Stream Recording Turn on Transcoded Stream Recording and configure the following parameters.
    Storage Format Valid values: flv, m3u8, and mp4.
    Naming Conventions The default storage paths for transcoded stream recordings in different formats.
    • M3U8: transcodeRecord/{AppName}/{StreamName}/{EscapedStartTime }_{EscapedEndTime }
    • TS: transcodeRecord/{AppName}/{StreamName}/{UnixTimestamp}_{Sequence}
    • MP4: transcodeRecord/{AppName}/{StreamName}/{EscapedStartTime }_{EscapedEndTime }
    • FLV: transcodeRecord/{AppName}/{StreamName}/{EscapedStartTime }_{EscapedEndTime }

    Example:

    If you set Application Name to liveApp****, Stream Name to liveStream****, and Transcoding Template ID to lld, the storage path of transcoded stream recordings in the m3u8 format is transcodeRecord/liveApp****/liveStream****_lld/{EscapedStartTime}_{EscapedEndTime }.

    TS File Duration By default, the duration of a TS file is 30 seconds. The duration of a TS file can range from 5 to 30 seconds.
    Recording Duration The recording duration can range from 15 to 360 minutes. If the recording duration exceeds the specified duration, the system generates a new file based on the recording naming conventions.
    Note The recording duration specifies the maximum length of a VOD file that is converted from the specified live stream.
    Transcoding Template ID You can select all transcoding templates or up to 10 individual transcoding templates.

    Make sure that the application name in the transcoding template is the same as the name in the recording template. Otherwise, the transcoding template does not take effect. If no transcoding templates are available, add a transcoding template. For more information, see Configure default transcoding.

  6. Click OK.

Configure recording callbacks

  1. Log on to the ApsaraVideo Live console.
  2. In the left-side navigation pane, click Domains to go to the Domain Management page.
  3. Find the streaming domain that you want to configure and click Domain Settings.
    Domain name configuration
  4. Choose Templates > Recording Settings.
  5. Click the OSS tab and then click the edit icon next to Callback URL:.
  6. In the Configure Callback URL dialog box, enter a callback URL.
  7. Click OK.

You can call the AddLiveRecordNotifyConfig operation to create a recording callback configuration for a streaming domain name. For more information, see AddLiveRecordNotifyConfig.

For more information about the callback methods and parameters, see Manage callbacks.

What to do next

You can view and manage recordings that are stored in an OSS bucket. For more information, see Manage recordings.