The Snapshots feature captures periodic images from live streams and stores them as JPG files in Object Storage Service (OSS), giving you a durable record of stream content for content review, thumbnail generation, and compliance archiving.
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 stream ingest to activate the template.
Capture and store — ApsaraVideo Live captures snapshots at the configured interval and saves them as JPG files in your OSS bucket.
View and manage — Browse, download, or delete snapshots from the console, the API, or directly in OSS.
Prerequisites
Before you begin, make sure you have:
An activated OSS instance. For more information, see Activate OSS.
An OSS bucket to store snapshot files, located in the same region as the live center of your streaming domain. 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.
Select one or both storage modes — at least one is required:
|
Storage mode |
Behavior |
|
Overwrite |
Each new snapshot replaces the previous one. Use this to always have the latest frame available at a fixed URL. |
|
Real-time |
Each new snapshot is saved alongside previous ones. Snapshots accumulate incrementally. Use this to retain the full history. |
Only the JPG format is supported.
A newly configured snapshot template does not apply to ongoing live streams. Restart stream ingest for the template to take effect.
Console
Log on to the ApsaraVideo Live console.
In the left navigation pane, 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.
Parameter
Description
Application Name
The application name. Must match the
AppNameused for stream ingest. Enter an asterisk (\*) to apply to all streams under the domain.Snapshot Interval
How often a snapshot is captured, in seconds. Valid values: 5 to 3600.
Storage Location
The OSS bucket where snapshot files are stored. 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 left navigation pane, 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 list 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 you specified when configuring the snapshot feature and browse 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 files from OSS when deleting snapshots through the 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 left navigation pane, 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, then click OK.
Attach the system policy
After the role is created, go to its Basic Information page and 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 left navigation pane, 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.
Schedule automatic deletion
Configure snapshot callbacks to save snapshot metadata (including timestamps) to your own system, then delete files on a custom schedule. For more information, see Live stream snapshot callbacks.