API | Operation | Description |
Querying file information | Queries media file information |
func (s *CIService) GetMediaInfo(ctx context.Context, name string, opt *ObjectGetOptions, id ...string) (*GetMediaInfoResult, *Response, error)
res, _, err := c.CI.GetMediaInfo(context.Background(), "test.mp4", nil)if err != nil {// ERROR}fmt.Printf("res: %+v\\n", res)
Parameter | Description | Type | Required |
name | Unique identifier of the object in the bucket. For example, if an object's access endpoint is examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/doc/pic.jpg , its key is doc/pic.jpg . | name | Yes |
opt | struct | No | |
id | Object VersionId for versioning. | string | No |
type GetMediaInfoResult struct {XMLName xml.NameMediaInfo struct {Format struct {Bitrate float32Duration float32FormatLongName stringFormatName stringNumProgram intNumStream intSize intStartTime float32}Stream struct {Audio []struct {Index intCodecName stringCodecLongName stringCodecTimeBase stringCodecTagString stringCodecTag stringSampleFmt stringSampleRate intChannel intChannelLayout stringTimebase stringStartTime float32Duration float32Bitrate float32Language string}Subtitle struct {Index intLanguage string}Video struct {Index intCodecName stringCodecLongName stringCodecTimeBase stringCodecTagString stringCodecTag stringProfile stringHeight intWidth intHasBFrame intRefFrames intSar stringDar stringPixFormat stringFieldOrder stringLevel intFps float32AvgFps stringTimebase stringStartTime float32Duration float32Bitrate float32NumFrames intLanguage string}}}}
Node Name (Keyword) | Parent Node | Description | Type |
Response | None | Response container | Container |
Response
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type |
MediaInfo | Response | Media details. | Container |
MediaInfo
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type |
Stream | Response.MediaInfo | Stream information. | Container |
Format | Response.MediaInfo | Format information. | Container |
Stream
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type |
Video | Response.MediaInfo. Stream | Video information. | Container |
Audio | Response.MediaInfo. Stream | Audio information. | Container |
Subtitle | Response.MediaInfo. Stream | Subtitles information. | Container |
Format
has the following sub-nodes (certain nodes may not be returned during video information query):Node Name (Keyword) | Parent Node | Description | Type |
NumStream | Response.MediaInfo. Format | Number of streams (including videos, audios, and subtitles). | Int |
NumProgram | Response.MediaInfo. Format | Number of programs. | Int |
FormatName | Response.MediaInfo. Format | Container format name. | String |
FormatLongName | Response. MediaInfo.Format | Detailed name of the container format. | String |
StartTime | Response.MediaInfo. Format | Start time in seconds. | Float |
Duration | Response.MediaInfo. Format | Duration in seconds. | Float |
Bitrate | Response.MediaInfo. Format | Bitrate in Kbps. | Int |
Size | Response.MediaInfo. Format | Size in bytes. | Int |
Video
has the following sub-nodes (certain nodes may not be returned during video information query):Node Name (Keyword) | Parent Node | Description | Type |
Index | Response.MediaInfo. Stream.Video | Stream number. | Int |
CodecName | Response.MediaInfo. Stream.Video | Codec format name. | String |
CodecLongName | Response.MediaInfo. Stream.Video | Detailed name of the codec format. | String |
CodecTimeBase | Response.MediaInfo. Stream.Video | Codec timebase. | String |
CodecTagString | Response.MediaInfo. Stream.Video | Codec tag name. | String |
CodecTag | Response.MediaInfo. Stream.Video | Codec tag. | String |
Profile | Response.MediaInfo. Stream.Video | Video codec profile. | String |
Height | Response.MediaInfo. Stream.Video | Video height in px. | Int |
Width | Response.MediaInfo. Stream.Video | Video width in px. | Int |
HasBFrame | Response.MediaInfo. Stream.Video | Whether B-frames exist. 1: yes; 0: no. | Int |
RefFrames | Response.MediaInfo. Stream.Video | Number of reference frames for video codec. | Int |
Sar | Response.MediaInfo. Stream.Video | Sample aspect ratio. | String |
Dar | Response.MediaInfo. Stream.Video | Display aspect ratio. | String |
PixFormat | Response.MediaInfo. Stream.Video | Pixel format. | String |
FieldOrder | Response.MediaInfo. Stream.Video | Field order. | String |
Level | Response.MediaInfo. Stream.Video | Video codec level. | Int |
Fps | Response.MediaInfo. Stream.Video | Video frame rate. | Int |
AvgFps | Response.MediaInfo. Stream.Video | Average frame rate. | String |
Timebase | Response.MediaInfo. Stream.Video | Timebase. | String |
StartTime | Response.MediaInfo. Stream.Video | Video start time in seconds. | Float |
Duration | Response.MediaInfo. Stream.Video | Video duration in seconds. | Float |
Bitrate | Response.MediaInfo. Stream.Video | Bitrate in Kbps. | Float |
NumFrames | Response.MediaInfo. Stream.Video | Total number of frames. | Int |
Language | Response.MediaInfo. Stream.Video | Language. | String |
Audio
has the following sub-nodes (certain nodes may not be returned during video information query):Node Name (Keyword) | Parent Node | Description | Type |
Index | Response.MediaInfo. Stream.Audio | Stream number. | Int |
CodecName | Response.MediaInfo. Stream.Audio | Codec format name. | String |
CodecLongName | Response.MediaInfo. Stream.Audio | Detailed name of the codec format. | String |
CodecTimeBase | Response.MediaInfo. Stream.Audio | Codec timebase. | String |
CodecTagString | Response.MediaInfo. Stream.Audio | Codec tag name. | String |
CodecTag | Response.MediaInfo. Stream.Audio | Codec tag. | String |
SampleFmt | Response.MediaInfo. Stream.Audio | Sample format. | String |
SampleRate | Response.MediaInfo. Stream.Audio | Sample rate. | Int |
Channel | Response.MediaInfo. Stream.Audio | Number of channels. | Int |
ChannelLayout | Response.MediaInfo. Stream.Audio | Channel layout. | String |
Timebase | Response.MediaInfo. Stream.Audio | Timebase. | String |
StartTime | Response.MediaInfo. Stream.Audio | Audio start time in seconds. | Float |
Duration | Response.MediaInfo. Stream.Audio | Audio duration in seconds. | Float |
Bitrate | Response.MediaInfo. Stream.Audio | Bitrate in Kbps. | Float |
Language | Response.MediaInfo. Stream.Audio | Language. | String |
Subtitle
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type |
Index | Response.MediaInfo. Stream.Subtitle | Stream number. | Int |
Language | Response.MediaInfo. Stream.Subtitle | Language. und indicates no query result. | String |
Was this page helpful?