ApsaraVideo Live provides the live stream recording feature that allows you to record an ingested stream received by a live center and store the recordings in a specified storage location in Object Storage Service (OSS) based on the configured recording rules. You can record the stream to video files in the M3U8, MP4, and Flash Video (FLV) formats. This topic describes how to store recordings in OSS.
Prerequisites
An OSS bucket is created. For more information, see Configure OSS.
The OSS bucket must reside in the same region as the live center of the domain name. Cross-region recording is not supported.
Background information
If you want to play or modify the content of a live stream after it ends, you can use the live stream recording feature that is provided by ApsaraVideo Live. You must create a recording template before you can store recordings in OSS. You need to configure parameters in the recording template. The parameters include the storage location, recording cycle, storage format such as M3U8, MP4, or FLV, and whether to enable transcoded stream recording.
You can store the recordings of a live stream in either OSS or ApsaraVideo VOD. For more information about how to store recordings in ApsaraVideo VOD, see Store recordings in ApsaraVideo VOD.
Create a recording template
- Log on to the ApsaraVideo Live console.
- In the left-side navigation pane, click Domains to go to the Domain Management page.
Find the streaming domain that you want to configure and click Domain Settings in the Actions column.
Choose . Click the OSS tab and click Add.
Configure the 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 in all applications under your domain name, enter an asterisk (*).
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 in the application that is specified by the Application Name parameter, enter an asterisk (*).
NoteThe value of the Application Name or Stream Name parameter can be up to 255 characters in length and can contain letters, digits, hyphens (-), and underscores (_).
Storage Location
The storage location.
NoteBuckets 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 so that you can select the media bucket to store output videos.
Interruption Duration for Merge
If the stream interruption duration exceeds the specified duration, a new recording file is generated. The value of this parameter ranges from 15 to 21600 seconds.
Storage Format
Valid values: flv, m3u8, and mp4.
Naming Conventions
The naming conventions for the storage paths of recordings in different formats. Default values:
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
The duration of a TS segment. Default value: 30. Valid values: 5 to 30. Unit: 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 recording file based on the recording naming rule.
NoteThe recording cycle specifies the maximum length of a VOD file that is converted from the specified live stream.
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 naming conventions for the storage paths of recordings in different formats. Default values:
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
The duration of a TS segment. Default value: 30. Valid values: 5 to 30. Unit: 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 recording file based on the recording naming rule.
NoteThe 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 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. If no transcoding template is available, add a transcoding template first. For more information, see Configure default transcoding.
Click OK.
Configure recording callbacks
You can call the AddLiveRecordNotifyConfig operation to configure recording callbacks for a domain name. For more information, see AddLiveRecordNotifyConfig.
For information about the callback methods and parameters, see Manage callbacks.
- Log on to the ApsaraVideo Live console.
- In the left-side navigation pane, click Domains to go to the Domain Management page.
Find the streaming domain that you want to configure and click Domain Settings in the Actions column.
Choose .
Click the OSS tab and then click the edit icon next to Callback URL:.
In the Configure Callback URL dialog box, enter a callback URL. The callback URL must belong to your account.
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.
FAQ
What to do next
You can view and manage recordings that are stored in an OSS bucket. For more information, see Manage recordings.
References
If you want to edit and process the content of a live stream, you can store the recordings in ApsaraVideo VOD. For more information, see Store recordings in ApsaraVideo VOD.