Snapshots

更新时间:
复制 MD 格式

The snapshot service for media processing for VOD includes features for generating regular snapshots, creating dynamic images, and setting smart covers. This topic describes the available snapshot features and their usage.

Snapshot types

Regular snapshots

Regular snapshots are image files captured from specified points in a video. The regular snapshot feature in media processing for VOD supports the following three types:

Type

Description

Static snapshot

Captures a specified number of images from a video. You can configure settings such as the start time, total number of snapshots, interval, and dimensions (width and height).

WebVTT

Generates a VTT file containing basic information about all snapshots, such as timestamps and URLs. For example, to display thumbnails on a player's progress bar, you must first retrieve the VTT file content, parse the snapshot information, and then display the corresponding thumbnails. Snapshots can be stored in the following ways:

  • Individual storage: Each snapshot is stored as a separate file. The VTT file records the relative path and timestamp for each snapshot.

  • Combined storage: All snapshots are stitched into a single large image for unified storage. To access a specific image, you must parse its location from the VTT file.

Image sprite

First, regular snapshots are taken. Then, these snapshots are arranged and stitched into a single large image, known as an image sprite. Using an image sprite lets you retrieve information for multiple snapshots in a single request, reducing request frequency and improving performance.

Dynamic images

A dynamic image is an animated file created by capturing a specific time range from a video. The dynamic image feature of media processing for VOD supports the following two formats:

Format

Description

GIF

Highly compatible and commonly used for web decoration.

WEBP

WEBP files are significantly smaller than GIFs. However, some browsers do not support it, such as Internet Explorer, Safari, iOS Safari (versions 3.2 to 13.7), and KaiOS Browser.

Note
  • Dynamic image jobs may fail if the source video contains only audio, the file is damaged, or its container information is invalid.

  • The time required to create a dynamic image depends on the size and duration of the source video and the duration of the captured segment.

Smart cover

The smart cover feature analyzes a video's content by using content understanding, visual aesthetics, and data analysis to select the best keyframe or clip for its cover. This helps improve video click-through rates and user experience. The smart cover feature of media processing for VOD supports the following three output types:

Type

Description

Image cover

Selects the most visually optimal image from the video to serve as its static cover.

Animated cover

Extracts and combines multiple highlight frames from the video to generate a GIF file, which serves as the animated cover.

Video summary

Extracts highlight clips from the video and merges them to generate a representative 5-second short video to serve as the video cover.

Create a snapshot template

Console

  1. Log in to the Intelligent Media Services (IMS) console.

  2. In the top-left corner, select a region.

  3. In the left-side navigation pane, choose media processing for VOD > template management.

  4. On the Snapshot tab, create a template.

    • Create a regular snapshot template

      Parameter

      Description

      Template name

      Enter a name for the regular snapshot template.

      Snapshot method

      Select a snapshot type: static snapshot, WebVTT, or image sprite.

      Start time

      Enter the time to start taking snapshots.

      Number of snapshots

      Enter the number of snapshots to take.

      Interval

      The interval between snapshots. If left empty, the default is 10 seconds. If set to 0, snapshots are taken at uniform intervals based on the formula: (Video Duration - Start Time) / Number of Snapshots.

      Size

      Enter the dimensions of the snapshot. The values for width and height must be in the range of [8, 4096]. Unit: px.

      Frame type

      Select a frame type: regular frame or keyframe. If you select keyframe, snapshots are taken only from keyframes. If a specified time point is not a keyframe, the nearest keyframe is used. Taking snapshots of keyframes is faster than taking snapshots of regular frames.

      Generate large image

      If Snapshot method is set to WebVTT, select whether to enable this option.

      Layout

      If Snapshot method is set to image sprite, enter the number of rows and columns. The value for each must be in the range of [1, 10000].

      Padding of sprite

      If Snapshot method is set to image sprite, enter the padding for the image sprite. Unit: px.

      Margin of sub-image

      If Snapshot method is set to image sprite, enter the margin between sub-images. Unit: px.

      Background color

      If Snapshot method is set to image sprite, select a background color for the image sprite.

    • Create a dynamic image template

      Parameter

      Description

      Template name

      Enter a name for the dynamic image template.

      Output format

      Select the format for the dynamic image: gif or webp.

      Frame rate

      Enter the frame rate for the dynamic image. The value must be in the range of [1, 30]. Unit: fps.

      Size

      Enter the dimensions of the dynamic image. The values for width and height must be in the range of [8, 4096]. Unit: px.

      Cropping method

      • By Duration: Enter a start time and a duration. The values must be in the range of [0, 86400]. Unit: seconds.

      • By Trimming: Enter a start time and the duration to trim from the end. The values must be in the range of [0, 86400]. Unit: seconds.

      Adaptive to landscape/portrait

      Specify whether to enable adaptive orientation. If enabled, the output width matches the long side of the source video, and the output height matches the short side.

      Scan mode

      Select a scan mode. Valid values:

      • interlaced: Interlaced scanning.

      • progressive: Progressive scanning.

    • Create a smart cover template

      Parameter

      Description

      Template name

      Enter a name for the smart cover template.

      Task type

      Select a task type. Valid values:

      • Image cover: Selects the most visually optimal image from the video to serve as its static cover.

      • Animated cover: Extracts and combines multiple highlight frames from the video to generate a GIF file, which serves as the animated cover.

      • Video summary: Extracts highlight clips from the video and merges them to generate a representative 5-second short video to serve as the video cover.

API

Call the CreateCustomTemplate operation and set the Type parameter to create a custom template.

Create a snapshot job

Console

  1. Log in to the Intelligent Media Services (IMS) console.

  2. In the top-left corner, select a region.

  3. In the left-side navigation pane, choose media processing for VOD > task management.

  4. On the Snapshot tab, select a snapshot type and create a job.

    • Create a regular snapshot job

      Parameter

      Description

      Job name

      Enter a name for the regular snapshot job.

      File source

      Select a media asset from Object Storage Service (OSS) or IMS media asset management.

      OSS path

      If File source is set to Object Storage Service (OSS), select the OSS path of the media asset.

      Storage location

      If File source is set to media asset management, select a storage location in IMS and click Add File to add media assets from that location.

      Select template

      Select a regular snapshot template.

      Output location

      • Original Storage Location: If the file source is media asset management, the processed file is saved to the original storage location by default.

      • Custom: Specify a custom output location.

      Output path

      If Output location is set to Custom, select an output path.

      Output filename

      Enter a name for the output snapshot file.

    • Create a dynamic image job

      Parameter

      Description

      Job name

      Enter a name for the dynamic image job.

      File source

      Select a media asset from Object Storage Service (OSS) or IMS media asset management.

      OSS path

      If File source is set to Object Storage Service (OSS), select the OSS path of the media asset.

      Storage location

      If File source is set to media asset management, select a storage location in IMS and click Add File to add media assets from that location.

      Select template

      Select a dynamic image template.

      Output location

      • Original Storage Location: If the file source is media asset management, the processed file is saved to the original storage location by default.

      • Custom: Specify a custom output location.

      Output path

      If Output location is set to Custom, select an output path.

      Output filename

      Enter a name for the output dynamic image file.

    • Create a smart cover job

      Parameter

      Description

      Job name

      Enter a name for the smart cover job.

      File source

      Select a media asset from Object Storage Service (OSS) or IMS media asset management.

      OSS path

      If File source is set to Object Storage Service (OSS), select the OSS path of the media asset.

      Storage location

      If File source is set to media asset management, select a storage location in IMS and click Add File to add media assets from that location.

      Select template

      Select a smart cover template.

      Output location

      • Original Storage Location: If the file source is media asset management, the processed file is saved to the original storage location by default.

      • Custom: Specify a custom output location.

      Output path

      If Output location is set to Custom, select an output path.

      Output filename

      Enter a name for the output cover file.

API

Call the SubmitSnapshotJob, SubmitDynamicImageJob, or SubmitIProductionJob operation to submit a regular snapshot, dynamic image, or smart cover job, respectively. For regular snapshot and dynamic image jobs, you can use the OverwriteParams parameter to override the corresponding parameters in the selected template.

Query snapshot jobs

Callbacks

You can query job details by receiving a callback. The event is VideoSnapshotComplete for regular snapshots, VideoDynamicImageComplete for dynamic images, or AIProductionComplete for smart covers. For more information, see Overview of callback events.

API

Call the GetSnapshotJob, GetDynamicImageJob, or QueryIProductionJob operation to query the details of a regular snapshot, dynamic image, or smart cover job.

API reference