全部產品
Search
文件中心

Intelligent Media Services:GetMediaInfo

更新時間:Oct 09, 2026

根據 IMS mediaId 或媒資 InputURL,取得並返回媒資資訊。

介面說明

MediaId 不為空時,優先使用 MediaId。如果 MediaId 為空,則 InputURL 必須非空。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ice:GetMediaInfo

get

*全部資源。

*

無 無

請求參數

名稱

類型

必填

描述

樣本值

MediaId

string

否

IMS 媒資 ID,若為空,則必須有 InputURL。

****20b48fb04483915d4f2cd8ac****

InputURL

string

否

待查詢的媒資在相應系統中的位址,使用前必須在 IMS 內容庫中註冊並與 IMS 的 mediaId 綁定。

  • OSS 位址,支援兩種格式

http(s)://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4 或者

oss://example-bucket/example.mp4 此格式預設 oss region 與服務接入區域一致。

http://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4

OutputType

string

否

傳回值中媒資檔案位址的類型:

  • "oss" 傳回 OSS 位址,預設。

  • "cdn" 傳回 CDN 位址。僅當媒資是由 vod 匯入的、且在 vod 設定了加速網域,才會傳回 CDN 位址。

cdn

ReturnDetailedInfo

string

否

設定對應媒資欄位是否傳回詳細資訊,支援欄位: AiRoughData.StandardSmartTagJob:如果媒資提交過標籤分析,是否傳回詳細標籤結果。

  • 預設 false,任務結果以 URL 形式傳回。

  • true,任務結果以文字形式傳回。

{"AiRoughData.StandardSmartTagJob": false}

AuthTimeout

integer

否

返回參數

名稱

類型

描述

樣本值

object

Schema of Response

RequestId

string

請求 ID。

2FDE2411-DB8D-4A9A-875B-275798F14A5E

MediaInfo

object

媒資資訊。

MediaId

string

媒資 ID。

****20b48fb04483915d4f2cd8ac****

MediaBasicInfo

object

BasicInfo

MediaId

string

MediaId

****20b48fb04483915d4f2cd8ac****

InputURL

string

被查詢的媒資在相應系統中的位址。

https://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4

MediaType

string

媒資媒體類型。

video

BusinessType

string

媒資業務類型。

general

Source

string

來源。

oss

Title

string

標題。

Title

Description

string

內容描述。

Description

Category

string

分類。

Category

MediaTags

string

標籤。

Tag,tag1

CoverURL

string

封面位址。

http://example-bucket.oss-cn-shanghai.aliyuncs.com/example.png?Expires=&OSSAccessKeyId=&Signature=&security-token=

UserData

string

使用者資料。

userDataTest

Snapshots

string

截圖。

[ "http://example-bucket.oss-cn-shanghai.aliyuncs.com/snapshot-00001.png?Expires=&OSSAccessKeyId=&Signature=&security-token=", "http://example-bucket.oss-cn-shanghai.aliyuncs.com/snapshot-00002.jpg?Expires=&OSSAccessKeyId=&Signature=&security-token=",   "http://example-bucket.oss-cn-shanghai.aliyuncs.com/snapshot-00003.jpg?Expires=&OSSAccessKeyId=&Signature=&security-token=" ]

Status

string

資源狀態。

Normal

CreateTime

string

媒資建立時間。時間格式為 ISO 8601,使用 UTC 時間(以 Z 結尾)。

2020-12-26T04:11:08Z

ModifiedTime

string

媒資修改時間。時間格式為 ISO 8601,使用 UTC 時間(以 Z 結尾)。

2020-12-26T04:11:10Z

DeletedTime

string

媒資刪除時間。時間格式為 ISO 8601,使用 UTC 時間(以 Z 結尾)。

2020-12-26T04:11:15Z

SpriteImages

string

雪碧圖。

[{"bucket":"example-bucket","count":"32","iceJobId":"******83ec44d58b2069def2e******","location":"oss-cn-shanghai","snapshotRegular":"example/example-{Count}.jpg","spriteRegular":"example/example-{TileCount}.jpg","templateId":"******e438b14ff39293eaec25******","tileCount":"1"}]

CateId

integer

分類 ID。

3048

Biz

string

媒資所屬業務。

ICE

UploadSource

string

媒資上傳來源。

general

CateName

string

分類名稱。

cateName

ReferenceId

string

自訂 ID,僅支援小寫字母、大寫字母、數字、橫線、底線,長度 6-64 個字元。使用者維度唯一。

123-1234

FileInfoList

array<object>

FileInfo 清單。

array<object>

FileBasicInfo

object

檔案基礎資訊,包含時長、大小等。

FileName

string

檔案名稱。

example.mp4

FileStatus

string

檔案狀態。

Normal

FileType

string

檔案類型。

source_file

FileSize

string

檔案大小(位元組)

30611502

FileUrl

string

檔案 OSS 位址。

http://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4?Expires=&OSSAccessKeyId=&Signature=&security-token=

Region

string

檔案儲存區域。

cn-shanghai

FormatName

string

封裝格式。

mov,mp4,m4a,3gp,3g2,mj2

Duration

string

時長。

216.206667

Bitrate

string

位元率。

1132.68

Width

string

寬。

960

Height

string

高。

540

CreateTime

string

檔案建立時間。時間格式為 ISO 8601,使用 UTC 時間(以 Z 結尾)。

2020-12-26T04:11:08Z

ModifiedTime

string

檔案修改時間。時間格式為 ISO 8601,使用 UTC 時間(以 Z 結尾)。

2020-12-26T04:11:10Z

AudioStreamInfoList

array<object>

音訊流資訊,一個媒資可能有多條音訊流。

object

Index

string

音訊流序號。

1

CodecName

string

編碼格式簡述名。

aac

CodecLongName

string

編碼格式長述名。

AAC (Advanced Audio Coding)

CodecTimeBase

string

編碼時基。

1/24000

CodecTagString

string

編碼格式標記文本。

mp4a

CodecTag

string

編碼格式標記。

0x6134706d

Profile

string

編碼預置。

High

SampleFmt

string

取樣格式。

fltp

SampleRate

string

取樣率。

44100

Channels

string

聲道數。

2

ChannelLayout

string

聲道輸出樣式。

stereo

Timebase

string

時基。

1/44100

StartTime

string

起始時間,單位:秒。

0.000000

Duration

string

時長。

16.200998

Bitrate

string

位元率。

127.794

Fps

string

音訊幀率。

8

NumFrames

string

總幀數。

10

Lang

string

語言。

und

VideoStreamInfoList

array<object>

視訊流資訊,一個媒資可能有多條視訊流。

object

Index

string

視訊流序號。

0

CodecName

string

編碼格式簡述名。

h264

CodecLongName

string

編碼格式長述名。

H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10

Profile

string

編碼預置。

High

CodecTimeBase

string

編碼時基。

1/48

CodecTagString

string

編碼格式標記文本。

[0][0][0][0]

CodecTag

string

編碼格式標記。

0x0000

Width

string

寬。

960

Height

string

高。

540

HasBFrames

string

是否有 B 幀。

2

Sar

string

編碼訊號解析度比。

0:1

Dar

string

編碼顯示解析度比。

0:1

PixFmt

string

像素格式。

yuv420p

Level

string

編碼等級。

30

Fps

string

視訊幀率。

24.0

AvgFPS

string

平均幀率。

24.0

Timebase

string

時基。

1/12288

StartTime

string

起始時間,單位:秒。

0.081706

Duration

string

時長。

216.206706

Bitrate

string

位元率。

1001.594

NumFrames

string

總幀數。

5184

Lang

string

語言。

und

Rotate

string

旋轉。

0

Nb_frames

string

總幀數。

5184

SubtitleStreamInfoList

array<object>

字幕流資訊,一個媒資可能有多條字幕流。

object

Index

string

字幕流序號。

1

CodecName

string

編碼格式簡述名。

srt

CodecLongName

string

編碼格式長述名。

SubRip Text

CodecTimeBase

string

編碼時基。

29.97

CodecTagString

string

編碼格式標記文本。

unicode

CodecTag

string

編碼格式標記。

unicode

Timebase

string

時基。

30

StartTime

string

起始時間,單位:秒。

0

Duration

string

時長。

1

Lang

string

語言。

und

AiRoughData

object

AI 分析原始資料。

Result

string

AI 分析原始結果。

https://sample-bucket.cn-shanghai.aliyuncs.com/result.json

Status

string

AI 分析狀態:

  • Analyzing 分析中

  • AnalyzeSuccess 分析成功

  • AnalyzeFailed 分析失敗

  • Saving 入庫中

  • SaveSuccess 入庫成功

  • SaveFailed 入庫失敗

  • Deleting 刪除中

  • DeleteSuccess 刪除成功

  • DeleteFailed 刪除失敗。

Analyzing

SaveType

string

入庫類型,智慧分析完成後是否入搜尋庫。取值:

  • TEXT 文字庫。

TEXT

AiCategory

string

AI 分類,取值:

  • 生活

  • 顏值

  • 萌寵

  • 資訊

  • 廣告

  • 環境資源

  • 汽車。

生活

AiJobId

string

AI 任務 ID。

****483915d4f2cd8ac20b48fb04****

StandardSmartTagJob

object

標籤任務。

AiJobId

string

AI 任務 ID。

****483915d4f2cd8ac20b48fb04****

Status

string

AI 分析狀態:

  • Analyzing 分析中

  • AnalyzeSuccess 分析成功

  • AnalyzeFailed 分析失敗。

Analyzing

ResultUrl

string

標籤結果 URL。

http://xx.oss-cn-shanghai.aliyuncs.com/result2.txt

Results

array<object>

標籤識別結果列表。

object

標籤識別結果。

Data

string

分析結果的具體資料,以 JSON 字串表示。不同 Type 的資料結構詳見 Result 參數說明。

{"autoChapters": [...]}

Type

string

標籤識別類型,取值:

  • NLP:NLP 處理結果

  • TextLabel:文字標籤

  • VideoLabel:影片標籤

  • ASR:語音識別原始結果

  • OCR:文字識別原始結果。

NLP

樣本

正常返回樣本

JSON格式

{
  "RequestId": "2FDE2411-DB8D-4A9A-875B-275798F14A5E",
  "MediaInfo": {
    "MediaId": "****20b48fb04483915d4f2cd8ac****",
    "MediaBasicInfo": {
      "MediaId": "****20b48fb04483915d4f2cd8ac****",
      "InputURL": "https://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4",
      "MediaType": "video",
      "BusinessType": "general",
      "Source": "oss",
      "Title": "Title",
      "Description": "Description",
      "Category": "Category",
      "MediaTags": "tag1",
      "CoverURL": "http://example-bucket.oss-cn-shanghai.aliyuncs.com/example.png?Expires=&OSSAccessKeyId=&Signature=&security-token=",
      "UserData": "userDataTest",
      "Snapshots": "[\n    \"http://example-bucket.oss-cn-shanghai.aliyuncs.com/snapshot-00001.png?Expires=&OSSAccessKeyId=&Signature=&security-token=\",\n    \"http://example-bucket.oss-cn-shanghai.aliyuncs.com/snapshot-00002.jpg?Expires=&OSSAccessKeyId=&Signature=&security-token=\",\n    \"http://example-bucket.oss-cn-shanghai.aliyuncs.com/snapshot-00003.jpg?Expires=&OSSAccessKeyId=&Signature=&security-token=\"\n]",
      "Status": "Normal",
      "CreateTime": "2020-12-26T04:11:08Z",
      "ModifiedTime": "2020-12-26T04:11:10Z",
      "DeletedTime": "2020-12-26T04:11:15Z",
      "SpriteImages": "[{\"bucket\":\"example-bucket\",\"count\":\"32\",\"iceJobId\":\"******83ec44d58b2069def2e******\",\"location\":\"oss-cn-shanghai\",\"snapshotRegular\":\"example/example-{Count}.jpg\",\"spriteRegular\":\"example/example-{TileCount}.jpg\",\"templateId\":\"******e438b14ff39293eaec25******\",\"tileCount\":\"1\"}]",
      "CateId": 3048,
      "Biz": "ICE",
      "UploadSource": "general",
      "CateName": "cateName",
      "ReferenceId": "123-1234"
    },
    "FileInfoList": [
      {
        "FileBasicInfo": {
          "FileName": "example.mp4",
          "FileStatus": "Normal",
          "FileType": "source_file",
          "FileSize": "30611502",
          "FileUrl": "http://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4?Expires=&OSSAccessKeyId=&Signature=&security-token=",
          "Region": "cn-shanghai",
          "FormatName": "mov,mp4,m4a,3gp,3g2,mj2",
          "Duration": "216.206667",
          "Bitrate": "1132.68",
          "Width": "960",
          "Height": "540",
          "CreateTime": "2020-12-26T04:11:08Z",
          "ModifiedTime": "2020-12-26T04:11:10Z"
        },
        "AudioStreamInfoList": [
          {
            "Index": "1",
            "CodecName": "aac",
            "CodecLongName": "AAC (Advanced Audio Coding)",
            "CodecTimeBase": "1/24000",
            "CodecTagString": "mp4a",
            "CodecTag": "0x6134706d",
            "Profile": "High",
            "SampleFmt": "fltp",
            "SampleRate": "44100",
            "Channels": "2",
            "ChannelLayout": "stereo",
            "Timebase": "1/44100",
            "StartTime": "0.000000",
            "Duration": "16.200998",
            "Bitrate": "127.794",
            "Fps": "8",
            "NumFrames": "10",
            "Lang": "und"
          }
        ],
        "VideoStreamInfoList": [
          {
            "Index": "0",
            "CodecName": "h264",
            "CodecLongName": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "Profile": "High",
            "CodecTimeBase": "1/48",
            "CodecTagString": "[0][0][0][0]",
            "CodecTag": "0x0000",
            "Width": "960",
            "Height": "540",
            "HasBFrames": "2",
            "Sar": "0:1",
            "Dar": "0:1",
            "PixFmt": "yuv420p",
            "Level": "30",
            "Fps": "24.0",
            "AvgFPS": "24.0",
            "Timebase": "1/12288",
            "StartTime": "0.081706",
            "Duration": "216.206706",
            "Bitrate": "1001.594",
            "NumFrames": "5184",
            "Lang": "und",
            "Rotate": "0",
            "Nb_frames": "5184"
          }
        ],
        "SubtitleStreamInfoList": [
          {
            "Index": "1",
            "CodecName": "srt",
            "CodecLongName": "SubRip Text",
            "CodecTimeBase": "29.97",
            "CodecTagString": "unicode",
            "CodecTag": "unicode",
            "Timebase": "30",
            "StartTime": "0",
            "Duration": "1",
            "Lang": "und"
          }
        ]
      }
    ],
    "AiRoughData": {
      "Result": "https://sample-bucket.cn-shanghai.aliyuncs.com/result.json",
      "Status": "Analyzing",
      "SaveType": "TEXT",
      "AiCategory": "生活",
      "AiJobId": "****483915d4f2cd8ac20b48fb04****",
      "StandardSmartTagJob": {
        "AiJobId": "****483915d4f2cd8ac20b48fb04****",
        "Status": "Analyzing",
        "ResultUrl": "http://xx.oss-cn-shanghai.aliyuncs.com/result2.txt",
        "Results": [
          {
            "Data": "{\"autoChapters\": [...]}",
            "Type": "NLP"
          }
        ]
      }
    }
  }
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。