- Snapshot types
- Snapshot template
- Snapshot parameters
You can take snapshots of a video at certain time points in the video to generate snapshot files.
- 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.
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.
Currently, ApsaraVideo for VOD allows you to obtain snapshots in the following ways:
- Receive snapshot information from the SnapshotComplete event notification.
- Call the GetVideoInfo operation to obtain the default snapshot information.
- Call the ListSnapshots operation to query 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.
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.
- 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.
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.
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 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 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.
Currently, you can manage snapshot templates only by using the API. For more information, see AddVodTemplate.
This section describes only some of the normal snapshot parameters. For more information, see SnapshotConfig.
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.
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.
The total number of snapshots to be taken.
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.
The snapshot width. Unit: pixels.
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.
This section describes only some of the sprite snapshot parameters. For more information, see SpriteSnapshotConfig.
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.
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.
The background color of the sprite snapshot. For more information, see color settings.
Note: Currently, RGB parameter values are not supported.