You can use the frame animation feature to transform a specific part of a video into a dynamic image. This feature is widely used for social media and news report platforms and marketing promotions. ApsaraVideo VOD allows you to generate dynamic images in the GIF and WebP formats. This topic describes how to capture dynamic images from a video.
Overview
A dynamic image is a group of static images that switch at a specific frequency to create a dynamic effect. Most dynamic images are in the GIF format, while WebP images are less frequently used. When you use the frame animation feature, ApsaraVideo VOD transforms a specific part of a video into a dynamic image file.
You can export dynamic images in the GIF or WebP format based on your business requirements. The following table describes the features of these formats.
Format | Benefit |
GIF | GIF images provide high compatibility and are often used to decorate websites. |
WebP | WebP images are smaller in size than GIF images. However, WebP images are not supported by some browsers, such as Internet Explorer, Safari, iOS 3.2 to 13.7, and KaiOS browser. |
Scenarios
Content sharing on social media platforms: You can transform a specific part of a video into a GIF dynamic image and quickly share the dynamic image with other users. This also allows you to capture the highlights of videos to attract viewers.
Marketing promotion: You can transform the highlights of videos into dynamic images for advertising. This improves the click-through rate (CTR) and conversion rate by stimulating the interest of viewers. You can also use dynamic images on e-commerce platforms to present the features of a product.
Distribution of news and entertainment information: You can transform the key information in the video content into a dynamic image. This way, the information can be displayed in a concise manner. You can also transform the trailers and exciting moments of your show into dynamic images. This allows viewers to quickly browse the key events.
Teaching demonstration: You can use dynamic images to explain complex concepts or steps in online courses. This helps students better understand and memorize the knowledge.
Billing rules
The fees for frame animation are included in your video transcoding bill. You are charged based on the output resolution and the duration. For more information, see Billing of basic services.
Usage notes
A snapshot may fail to be captured in the following scenarios: the source file is an audio file that excludes image information, the source file is damaged, or the container format of the source file is invalid.
Dynamic image files are asynchronously generated. You can obtain the status of a frame animation job from the DynamicImageComplete callback.
The time required to generate a dynamic image varies based on the file size, the duration of the video, and the length of the animation.
Prerequisites
ApsaraVideo VOD is activated. For more information, see Activate ApsaraVideo VOD.
The RAM user or RAM role that you use has corresponding permissions to access ApsaraVideo VOD. We recommend that you use a RAM user or RAM role to perform operations to improve the security of your account and resources. For more information, see Create and grant permissions to a RAM user.
Step 1: Create a frame animation template
A large number of parameters are used when the system generates dynamic images. If you submit a frame animation request that includes all parameters, the feature becomes difficult to use. ApsaraVideo VOD provides frame animation templates. You can configure the relevant parameters in a template, and then specify the ID of the template when you submit a frame animation request.
Step 2: (Optional) Configure event notifications for a frame animation job
Before you submit a frame animation job, we recommend that you configure the DynamicImageComplete event notification. This way, you can obtain the status of the frame animation job and the URL of the captured dynamic image after the job is complete. For more information, see DynamicImageComplete.
For more information about how to configure event notifications, see Configure callbacks.
Step 3: Submit a frame animation job
Step 4: Obtain information about the captured dynamic image
If you have configured the DynamicImageComplete event notification, you can view whether the dynamic image is generated from the callback message. We recommend that you configure the DynamicImageComplete event notification.
After the dynamic image is captured, call the ListDynamicImage operation to obtain information about the dynamic image.
If you have set the dynamic image as the video thumbnail, call the GetVideoInfo operation to obtain the URL of the dynamic image.