Live stream snapshot

更新时间:
复制 MD 格式

The Snapshots feature allows you to take real-time snapshots while you watch a live stream. This topic describes the video Snapshots feature in detail.

Prerequisites

The Snapshots feature requires snapshot files to be stored in a bucket. Therefore, you must activate the OSS service and have at least one bucket to store these snapshot files. For more information, see Activate OSS Service and Create a Bucket.

Important

The bucket must be in the same region as the live center of the ingest domain. Cross-region snapshots are not supported.

Snapshot rules

  • Snapshots is configured for stream ingest at the AppName level. You can set snapshot rules for all stream ingests under a specific AppName.

    Note

    If you set AppName to an asterisk (*), the snapshot rule applies to all stream ingests under the ingest domain.

  • When you configure the Snapshots feature, you can define two types of snapshots: overwrite snapshots and real-time snapshots.

    • An overwrite snapshot replaces the previous snapshot file each time a new snapshot is generated.

    • A real-time snapshot does not overwrite previous snapshot files. Each new snapshot is stored as an incremental file.

    • Currently, Snapshots can be generated only in JPG format.

      Note

      You can select both modes, but you must select at least one.

Snapshot configuration and management

Note

A newly configured snapshot template does not apply to ongoing live streams. You must restart the stream ingest for the changes to take effect.

Snapshot configuration

You can configure the video Snapshots feature in the following two ways:

Configure snapshots in the console

  1. Log on to the ApsaraVideo Live console.

  2. In the left navigation bar, select Feature Management > Snapshots. On the Snapshots page, select the Snapshot Settings tab.

  3. Select the ingest domain that you want to configure.

  4. Click Add.

  5. Configure the snapshot template.

    The following table describes the parameters for the snapshot template.

    Parameter

    Description

    Application Name

    The application name. This setting takes effect only if the entered Application Name matches the Application Name used for live stream ingest. To configure snapshots at the domain level, enter an asterisk (*).

    Snapshot Interval

    The interval at which to capture snapshots. Unit: seconds. Valid values: 5 to 3600.

    Storage Location

    Select the location in OSS to store the snapshot files.

    The OSS bucket must be in the same region as the live center of the ingest domain. Cross-region snapshots are not supported.

    Storage Mode

    Two storage modes are available. You can select one or both.

    • Overwrite: Snapshots are captured at the specified interval. Each new snapshot overwrites the previous one.

    • New: Snapshots are captured at the specified interval. New snapshots are stored sequentially in an N+1 order, where N ≥ 0.

    Note

    If you select both modes, snapshots are generated and stored in both ways.

    Note

    After the configuration is complete, screenshots will be taken and stored for all configured Application Names under this domain name according to the configured template.

    Changes to the snapshot settings take effect after the next stream ingest.

  6. Click OK.

Configure snapshots by using an API

Call the AddLiveAppSnapshotConfig operation to configure the snapshot feature.

Snapshot file management

Viewing snapshots

You can view snapshot files in three ways:

View snapshot files in the console

  1. Log on to the ApsaraVideo Live console.

  2. In the left navigation bar, select Feature Management > Snapshots. On the Snapshots page, select Snapshot Management.

  3. Select the domain and time range for your query. Then, enter or select the AppName and StreamName.

  4. Click Search to view the snapshots within the selected time range. If you cannot view the snapshots, make sure the permissions for the OSS bucket are set to public-read. For more information, see Configure OSS bucket ACLs.

    On the Snapshot Management tab, you can filter snapshots by date, AppName, and StreamName.

  5. Hover over an image to view a larger version or copy the snapshot URL.

View snapshot files by using an API

Call the DescribeLiveStreamSnapshotInfo operation to view snapshot files.

View snapshot files in OSS

When you configured the snapshot feature, you specified the storage path in OSS. To view snapshot files in OSS, see List objects.

Deleting snapshots

ApsaraVideo Live stores snapshot file metadata, such as the AppName, StreamName, and OSS storage path. The actual files are stored in OSS. To delete the files in OSS when you delete their corresponding snapshot records in ApsaraVideo Live, you must create the AliyunMTSVideoLifecycleRole service role and grant it permissions by using the AliyunMTSVideoLifecycleRolePolicy system policy.

Authorization procedure

Before you can delete snapshots or recordings in the ApsaraVideo Live console, you must grant the required permissions. Follow these steps to create and authorize a Resource Access Management (RAM) role in the RAM console, and then return to the ApsaraVideo Live console to delete the files.

Create a service role

  1. Log on to the RAM console as a RAM administrator.

  2. In the navigation pane on the left, choose Identities > Roles.

  3. On the Roles page, click Create Role.

  4. On the Create Role page, select Alibaba Cloud Service for Trusted Entity Type, and then click OK.

    Note

    From the Trusted Service drop-down list, select Media Processing.

  5. In the Create Role dialog box, enter "AliyunMTSVideoLifecycleRole" for Role Name and click OK. The role name can be up to 64 characters in length and can contain letters, digits, hyphens (-), and periods (.).

  6. After the role is created, on the Basic Information page, click the Permissions tab.

  7. Click Input and Attach and configure the following parameters:

    • Permission type: System Policy

    • Policy name: AliyunMTSVideoLifecycleRolePolicy

    After you configure the parameters, click OK.

Delete snapshot files in the console

  1. Log on to the ApsaraVideo Live console.

  2. In the left navigation bar, select Feature Management> Snapshots. On the Snapshots page, select Snapshot Management.

  3. Select the domain and time range for your query. Then, enter or select the AppName and StreamName.

  4. Hover over an image and click the delete icon to delete a single snapshot.

    To delete multiple snapshots, select their checkboxes and click Batch Delete. You can delete up to 200 snapshots at a time.

Delete snapshot files by using an API

Call the DeleteSnapshotFiles operation to delete snapshot files. This also deletes the files stored in OSS.

You can configure an event callback to send snapshot information, including timestamps, to your business system. This allows you to delete the corresponding files based on a custom policy, such as periodic cleanup. For more information, see the event callback development guide.

Related documents

To learn how to use the Java SDK, see the Java SDK User Guide.

For a list of related APIs, see Live stream snapshot APIs.