ApsaraVideo Live allows you to record live streams. You can store recording files in Object Storage Service (OSS) or ApsaraVideo VOD (VOD). This topic describes how to store recording files 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 recording files in OSS. You can configure parameters in the recording template. The parameters include the storage location, recording cycle, storage format such as M3U8, MP4, or Flash Video (FLV), and whether to enable transcoded stream recording.

Important You can store the recording files of a live stream in either VOD or OSS. For information about how to store recording files in VOD, see Store recording files 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.
    001
  4. Choose Templates > Recording Settings > OSS > Add.
  5. Create a recording template.
    Recording template
    Table 1. Recording template parameters
    Parameter Description
    Application Name The name of the application. The value of the Application Name parameter must be the same as the application name specified in the ingest URL. Otherwise, the configuration does not take effect. If you want to record live streams for all applications under your domain name, enter a wildcard character (*).
    Stream Name You can store the recording files of a specific live stream in OSS by specifying the stream name. If you want to record all live streams in the application that is specified by 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 Media Processing. You can use ApsaraVideo Media Processing to transcode videos that are stored in media buckets. Standard buckets and media buckets are not distinguished in the bucket list. If you want to process input videos in ApsaraVideo 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 recording files 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 recordings in the M3U8 format is record/liveApp****/liveStream****/{EscapedStartTime}_{EscapedEndTime }.

    TS File Duration By default, the length of a TS segment is 30 seconds. The length of a TS segment can range from 5 to 30 seconds.
    Recording Cycle The recording cycle can range from 15 to 360 minutes. If the specified recording cycle is exceeded, the system generates a new file based on the recording naming rule.
    Note The recording cycle specifies the maximum length of a VOD file that is converted from the specified live stream.
    222
    Table 2. Parameters for 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 recording files 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 length of a TS segment is 30 seconds. The length of a TS segment can range from 5 to 30 seconds.
    Recording Cycle The recording cycle can range from 15 to 360 minutes. If the specified recording cycle is exceeded, the system generates a new file based on the recording naming rule.
    Note The recording cycle 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 application 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

Note

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

For more information about the callback methods and parameters, see Manage 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.
    001
  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. The callback URL must belong to your account.
  7. Click OK.

Disable the recording feature

If you do not need to use the recording feature, you can delete the added recording templates to disable the feature.

If live streaming is in progress when you delete a template, ApsaraVideo Live continues to record based on the template. The deletion takes effect for subsequent ingested streams.

What to do next

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