Get video metadata
Get video metadata
API description
Use this API to access metadata for video files stored on BOS.
Permission description
The Access Key and request signature mechanism are uniformly adopted for all API security authentication. Access Key consists of an Access Key ID and a Secret Access Key, both of which are strings. For each HTTP request, use the algorithm described below to generate a authentication string. Submit the certification string in the Authorization header. The server verifies the correctness of the authentication string based on the generation algorithm. The certification string format is bce-auth-v{version}/{accessKeyId}/{timestamp}/{expirationPeriodInSeconds}/{signedHeaders}/{signature}.
- The version is a positive integer.
- The timestamp refers to the UTC time when the signature is created.
- The expirationPeriodInSeconds specifies the duration during which the signature remains valid.
- SignedHeaders includes the list of headers involved in the signature algorithm. The headers are separated by semicolons (e.g., host;x-bce-date) and arranged in lexicographical order. (This API signature involves only the host and x-bce-date headers.)
- The signature is a 256-bit signature represented as a 64-character lowercase hexadecimal digest.
When Baidu AI Cloud receives a user's request, the system uses the same SK and certification mechanism to generate a certification string. This string is then compared with the one included in the user's request. If the two match, the system confirms the user has the required permissions and proceeds with the operation. If they differ, the system cancels the operation and returns an error code.
For detailed information on the authentication mechanism, please refer to [Authentication](Reference/Authentication mechanism/Introduction.md).
Notes
Request structure
1GET /<ObjectName>?x-bce-process=video/info HTTP/1.1
2Host: <BucketName>.bj.bcebos.com
3Authorization: authorization string
Request headers
There are no special headers required beyond the common headers.
Request query parameters
| Parameter name | Types | Description |
|---|---|---|
| x-bce-process | string | BOS data processing parameter, to obtain video metadata x-bce-process=video/info |
Response headers
There are no special headers required beyond the common headers.
Request example
1GET http://<BucketName>.bj.bcebos.com/<ObjectName>?x-bce-process=video/info
2Host: <BucketName>.bj.bcebos.com
3X-Bce-Date:2022-11-16T11:54:00Z
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Response example
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BOS
6{
7 "bucket": "cmdtest2",
8 "key": "audio.mp3",
9 "fileSizeInByte": 4008612,
10 "type": "audio",
11 "container": "mp3",
12 "durationInSecond": 247,
13 "durationInMillisecond": 246890,
14 "audio": {
15 "codec": "mp3",
16 "channels": 2,
17 "sampleRateInHz": 44100,
18 "bitRateInBps": 128000
19 },
20 "etag": "575a58dbfec5c808dcd941f927ae1927"
21}
Response parameters
| Parameter name | Description |
|---|---|
| bucket | Name of the bucket where the video is located |
| key | Video name |
| fileSizeInByte | Video size |
| type | Video type |
| container | Video format |
| durationInSecond | Video duration (seconds) |
| codec | Video format |
| channels | Number of video channels |
| sampleRateInHz | Video sampling rate |
| etag | File etag on BOS |
Note
- Currently, BOS only supports use of this API by clusters in Beijing, Guangzhou, Suzhou and Baoding
- This API is temporarily in free public beta, and billing standards will be announced later
