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

Torch Object Storage

Copy page
Download PDF
Video Processing
Persistent Storage of Video Frame Images (iOS SDK)
Copy page
Download PDF
Persistent Storage of Video Frame Images (iOS SDK)
TOS supports saving images extracted from video frames to a specified storage bucket.​
Sample Code​
The following code demonstrates how to extract the video frame at 1000 ms and save the resulting image to the specified storage bucket.​
​
​
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];​
​
TOSGetObjectInput *get = [TOSGetObjectInput new];​
get.tosBucket = @"bucket-name";​
get.tosKey = @"video-name";​
get.tosProcess = @"video/snapshot,t_1000";​
get.tosProcessSaveAsBucket = @"target-bucket-name";​
get.tosProcessSaveAsObject = @"target-image-name";​
TOSTask *task = [client getObject:get];​
[task continueWithBlock:^id _Nullable(TOSTask * _Nonnull t) {​
if (!task.error) {​
NSLog(@"Get object success.");​
​
TOSGetObjectOutput *out = t.result;​
NSLog(@"%@", [[NSString alloc] initWithData:out.tosContent encoding:NSUTF8StringEncoding]);​
} else {​
NSLog(@"Get object failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
Relevant Documentation​
For a detailed introduction to the persistence of images extracted from video frames, please refer to Image Persistence.​
Last updated: 2025.09.25 16:40:50