ApsaraVideo VOD provides snapshot templates with preset parameters to automatically capture video snapshots in workflows. This topic describes how to select a snapshot method, create and manage templates, and use templates in workflows to automate snapshots.
Comparison of snapshot methods
Snapshot methods include Normal Snapshot, WebVTT, and Image Sprite. For more information, see Video snapshots.
|
Snapshot method |
Scenarios |
Pros and cons |
|
Normal Snapshot |
Video thumbnails, content moderation, and sharing highlights. |
Pros: Cons: |
|
WebVTT |
Displaying thumbnails when you hover over the progress bar of a web or H5 player. |
Pros: Compatible with thumbnail previews on the progress bars of web and H5 players. Cons: |
|
Sprite |
Scenarios that require thumbnail previews on mobile clients or players with high loading performance requirements. |
Pros: Cons: |
Create a snapshot template
-
Log on to the ApsaraVideo VOD console.
-
In the navigation pane on the left, choose Configuration Management > Media Processing > Snapshot Templates.
-
Click Create Snapshot Template. On the Add Snapshot Template page, configure the template parameters.
ImportantThe snapshot method (Normal Snapshot, WebVTT, or Sprite) cannot be changed after the template is created. Confirm your selection before you save the template.
General parameters
The following parameters apply to all snapshot methods.
Parameter
Description
Template Name
The custom name of the template. It is used for identification and reference in workflows.
Start Time
The time point when the snapshot process starts (HH:MM:SS).
Number of Snapshots
The total number of snapshots to generate.
Snapshot Interval
The time interval between multiple snapshots. If you set this to 0 or leave it empty, snapshots are taken at equal intervals based on the video duration.
Dimensions (Width × Height)
The width and height of the snapshot in pixels.
Note-
If you do not set the width and height, the snapshot dimensions are the same as the input video.
-
If you set only the width or height, the other dimension is scaled proportionally to the video's aspect ratio to prevent distortion.
Frame Type
The type of frame to capture for the snapshot. Options include keyframes and regular frames.
NoteIf you select keyframes, only keyframes are captured. If no keyframe exists at the specified time point, the nearest keyframe is automatically selected. Under the same conditions, capturing keyframes is faster than capturing regular frames.
WebVTT-specific parameters
Parameter
Description
Generate a large image
Specifies whether to combine the multiple thumbnails required for WebVTT into a single large image for storage.
Sprite-specific parameters
Parameter
Description
Layout (Rows × Columns)
Parameters for setting the width and height of the small images within the sprite.
NoteIf not set, the width and height of the small images are the same as a normal snapshot. If only one dimension is set, the other is scaled proportionally.
Row Spacing
The vertical spacing between rows of small images in the sprite, in pixels.
Column Spacing
The horizontal spacing between columns of small images in the sprite, in pixels.
Background Color
The background color of the generated sprite.
Keep Individual Images
Specifies whether to keep the original images that make up the sprite after the sprite is generated.
-
-
After you complete the configuration, click Save.
Use a snapshot template in a workflow
After you create a snapshot template, you must add it to a workflow to use it during media upload or processing.
-
Attach the template to a workflow.
Log on to the ApsaraVideo VOD console. In the navigation pane on the left, choose Configuration Management > Media Processing > Workflows. Add or edit a workflow. Insert a Snapshots node into the workflow. In the node configuration pane on the right, select the snapshot template that you created.
-
Trigger the workflow.
After you attach the template, you can trigger the workflow in one of the following ways.
-
Automatic trigger: When you upload an audio or video file, specify this workflow. The workflow automatically runs after the file is uploaded. For more information, see Upload files in the ApsaraVideo VOD console.
-
Manual trigger: On the Media Files > Audio/Video page, select the target media asset, click Processing, select Use Workflow, and then specify this workflow.
-
API trigger: Call the SubmitWorkflowJobs operation to specify this workflow.
-
-
Retrieve the snapshot results.
You can retrieve the snapshot results from a SnapshotComplete event notification. When a video snapshot is successfully captured, the system sends a callback message to the configured URL. The message body contains a list of snapshot data.
Billing
The snapshot feature of ApsaraVideo VOD is free of charge.
FAQ
What do I do if I do not receive a SnapshotComplete event notification?
You can perform the following steps to troubleshoot the issue:
-
Confirm that the status of the input video is Normal and the video file is not corrupted.
-
Verify that the parameters in the snapshot template are valid. For example, the start time must not exceed the video duration.
-
Confirm that the event notification callback is correctly configured. For more information, see Event notifications.
How can I use a snapshot template directly through an API?
You can call the SubmitSnapshotJob operation to start a snapshot job independently.