Last update:2022-04-13 14:59:38
In the long-form video playback, users usually skip the already watched part, locate the story climax or quickly browse the video content by dragging the progress bar. However, users need to drag the progress bar for multiple times to get to the specified location, facing a poor user experience. In addition, user’s random dragging will increase video provider’s traffic consumption.
For the short form video service, the video is usually uploaded by users, and video providers need to pick a picture from the uploaded video as the video cover to captivate users. In addition, since the uploaded videos are of uneven quality, and may contain sensitive information such as porn and terrorism, video providers need to recognize illegal content intelligently and block it in time, avoiding the risk of policy and law violation.
In order to empower video providers to provide a better user experience, reduce traffic consumption, and avoid policy or legal risks, CDNetworks leverages its platform and has rolled out VoD screenshot, which supports video cover, thumbnail preview, intelligent identification and others, meeting customers’ different business demands.
• Media Acceleration
The screenshot capture of video files is applicable to scenarios such as video cover, thumbnail preview and intelligent identification. The detailed description can be found in 2.2 feature description.
Figure 1 VoD Screenshot Working Process
(1) The customer calls the cloud storage API to upload the video file and assigns the video screenshot instruction;
(2) After receiving the task, the cloud storage forwards the instruction to the cloud transcoding;
(3) Cloud transcoding fetches the video file from the cloud storage for video screenshot operation, performs video decoding and image encoding, saves as the corresponding image format and uploads the file to the cloud storage;
(4) Cloud storage notifies the customer of the screenshot file URL information through API callback;
(5) For the customers enabling CDN acceleration service, their users will utilize the screenshot file address that the cloud storage sends to customer, to initiate requests to CDN PoPs.
(6) CDN PoPs will provide the screenshot file to the end user.
VoD Screenshot Inputs
The video stored on the cloud storage supports common encapsulation formats and encoding formats as below.
Encapsulation formats: MP4, FLV, M3U8, TS, MKV, MOV, WMV, AVI, VP8, VP9, RealVideo, Windows Media Video, etc.
Encoding formats: H.265, H.264, H.263, MPEG, etc.
**
VoD Screenshot Outputs**
Image formats: JPG, PNG, GIF, among which JPG and PNG support Sprite output.
Support one-time screenshot, periodic screenshot and count screenshot:
VoD Screenshot supports 3 application scenarios: Video cover, thumbnail preview and intelligent identification.
Video cover aims at video promotion and attention drawing.
After the cloud storage notifies customer of the screenshot file URL information, the customer will publish the screenshot file. When the user accesses the customer’s video page, the request for screenshot file URL will be triggered and thus the screenshot file will be loaded into the video page.
Video cover is divided into the following two forms:
(1) Static cover: it is the earliest and most common video cover mode, and the common formats include JPEG, PNG, WebP. WebP was proposed by Google, and it supports lossless compression and lossy compression. According to official experiments:
- Lossless WebP is 26% smaller than PNG;
- With the same SSIM (Structural Similarity Index), lossy WebP is 25%-34% smaller than JPEG;
- Lossy WebP also supports Alpha channel, and its size is about 1/3 the corresponding PNG in general.
-
Well-known international websites such as Facebook and Ebay and Chinese applications such as Momo have begun to use the WebP format.
(2) Dynamic cover: it is the common formats of video cover, currently including GIF and dynamic WebP. It is recommended to use dynamic WebP, which supports richer colors, takes up less space and is more applicable to dynamic picture display in mobile network compared with GIF. In addition, the cover in this format is relatively small and the frame rate is reasonably reduced, making small but significant difference in visual impact. Therefore, the frame rate is appropriately lowered, the loading speed improved and the bandwidth consumption reduced.
Compared with static cover, dynamic cover displays more abundant content, and allows users to get a more visual preview of video content, which is a major improvement in user experience. At the same time, in conjunction with playback speed setting, reverse playback achieves a fantastic effect. At present, mobile applications such as TikTok, Weishi, and Rela have started making dynamic covers.
Thumbnail Preview empowers video providers to improve user experience, and to reduce traffic consumption.
After the cloud storage notifies customer of the screenshot file URL information, the customer will publish the screenshot file. When the user requests the video file, the corresponding Sprites of the video file are also requested. The player will disassemble the Sprites and let them match the progress bar with the corresponding screenshot, achieving thumbnail preview when dragging the progress bar.
Intelligent identification helps video providers to avoid policy or legal infringement risks.
After the cloud transcoding sends the screenshot file to the cloud storage, the cloud storage will call a third-party interface for intelligent identification, and notify the customer of the identification result. The customer will decide whether to publish the screenshot file based on the identification result.
Parameter |
Required |
Description |
<op> |
Yes |
vframe (operation-video screenshot) |
<format> |
Yes |
Output target formats, such as jpg,
png, gif and webp. |
/offset/<second> |
No |
Specify the exact time point to
capture the video, unit: second. Support rounding number off to three decimal
places. |
/offsets/<vframeList> |
No |
Specify taking multiple video
screenshots, unit: second. Format: Specify multiple images at
different seconds, and use “:” to separate them. For example, 1:3:10:20. Note: All the screenshots will be
stored in the zip file. When the saveas
parameter is specified as images:a.zip, the zip file
name is a.zip; the screenshot file naming follows the form of serial numbers,
such as: a_00001.jpg, a_00002.jpg. |
/interval/<Interval> |
No |
Specify the time interval of
screenshot, unit: second. Note: All screenshots will be
stored in the zip file. When the saveas
parameter is specified as images:a.zip, the zip file
name is a.zip; the screenshot file naming follows the form of serial numbers,
such as: a_00001.jpg, a_00002.jpg. |
/vframeN/<vframeN> |
No |
The number of screenshots, the
range is 1, 2, 3, 4, etc. Note: All the screenshots will be
stored in the zip file. When the saveas
parameter is specified as images:a.zip, the zip file
name is a.zip; the screenshot file naming follows the form of serial numbers,
such as: a_00001.jpg, a_00002.jpg. |
/t/<Duration> |
No |
Specify the duration of the video extraction
as the duration of GIF image, unit: second. The default is 5s. |
/sprite/<sprite> |
No |
Standard image splicing size; for
example, 4x5 indicates that splice the consecutive screenshots into a large
image with 4 rows and 5 columns, which is a Sprite. Note: This parameter needs to be
used together with the interval
parameter. When the saveas
parameter is specified as images:a.jpg,
the spliced image file naming rule is: a_0000x.jpg. If there is only a single
spliced image, it is named a_00001.jpg; if there are multiple spliced images,
they are named ass a_00001.jpg, a_00002.jpg, a_00003.jpg, and so on. |
/mode/<mode> |
No |
Resizing mode. Mainly used in the proportional
scaling to avoid distortion caused by stretching. For detailed information,
please refer to the following table. |
/w/<width> |
No |
Thumbnail width, unit: pixel (px),
range: 1-1920. |
/h/<height> |
No |
Thumbnail height, unit: pixel (px),
range: 1-1080. |
/autofill/<autofill> |
No |
Use in conjunction with the parameters
/w/ and /h/. When it is specified as 1, the picture will be resized into a
rectangle specified by /w/ and /h/, and the empty part will be filled with
black color; when it is specified as 0 or not specified, it will be forced
resizing to the corresponding resolution, which may cause video distortion.
When the autofill parameter is
specified, mode parameter will not be
used and /w/ and /h/ need to be specified. |
/rotate/<degree> |
No |
Specify the number of degrees of
clockwise rotation, which could be 90, 180, 270, auto. No rotation by
default. |
/isZip/<isZip> |
No |
Multiple screenshots except the
Sprite support packaging, and will be packaged by default; if you do not want
to package, the value should be configured to 0. |
|saveas/<Urlsafe_Base64_Encode(bucket:filekey)> |
No |
Save the video screenshot as a
designated file. Fill in safe_Base64_Encode value of “Space: File name” Url in the parameter. |
Mode |
Description |
/mode/1 |
Specify that the thumbnail width is
no less than <width> and the height is no less than <height>, and
perform proportional scaling and center cropping. Generally, the processed thumbnail
will be exactly the size of <width>x<height> (when being resized,
the excessed part of one side over the rectangle will be cropped). If the width parameter only or the height parameter only is specified, then
the proportional scaling is on condition that the width is no less than
<width> or the height is no less than <height>. |
/mode/2 |
Specify that the thumbnail width is
no more than <width> and the height is no more than <height>, and
perform proportional scaling without cropping. If the width parameter only is specified, it indicates
that width is specified (and height is adaptive); if the height parameter
only is specified, it represents the height is specified (and width is
adaptive). |
/mode/3 |
Specify that the thumbnail width is
no less than <width> and the height is no less than <height>, and
perform proportional scaling without cropping. |
If the cover is only a clip of the source video, then the video adopts only one playback direction, only forward playback or only reverse playback. This feature can be realized by calling VoD screenshot API once.
Parameter |
Required |
Description |
<op> |
Yes |
Vframe (operation-video screenshot) |
<format> |
Yes |
Output target format, such as gif and
webp. |
/offset/<second> |
No |
Specify the exact time point to
capture the video, unit: second. Support rounding off to three decimal
places. |
/t/<Duration> |
No |
Specify the duration of video clip,
unit: second, the default value is 5s. |
/reverse/<reverse> |
No |
Whether to
reverse, 1 is reverse, 0 is non-reverse. The default value is 0. |
/mode/<mode> |
No |
Resizing mode, please refer to
Table 4 |
/w/<width> |
No |
Thumbnail width, unit: pixels (px),
range: 1-1920. |
/h/<height> |
No |
Thumbnail height, unit: pixels
(px), range: 1-1080. |
/autofill/<autofill> |
No |
Use in conjunction with the
parameters /w/ and /h/. When it is specified as 1, the picture will be
resized into a rectangle specified by /w/ and /h/, and the empty part will be
filled with black color; when it is specified as 0 or not specified, it will be
forced resizing to the corresponding resolution, which may cause video
distortion. When the autofill
parameter is specified, mode parameter will not be used and /w/ and /h/ need
to be specified. |
/rotate/<degree> |
No |
Specify the number of degrees of clockwise
rotation, which could be 90, 180, 270, auto. No rotation by default. |
/r/<FrameRate> |
No |
Video frame rate, the number of
frames to be displayed per second, unit: Hertz (Hz). Common frame rates: 24, 25, 30,
etc., generally the default value is used. |
/speedup/<speedup> |
No |
Specify the
playback speed. If the value is greater than 0 and less than 1, the playback
speed is reduced. The smaller the value is, the slower the playback speed is.
If the value is greater than 1, the playback speed is accelerated. The larger
the value is, the faster the playback speed is. |
|saveas/<bucket:filekey> |
No |
Save as a designated file after
processing. Fill in the safe_Base64_Encode value of “Space: File name” Url in the parameter. |
Fops parameter example:
Capture the first 3s of the video, adopt reverse playback, set playback speed to 2, and save it as WebP format:
fops=Urlsafe_Base64_Encode(vframe/webp/offset/0/t/3/speedup/2/reverse/1)
If the cover consists of multiple clips of source video, or consists of one clip but in two playback directions – forward and reverse playback, call audio/video processing (avthumb) API to achieve this.
Parameter |
Required |
Description |
<op> |
Yes |
avthumb (operation-audio/video processing) |
<format> |
Yes |
Output target format: dynamic webp |
/ss/<SeekStart> |
No |
Specify the start time to capture
video, unit: second. |
/t/<Duration> |
No |
Specify the duration of video clip,
combined with ss to achieve capture, unit: second. |
/multiSeeks/<
multiSeeks > |
No |
Capture multiple time periods, use
the punctuation mark “:” to separate the capture start time and capture
duration, use “,” to separate different time periods, -1 marks the end of the
file, unit: s. For example, to remove the time periods 30s - 38s, 120s -
129s, and 310s -319s, multiSeeks displays 0:30,
38:81, 129:180, 319:-1. Note: multiSeeks cannot be used together with ss, t. |
/r/<FrameRate> |
No |
Video frame rate, the number of
frames displayed per second, unit: Hertz (Hz). Common frame rates: 24, 25, 30,
etc., generally the default value is used. |
/reverse/<reverse> |
No |
Whether to reverse, 1 is reverse, 0
is non-reverse. The default value is 0. Use “,” to separate multiple values. |
/speedup/<speedup> |
No |
Specify the
playback speed. If the value is greater than 0 and less than 1, the playback
speed is slowed down. The smaller the value is, the slower the playback speed
is. If the value is greater than 1, the playback speed is accelerated. The
larger the value is, the faster the playback speed is. Use “,” to separate
multiple values. |
/vb/<VideoBitRate> |
No |
Video bitrate, unit: bits per
second (bit/s). Common video bitrates: 128k, 1.25m, 5m, etc. |
|saveas/<bucket:filekey> |
No |
Save as a designated file after
processing. Fill in safe_Base64_Encode value of “Space:File name” Url in
the parameter. |
Fops parameter example 1:
Capture the 10-30s of the mp4 video and make it as the dynamic Webp cover, including forward and reverse playback. Forward playback first and reverse playback second, with the playback speed of 2 and 4 respectively, and save it as WebP format:
fops=Urlsafe_Base64_Encode(avthumb/webp/multiSeeks/10:20,10:20/reverse/0,1/speedup/2,4|saveas/Urlsafe_Base64_Encode(test:fengmian.webp))
Fops parameter example 2:
Capture the 0-5s and 25-30s of the mp4 video and make it as the dynamic Webp cover. The 0-5s content adopts reverse playback with the playback speed of 2, and the 25-30s content adopts reverse playback with the playback speed of 4. Save it as WebP format:
fops=Urlsafe_Base64_Encode(avthumb/webp/multiSeeks/0:5,25:5/reverse/1,1/speedup/2,4|saveas/Urlsafe_Base64_Encode(test:fengmian.webp))