The Snapshots feature captures periodic images from live streams in real time and stores them as JPG files in Object Storage Service (OSS).
How it works
Configure -- Set up a snapshot template for your streaming domain in the ApsaraVideo Live console or through the API.
Push -- Start or restart the stream ingest to activate the template.
Capture and store -- ApsaraVideo Live captures snapshots at the configured interval and stores them in OSS.
View and manage -- Browse, download, or delete snapshots from the console, the API, or directly in OSS.
Prerequisites
Before you begin, make sure that you have:
An activated OSS instance. For more information, see Activate OSS
At least one OSS bucket to store snapshot files. For more information, see Create a bucket
The OSS bucket must be in the same region as the live center of the streaming domain. Cross-region snapshots are not supported.
Configure snapshot settings
Snapshots are configured per AppName. A snapshot rule applies to all stream ingests under the specified AppName. Set AppName to an asterisk (\*) to apply the rule to all stream ingests under the domain name.
Two snapshot types are available. Select one or both -- at least one type is required.
| Type | Behavior |
|---|---|
| Overwrite | Each new snapshot replaces the previous one. |
| Real-time | Each new snapshot is saved alongside previous ones. Snapshots accumulate incrementally. |
Only the JPG format is supported.
A newly configured snapshot template does not apply to ongoing live streams. Restart the stream ingest for the template to take effect.
Console
Log on to the ApsaraVideo Live console.
In the navigation pane on the left, choose Feature Management > Snapshots. On the Snapshots page, click the Snapshot Settings tab.
Select the streaming domain to configure.
Click Add.
Configure the snapshot template parameters described in the following table.
Parameter Description Application Name The application name. Must match the AppNameused for stream ingest. Enter an asterisk (\*) to configure snapshots for the entire domain.Snapshot Interval The interval between snapshots, in seconds. Valid values: 5 to 3600. Storage Location The OSS bucket where snapshot files are stored. The bucket must be in the same region as the live center of the streaming domain. Storage Mode Select one or both modes: Overwrite -- Each new snapshot replaces the previous one. New -- Snapshots are stored sequentially in N+1 (N>=0) order. If both modes are selected, snapshots are captured using both methods. Click OK.
API
Call the AddLiveAppSnapshotConfig operation to configure snapshot settings.
View snapshot files
Console
Log on to the ApsaraVideo Live console.
In the navigation pane on the left, choose Feature Management > Snapshots. On the Snapshots page, click Snapshot Management.
Select the domain name and time range. Then, enter or select the
AppNameandStreamName.Click Search to view snapshots within the selected time range.
NoteIf snapshots are not visible, verify that the access control list (ACL) of the OSS bucket is set to public-read. For more information, see Configure the ACL of an OSS bucket.
Hover over an image to view a larger version or copy the snapshot URL.
API
Call the DescribeLiveStreamSnapshotInfo operation to query snapshot files.
OSS
Open the OSS bucket that you specified when configuring the snapshot feature. Browse the snapshot files directly. For more information, see List objects in OSS.
Delete snapshot files
ApsaraVideo Live stores snapshot metadata (such as AppName, StreamName, and the OSS storage path). The actual snapshot files reside in OSS. To delete the files from OSS when deleting snapshots through the ApsaraVideo Live console, first authorize ApsaraVideo Live to access OSS by creating a service role.
Authorize ApsaraVideo Live to delete OSS files
Create the AliyunMTSVideoLifecycleRole service role and attach the AliyunMTSVideoLifecycleRolePolicy system policy. This authorization is required before deleting snapshots or recordings from the ApsaraVideo Live console.
Create the service role
Log on to the Resource Access Management (RAM) console as a RAM administrator.
In the navigation pane on the left, choose Identities > Roles.
On the Roles page, click Create Role.
Set Principal Type to Cloud Service.
From the Principal Name drop-down list, select ApsaraVideo Media Processing.
Click OK.
In the Create Role dialog box, enter
AliyunMTSVideoLifecycleRolein the Role Name field and click OK.
Attach the system policy
After the role is created, on its Basic Information page, click the Permissions tab.
Click Precise Permission.
Configure the following parameters:
Policy Type: System Policy
Policy Name:
AliyunMTSVideoLifecycleRolePolicy
Click OK.
Console
Log on to the ApsaraVideo Live console.
In the navigation pane on the left, choose Feature Management > Snapshots. On the Snapshots page, click Snapshot Management.
Select the domain name and time range. Then, enter or select the
AppNameandStreamName.To delete a single snapshot, hover over the image and click the delete icon.
To delete multiple snapshots at once, select the snapshots and click Batch Delete.
A maximum of 200 snapshots can be deleted at a time.
API
Call the DeleteSnapshotFiles operation to delete snapshot files. This operation also deletes the corresponding files from OSS.
Custom deletion policies
Configure snapshot callbacks to save snapshot information (including timestamps) to your business system. Then, delete files based on a custom policy such as scheduled cleanup. For more information, see Live stream snapshot callbacks.