You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Video Processing
Video Frame Extraction (iOS SDK)
Copy page
Download PDF
Video Frame Extraction (iOS SDK)
The video frame extraction function enables the capture of a single frame from a video stream at a specified time and resizes it into an image of the designated dimensions.​
Sample Code​
The following code demonstrates how to extract the video frame at 1000 milliseconds and download the resulting image to the local device.​
​
​
TOSCredential *credential = [[TOSCredential alloc] initWithAccessKey:@"accesskey" secretKey:@"secretkey" securityToken:@"securityToken"];​
TOSEndpoint *tosEndpoint = [[TOSEndpoint alloc] initWithURLString:@"endpoint" withRegion:@"region"];​
TOSClientConfiguration *config = [[TOSClientConfiguration alloc] initWithEndpoint:tosEndpoint credential:credential];​
TOSClient *client = [[TOSClient alloc] initWithConfiguration:config];​
​
TOSGetObjectToFileInput *get = [TOSGetObjectToFileInput new];​
get.tosBucket = @"bucket-name";​
get.tosKey = @"video-name";​
get.tosFilePath = @"your_local_file_path";​
get.tosProcess = @"video/snapshot,t_1000";​
TOSTask *task = [client getObjectToFile:get];​
[task continueWithBlock:^id _Nullable(TOSTask * _Nonnull t) {​
if (!t.error) {​
NSLog(@"Get object to file success.");​
} else {​
NSLog(@"Get object to file failed, error: %@" ,t.error);​
}​
return nil;​
}];​
​
Relevant Documentation​
For a detailed introduction to video frame extraction, please refer to Video Frame Extraction.​
Last updated: 2025.09.25 16:40:50