tencent cloud

Cloud Infinite

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Product Overview
Product Strengths
Use Cases
Feature Overview
Regions and Domains
Specifications and Limits
Billing
Billing Overview
Billing Mode
Billable Items
Free Tier
Payment Overdue
Viewing Bill Details
FAQs
Getting Started
Registering and Logging In
Bind Bucket
Uploading and Processing File
Downloading and Deleting Images
Unbinding Buckets
Using CI via COS
Features
Image Processing
Media Processing
Content Moderation
AI Content Recognition
File Processing
Smart Voice
File processing
User Guide
Overview
Bucket Management
Smart Toolbox
Job and Workflow
Data Monitoring
Usage statistics
Use Cases
Copyright Protection Solutions
Image Processing Practices
Working with API Authorization Policies
Workflow Practices
API Documentation
API Overview
Structure
Common Request Headers
Common Response Headers
Activate Vast Service
Image Processing
AI-Based Content Recognition
Smart Audio
Media Processing
Content Moderation
Document Processing
File Processing
Job and Workflow
Cloud Virus Detection
Error Codes
Request Signature
SDK Documentation
SDK Overview
Android SDK
iOS SDK
COS Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Go SDK
COS iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
Mini Program SDK
Personal Information Protection Policy for SDK
Security and Compliance
Permission ‍Management
FAQs
Basic Settings
Document Processing
Media Processing
Content Recognition
Smart Audio
Agreements
Service Level Agreement
Contact Us
Glossary

Media Screenshot APIs

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-03-01 10:49:05

Overview

This document provides an overview of APIs and SDK code samples for media screenshot.
Note:
The COS JavaScript SDK version must be at least v1.3.1.
API
Operation
Description
Querying screenshot
Query the screenshot of media file at some time point

Querying Screenshot

Feature description

This API is used to query the screenshot of a media file at some time point.
Note:
Before using this API, make sure that the media processing feature has been enabled in the data processing section in the console; otherwise, the error media bucket unbinded, bucket's host is unavailable will be reported.

Sample code

var config = {
// Replace with your own bucket information
Bucket: 'examplebucket-1250000000', /* Bucket (required) */
Region: 'COS_REGION', /* Bucket region (required) */
};
cos.request({
Bucket: config.Bucket,
Region: config.Region,
Method: 'GET',
Key: 'test.mp4', /* Media file in bucket (required) */
Query: {
'ci-process': 'snapshot', /** Fixed value (required) */
time: 1, /** Screenshot time point in seconds (required) */
// width: 0, /** Screenshot width (optional) */
// height: 0, /** Screenshot height (optional) */
// format: 'jpg', /** Screenshot format (optional). Valid values: jpg; png. Default value: jpg */
// rotate: 'auto', /** Image rotation method (optional). Default value: auto */
// mode: 'exactframe', /** Frame capturing method (optional). Default value: exactframe */
},
RawBody: true,
},
function(err, data){
console.log(err || data);
});

Parameter description

Parameter
Description
Type
Required
Bucket
Bucket name in the format of BucketName-APPID.
String
Yes
Region
Bucket region. For the enumerated values, see Regions and Access Endpoints.
String
Yes
Key
Object key (object name), which is the unique identifier of the object in the bucket. For more information, see Object Overview.
String
Yes
ci-process
Operation type, which is fixed at snapshot.
String
Yes
time
Screenshot time point in seconds.
Number
Yes
width
Screenshot width. Default value: 0.
Number
No
height
Screenshot height. Default value: 0. If width and height are both 0, the width and height of the video are used. If one of them is 0, the other value is used to automatically adapt to the aspect ratio of the video.
Number
No
format
Screenshot format. Valid values: jpg; png. Default value: jpg.
String
No
rotate
Image rotation method. auto: Rotate automatically according to the video rotation information. off: Do not rotate. Default value: auto.
String
No
mode
Frame capturing method. keyframe: Capture the last keyframe before the specified time point. exactframe: Capture the frame at a specified time point. Default value: exactframe.
String
No

Callback function description

function(err, data) { ... }
Parameter
Description
Type
err
The object returned when an error (network error or service error) occurs. If the request is successful, this parameter is empty. For more information, see Error Codes.
Object
- statusCode
Returned HTTP status code, such as 200, 403, and 404.
Number
- headers
Returned headers.
Object
data
The object returned when the request is successful. If an error occurs with the request, this parameter is empty.
Object
- statusCode
Returned HTTP status code, such as 200, 403, and 404.
Number
- headers
Returned headers.
Object
- RequestId
Unique ID of the request.
String
- Body
Returned file content, which is in string format by default.
String

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백