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 14:43:58

Overview

This document provides code samples for screencapturing a media file at some time point.
Note:
COS PHP SDK v2.3.2 or later is required. Earlier versions may contain bugs and need to be upgraded to the latest version when used.
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.

Sample code

<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

$secretId = "SECRETID"; // Replace it with your real `secretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi
$secretKey = "SECRETKEY"; // Replace it with your real `secretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi
$region = "ap-beijing"; // Replace it with your real region information, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));

$time = 3.14; // Video frame capturing time point
try {
$result = $cosClient->getSnapshot(
array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
'Key' => 'exampleobject', // Media file object path, such as `folder/movie.mp4`
'ci-process' => 'snapshot', // Operation type, which is fixed at `snapshot`
'Time' => $time, // Video frame capturing time point
'SaveAs' => '/data/test.jpg', // Local path to save the screenshot
)
);
// Request successful
echo($result);
} catch (\\Exception $e) {
// Request failed
echo($e);
}

Parameter description

Parameter
Description
Type
Required
Bucket
Bucket name in the format of BucketName-APPID.
String
Yes
Key
Object key (object name), which is the unique identifier of the object (a media file here) in the bucket. For more information, see Object Overview.
String
Yes
ci-process
Operation type, which is fixed at snapshot.
String
Yes
Time
Video frame capturing time point.
float
Yes
SaveAs
Local path to save the screenshot.
String
Yes

Sample response

GuzzleHttp\\Command\\Result Object
(
[Body] => GuzzleHttp\\Psr7\\Stream Object
(
[stream:GuzzleHttp\\Psr7\\Stream:private] => Resource id #91
[size:GuzzleHttp\\Psr7\\Stream:private] =>
[seekable:GuzzleHttp\\Psr7\\Stream:private] => 1
[readable:GuzzleHttp\\Psr7\\Stream:private] => 1
[writable:GuzzleHttp\\Psr7\\Stream:private] => 1
[uri:GuzzleHttp\\Psr7\\Stream:private] => php://temp
[customMetadata:GuzzleHttp\\Psr7\\Stream:private] => Array
(
)

)

[ContentLength] => 153613
[ContentType] => image/jpeg
[RequestId] => NjE0NThmNGNfNWIyZjJjMGJfNTE1MV84YmJlODI=
[Key] => exampleobject
[Bucket] => examplebucket-1250000000
[Location] => examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/exampleobject
)

도움말 및 지원

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

피드백