All Products
Search
Document Center

Video snapshot

Last Updated: Jul 11, 2019

Overview

You can take snapshots of a video at certain time points in the video to generate snapshot files.

Note:

  • If a media file is an audio file without any image information, the mezzanine file is damaged, or the mezzanine file encapsulation is abnormal, snapshots may fail to be generated.
  • The snapshot taking is an asynchronous process. You can obtain the snapshot taking result by receiving the SnapshotComplete event notification.
  • The time required for taking snapshots depends on the file size, duration, and frame type used for taking snapshots.

Instructions

Thumbnail snapshot

After a video is uploaded, ApsaraVideo for VOD takes snapshots of the video mezzanine file as the recommended video thumbnails by default. These snapshots are called thumbnail snapshots. The process is free of charge.

Snapshots taken by API operations

You can make an API call request to take snapshots of the specified video. For more information, see SubmitSnapshotJob. You can take normal snapshots and sprite snapshots by using this method.

How to obtain snapshots

Currently, ApsaraVideo for VOD allows you to obtain snapshots in the following ways:

How to delete snapshots

Currently, you cannot manage snapshots separately in ApsaraVideo for VOD. Snapshots are managed together with videos. When you delete a video, all snapshots of the video are deleted and cannot be recovered.

Snapshot types

Thumbnail snapshot (CoverSnapshot)

ApsaraVideo for VOD takes snapshots of each video mezzanine file. These snapshots are called thumbnail snapshots. By default, ApsaraVideo for VOD takes a maximum of eight snapshots based on the keyframes of the video. In addition, snapshot taking starts at the first keyframe after the fifth millisecond of a video.You can view thumbnail snapshots on the video details page of the ApsaraVideo for VOD console, and select one as the video thumbnail.

Note:

  • If a video contains fewer than eight keyframes, the number of thumbnail snapshots is less than eight.
  • If you do not specify a snapshot as the thumbnail, ApsaraVideo for VOD automatically selects the middle one among thumbnail snapshots as the thumbnail.

Normal snapshot (NormalSnapshot)

You can use the API to take a certain number of snapshots of the specified video. You can set the start time for taking snapshots, the total number of snapshots, the interval for taking snapshots, and the snapshot width and height. If you take snapshots of a video repeatedly by using the API, ApsaraVideo for VOD keeps only the latest snapshots. For more information, see SubmitSnapshotJob.

Sprite snapshot (SpriteSnapshot)

To take sprite snapshots of a video, ApsaraVideo for VOD takes normal snapshots and then combines them based on certain arrangement rules to compose sprite snapshots. These normal snapshots are called sprite source snapshots. For example, if you arrange normal snapshots by 10 rows and 10 columns in a sprite snapshot, the maximum theoretical number of normal snapshots in the sprite snapshot is 100. If the number of normal snapshots is less than 100, the sprite snapshot composed contains less than 100 normal snapshots. If the number of normal snapshots exceeds 100, a second sprite snapshot is generated to accommodate the excess normal snapshots. The rest may be deduced by analogy until all normal snapshots are used.Sprite snapshots can reduce the number of snapshot requests because multiple snapshots can be obtained through one sprite snapshot request. This improves client performance.The following figures show the sprite snapshots.

The total number of normal snapshots is 50. The normal snapshots are arranged by 10 rows and 3 columns in a sprite snapshot. The first sprite snapshot contains 30 normal snapshots, and the second sprite snapshot contains 20 normal snapshots.

Sprite source snapshot (SpriteOriginSnapshot)

Sprite source snapshots are normal snapshots used to compose sprite snapshots. You can delete or keep sprite source snapshots as required. If sprite source snapshots are kept, you can query them by using the API. For more information, see ListSnapshots.

Snapshot template

Snapshot taking involves many parameters. If you specify all these parameters one by one when submitting a snapshot taking task, the efficiency is low and ease of use is reduced. Therefore, ApsaraVideo for VOD supports snapshot templates. You can save the settings of snapshot parameters as a snapshot template. When submitting a snapshot taking task, you only need to specify the ID of the snapshot template to be used.

Snapshot template management

Currently, you can manage snapshot templates only by using the API. For more information, see AddVodTemplate.

Snapshot parameters

Normal snapshot configuration (SnapshotConfig)

This section describes only some of the normal snapshot parameters. For more information, see SnapshotConfig.

FrameType

The frame type for taking snapshots. Valid values: intra (indicating keyframes) and normal (indicating normal frames).

Note: Under the same snapshot configuration, snapshot taking based on keyframes is generally faster than snapshot taking based on normal frames.

SpecifiedOffsetTime

The start time for taking snapshots. The value is a positive integer. Unit: milliseconds.

Note: If only one snapshot is taken, SpecifiedOffsetTime specifies the time point for taking the snapshot.

Count

The total number of snapshots to be taken.

Interval

The interval for taking snapshots if multiple snapshots are to be taken.

Description of the Count and Interval parameters:

  • If Count is greater than 1 and Interval is not 0, the system takes the specified number of snapshots at the specified interval.
  • If Count is greater than 1 and Interval is 0, the system takes the specified number of snapshots within the video duration. If the FrameType parameter is set to intra and the number of keyframes is less than the Count value, the number of snapshots that are taken is less than the Count value.
  • If Count is 1, the system takes a single snapshot.

Width

The snapshot width. Unit: pixels.

Height

The snapshot height. Unit: pixels.

Description of the Width and Height parameters:

  • If neither Width nor Height is set, the snapshot width and height are the same as those of the video mezzanine file.
  • If only one of Width and Height is set, the other parameter is automatically set according to the aspect ratio of the input video to ensure that the snapshots are not distorted.

Sprite snapshot configuration (SpriteSnapshotConfig)

This section describes only some of the sprite snapshot parameters. For more information, see SpriteSnapshotConfig.

CellWidth and CellHeight

The width and height of small images in the sprite snapshot. If neither CellWidth nor CellHeight is set, the width and height of small images are the same as those of normal snapshots. If only one of CellWidth and CellHeight is set, the other parameter is automatically set according to the aspect ratio of the video.

KeepCellPic

Indicates whether to keep the sprite source snapshots after the sprite snapshot is generated. Valid values: delete and keep.

Note: We recommend that you delete the sprite source snapshots unless otherwise required.

Color

The background color of the sprite snapshot. For more information, see color settings.

Note: Currently, RGB parameter values are not supported.

The following figure provides a schematic diagram of sprite snapshot parameters.

Sprite snapshot parameters