GetAvinfo

更新时间:2023-08-17 17:36:55

获取一个指定音视频资源的元信息。需要IAM wos:GetAvinfo权限。

请求语法

GET /Key?avinfo HTTP/1.1
Host: Bucket.Endpoint
Date: Date
Authorization: Authorization

请求参数

参数名称 是否必填 描述
avinfo 获取指定音视频资源的元信息。
类型:字符串。

请求头部

使用公共请求头部

请求主体

无请求主体。

响应语法

HTTP/1.1 StatusCode 
x-wos-request-id: RequestId 
Date: Date
Content-Type: type
Content-Length: length
Server: WS-web-server

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GetAvinfoResult>
    <Streams>
        <Index>index</Index>
        <Codec_name>codec_name</Codec_name>
        <Codec_type>codec_type</Codec_type>
        <Width>width</Width>
        <Height>height</Height>
        <Pix_fmt>pix_fmt</Pix_fmt>
        <Duration>duration</Duration>
        <Bit_rate>bit_rate</Bit_rate>
        <Nb_frames>nb_frames</Nb_frames>
        <R_frame_rate>r_frame_rate</R_frame_rate>
        <Avg_frame_rate>avg_frame_rate</Avg_frame_rate>
    </Streams>
    <Format>
        <Nb_streams>nb_streams</Nb_streams>
        <Format_name>format_name</Format_name>
        <Duration>duration</Duration>
        <Size>size</Size>
        <Bit_rate>bit_rate</Bit_rate>
    </Format>
</GetAvinfoResult>

响应头部

使用公共响应头部

响应主体

该请求的响应消息中,会以XML形式将avinfo信息列出来,元素的具体含义如下表所示。

元素名称 描述
GetAvinfoResult 视频元信息。
类型:XML。
Streams 流信息。
类型:XML。
Index 流索引号。
类型:正整数。
Codec_name 编码器名。
类型:
Codec_type 编码器类型。
类型:字符串。
Width 宽度。
类型:正整数。
Height 高度。
类型:正整数。
Pix_fmt 像素个数。
类型:字符串。
Duration 总时长。
类型:字符串。
Bit_rate 码率。
类型:字符串。
Nb_frames 帧数。
类型:字符串。
R_frame_rate 真实基础帧率。
类型:字符串。
Avg_frame_rate 平均帧率。
类型:字符串。
sample_rate 采样率。
类型:字符串。
Channels 音频数。
类型:正整数。
Nb_streams 流的数目
类型:正整数。
Format_name 格式名。
类型:字符串。
Size 文件大小。
类型:字符串。

特殊错误

Code Message
599 InputFile Invalid

示例

GET /test?avinfo HTTP/1.1
Host: testbucket.s3-cn-south-1.wcsapi.com
Date: Wed, 04 Nov 2020 03:09:24 GMT
x-wos-date:20201104T030923Z
Authorization: WOS-HMAC-SHA256 Credential=7e7dae54118c45a6ffd213a18c9d4847b51a73f1/20201104/cn-east-2/wos/wos_request, SignedHeaders=host;x-wos-content-sha256;x-wos-date, Signature=1c104d10373f9813ecba257d5f48eecbb44f87b572e14edb7fce6c51d64cae13

HTTP/1.1 200 OK
Server: WS-web-server
x-wos-request-id: 202829121210026220201104110923r44rlIlOsampled
Content-Type: application/xml;charset=UTF-8
Date: Wed, 04 Nov 2020 03:09:24 GMT
Content-Length: 885

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GetAvinfoResult>
    <Streams>
        <Index>0</Index>
        <Codec_name>h264</Codec_name>
        <Codec_type>video</Codec_type>
        <Width>1366</Width>
        <Height>768</Height>
        <Pix_fmt>yuv420p</Pix_fmt>
        <Duration>2643.520000</Duration>
        <Bit_rate>1217993</Bit_rate>
        <Nb_frames>66088</Nb_frames>
        <R_frame_rate>25/1</R_frame_rate>
        <Avg_frame_rate>25/1</Avg_frame_rate>
    </Streams>
    <Streams>
        <Index>1</Index>
        <Codec_name>aac</Codec_name>
        <Codec_type>audio</Codec_type>
        <Sample_rate>44100</Sample_rate>
        <Channels>2</Channels>
        <Duration>2643.522177</Duration>
        <Bit_rate>127900</Bit_rate>
        <Nb_frames>113847</Nb_frames>
        <R_frame_rate>0/0</R_frame_rate>
        <Avg_frame_rate>0/0</Avg_frame_rate>
    </Streams>
    <Format>
        <Nb_streams>2</Nb_streams>
        <Format_name>mov,mp4,m4a,3gp,3g2,mj2</Format_name>
        <Duration>2643.523000</Duration>
        <Size>446437306</Size>
        <Bit_rate>1351037</Bit_rate>
    </Format>
</GetAvinfoResult>
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!