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

Torch Object Storage

Copy page
Download PDF
Video Processing
Retrieving Video Information (C++ SDK)
Copy page
Download PDF
Retrieving Video Information (C++ SDK)
The video information retrieval function enables the acquisition of metadata for a specified video resource. This document describes how to obtain video information using the TOS C++ SDK.​
Sample Code​
The following code demonstrates how to retrieve video information.​
​
#include "TosClientV2.h"​
using namespace VolcengineTos;​
​
int main(void){​
​
​
std::string region = "Your Region";​
std::string accessKey = std::getenv("TOS_ACCESS_KEY");​
std::string secretKey = std::getenv("TOS_SECRET_KEY");​
​
std::string bucketName = "examplebucket";​
​
std::string objectName = "exampledir/exampleobject.mp4";​
​
​
InitializeClient();​
​
TosClientV2 client(region, accessKey, secretKey);​
​
GetObjectV2Input input(bucketName, objectName);​
std::string style = "video/info";​
input.setProcess(style);​
auto output = client.getObject(input);​
if (!output.isSuccess()) {​
​
std::cout << "GetObjectToFile failed." << output.error().String() << std::endl;​
​
CloseClient();​
return -1;​
}​
​
std::ostringstream ss;​
ss << output.result().getContent()->rdbuf();​
​
std::string infoJson = ss.str();​
​
​
CloseClient();​
return 0;​
}​
​
Relevant Documentation​
For detailed information on how to obtain video details, please refer to Viewing Video Information.​
Last updated: 2025.09.25 14:22:48