输出元数据Output metadata

编码作业与要执行部分编码任务的输入资产相关联。An encoding job is associated with an input asset (or assets) on which you want to perform some encoding tasks. 例如,将 MP4 文件编码为 H.264 MP4 自适应比特率集;创建缩略图;创建叠加。For example, encode an MP4 file to H.264 MP4 adaptive bitrate sets; create a thumbnail; create overlays. 完成任务后,会生成一个输出资产。Upon completion of a task, an output asset is produced. 输出资产包含视频、音频、缩略图和其他文件。The output asset contains video, audio, thumbnails, and other files. 输出资产还包含提供输出资产相关元数据的文件。The output asset also contains a file with metadata about the output asset. 元数据 JSON 文件的名称采用以下格式:<source_file_name>_manifest.json(例如 BigBuckBunny_manifest.json)。The name of the metadata JSON file has the following format: <source_file_name>_manifest.json (for example, BigBuckBunny_manifest.json). 应扫描任何 *_metadata.json 并查询其中的文件路径字符串,以找到源文件名(无截断)。You should scan for any *_metadata.json and query the filepath string within to find the source filename (without truncation).

媒体服务不会先扫描输入资产以生成元数据。Media Services does not preemptively scan input assets to generate metadata. 只有在作业中处理输入资产时,才会生成输入元数据。Input metadata is generated only as an artifact when an input asset is processed in a job. 因此,此项目会写入到输出资产。Hence this artifact is written to the output asset. 使用不同的工具为输入资产和输出资产生成元数据。Different tools are used to generate metadata for input assets and output assets. 因此,输入元数据的模式与输出元数据略有不同。Therefore, the input metadata has a slightly different schema than the output metadata.

本文讨论作为输出元数据 (<source_file_name>_manifest.json) 的基础的 JSON 架构的元素和类型。This article discusses the elements and types of the JSON schema on which the output metadata (<source_file_name>_manifest.json) is based.

可以在本文末尾找到完整的架构代码和 JSON 示例。You can find the complete schema code and JSON example at the end of this article.

AssetFileAssetFile

用于编码作业的资产文件条目的集合。Collection of Asset File entries for the encoding job.

“属性”Name 说明Description
Sources 输入/源媒体文件的集合,处理该集合以生成此资产文件。Collection of input/source media files, that was processed in order to produce this Asset File.
示例: "Sources": [{"Name": "Ignite-short_1280x720_AACAudio_3551.mp4"}]Example: "Sources": [{"Name": "Ignite-short_1280x720_AACAudio_3551.mp4"}]
VideoTracksVideoTracks 每个物理资产文件都可包含交错成适当容器格式的零个或多个视频轨道。Each physical Asset File can contain in it zero or more videos tracks interleaved into an appropriate container format.
请参阅 VideoTracksSee VideoTracks.
AudioTracksAudioTracks 每个物理资产文件可以包含零个或以上交错到相应容器格式的音频轨道。Each physical Asset File can contain in it zero or more audio tracks interleaved into an appropriate container format. 这是所有这些音频轨道的集合。This is the collection of all those audio tracks.
有关详细信息,请参阅 AudioTracksFor more information, see AudioTracks.
名称Name
必须Required
媒体资产文件名称。The media asset file name.

示例: "Name": "Ignite-short_1280x720_AACAudio_3551.mp4"Example: "Name": "Ignite-short_1280x720_AACAudio_3551.mp4"
大小Size
必须Required
以字节为单位的资产文件大小。Size of the asset file in bytes.

示例: "Size": 32414631Example: "Size": 32414631
持续时间Duration
必须Required
内容播放持续时间。Content play back duration. 有关详细信息,请参阅 ISO8601 格式。For more information, see the ISO8601 format.

示例: "Duration": "PT1M10.315S"Example: "Duration": "PT1M10.315S"

VideoTracksVideoTracks

每个物理资产文件都可包含交错成适当容器格式的零个或多个视频轨道。Each physical Asset File can contain in it zero or more videos tracks interleaved into an appropriate container format. VideoTracks 元素表示其中包含所有视频轨道的一个集合。The VideoTracks element represents a collection of all the video tracks.

“属性”Name 说明Description
IDID
必须Required
此视频轨道从零开始的索引。注意: 此“ID”不一定是 MP4 文件中使用的 TrackID。Zero-based index of this video track. Note: This ID is not necessarily the TrackID as used in an MP4 file.

示例: "ID": 1Example: "ID": 1
FourCCFourCC
必须Required
ffmpeg 报告的视频编解码器 FourCC 代码。Video codec FourCC code that is reported by ffmpeg.

示例: "FourCC": "avc1"Example: "FourCC": "avc1"
ProfileProfile H264 配置文件(仅适用于 H264 编解码器)。H264 profile (only applicable to H264 codec).

示例: "Profile": "High"Example: "Profile": "High"
级别Level H264 级别(仅适用于 H264 编解码器)。H264 level (only applicable to H264 codec).

示例: "Level": "3.2"Example: "Level": "3.2"
WidthWidth
必须Required
以像素为单位的编码视频宽度。Encoded video width in pixels.

示例: "Width": "1280"Example: "Width": "1280"
HeightHeight
必须Required
以像素为单位的编码视频高度。Encoded video height in pixels.

示例: "Height": "720"Example: "Height": "720"
DisplayAspectRatioNumeratorDisplayAspectRatioNumerator
必须Required
视频显示纵横比分子。Video display aspect ratio numerator.

示例: "DisplayAspectRatioNumerator": 16.0Example: "DisplayAspectRatioNumerator": 16.0
DisplayAspectRatioDenominatorDisplayAspectRatioDenominator
必须Required
视频显示纵横比分母。Video display aspect ratio denominator.

示例: "DisplayAspectRatioDenominator": 9.0Example: "DisplayAspectRatioDenominator": 9.0
FramerateFramerate
必须Required
采用 .3f 格式的测量的视频帧速率。Measured video frame rate in.3f format.

示例: "Framerate": 29.970Example: "Framerate": 29.970
BitrateBitrate
必须Required
由资产文件计算所得的平均视频比特率(比特/秒)。Average video bit rate in bits per second, as calculated from the Asset File. 仅针对基本流有效负载计数,不包含打包开销。Counts only the elementary stream payload, and does not include the packaging overhead.

示例: "Bitrate": 3551567Example: "Bitrate": 3551567
TargetBitrateTargetBitrate
必须Required
通过编码预设请求的此视频轨道的目标平均比特率(比特/秒)。Target average bitrate for this video track, as requested via the encoding preset, in bits per second.

示例: "TargetBitrate": 3520000Example: "TargetBitrate": 3520000

AudioTracksAudioTracks

每个物理资产文件可以包含零个或以上交错到相应容器格式的音频轨道。Each physical Asset File can contain in it zero or more audio tracks interleaved into an appropriate container format. AudioTracks 元素表示其中包含所有那些音频轨道的一个集合。The AudioTracks element represents a collection of all those audio tracks.

“属性”Name 说明Description
IDID
必须Required
此音频轨道从零开始的索引。注意: 也不一定是 MP4 文件中使用的 TrackID。Zero-based index of this audio track. Note: This is not necessarily the TrackID as used in an MP4 file.

示例: "ID": 2Example: "ID": 2
CodecCodec 音频轨道编解码器字符串。Audio track codec string.

示例: "Codec": "aac"Example: "Codec": "aac"
语言Language 示例: "Language": "eng"Example: "Language": "eng"
通道Channels
必须Required
音频通道数。Number of audio channels.

示例: "Channels": 2Example: "Channels": 2
SamplingRateSamplingRate
必须Required
音频采样率(样本数/秒或 Hz)。Audio sampling rate in samples/sec or Hz.

示例: "SamplingRate": 48000Example: "SamplingRate": 48000
BitrateBitrate
必须Required
由资产文件计算所得的平均音频比特率(比特/秒)。Average audio bit rate in bits per second, as calculated from the Asset File. 仅针对基本流有效负载计数,不包含打包开销。Counts only the elementary stream payload, and does not include the packaging overhead.

示例: "Bitrate": 128041Example: "Bitrate": 128041

JSON 架构示例JSON schema example

{
  "AssetFile": [
    {
      "Sources": [
        {
          "Name": "Ignite-short_1280x720_AACAudio_3551.mp4"
        }
      ],
      "VideoTracks": [
        {
          "ID": 1,
          "FourCC": "avc1",
          "Profile": "High",
          "Level": "3.2",
          "Width": "1280",
          "Height": "720",
          "DisplayAspectRatioNumerator": 16.0,
          "DisplayAspectRatioDenominator": 9.0,
          "Framerate": 29.970,
          "Bitrate": 3551567,
          "TargetBitrate": 3520000
        }
      ],
      "AudioTracks": [
        {
          "ID": 2,
          "Codec": "aac",
          "Language": "eng",
          "Channels": 2,
          "SamplingRate": 48000,
          "Bitrate": 128041
        }
      ],
      "Name": "Ignite-short_1280x720_AACAudio_3551.mp4",
      "Size": 32414631,
      "Duration": "PT1M10.315S"
    },
    {
      "Sources": [
        {
          "Name": "Ignite-short_960x540_AACAudio_2216.mp4"
        }
      ],
      "VideoTracks": [
        {
          "ID": 1,
          "FourCC": "avc1",
          "Profile": "High",
          "Level": "3.1",
          "Width": "960",
          "Height": "540",
          "DisplayAspectRatioNumerator": 16.0,
          "DisplayAspectRatioDenominator": 9.0,
          "Framerate": 29.970,
          "Bitrate": 2216326,
          "TargetBitrate": 2210000
        }
      ],
      "AudioTracks": [
        {
          "ID": 2,
          "Codec": "aac",
          "Language": "eng",
          "Channels": 2,
          "SamplingRate": 48000,
          "Bitrate": 128041
        }
      ],
      "Name": "Ignite-short_960x540_AACAudio_2216.mp4",
      "Size": 20680897,
      "Duration": "PT1M10.315S"
    },
    {
      "Sources": [
        {
          "Name": "Ignite-short_640x360_AACAudio_1150.mp4"
        }
      ],
      "VideoTracks": [
        {
          "ID": 1,
          "FourCC": "avc1",
          "Profile": "High",
          "Level": "3.0",
          "Width": "640",
          "Height": "360",
          "DisplayAspectRatioNumerator": 16.0,
          "DisplayAspectRatioDenominator": 9.0,
          "Framerate": 29.970,
          "Bitrate": 1150440,
          "TargetBitrate": 1150000
        }
      ],
      "AudioTracks": [
        {
          "ID": 2,
          "Codec": "aac",
          "Language": "eng",
          "Channels": 2,
          "SamplingRate": 48000,
          "Bitrate": 128041
        }
      ],
      "Name": "Ignite-short_640x360_AACAudio_1150.mp4",
      "Size": 11313920,
      "Duration": "PT1M10.315S"
    },
    {
      "Sources": [
        {
          "Name": "Ignite-short_480x270_AACAudio_722.mp4"
        }
      ],
      "VideoTracks": [
        {
          "ID": 1,
          "FourCC": "avc1",
          "Profile": "High",
          "Level": "2.1",
          "Width": "480",
          "Height": "270",
          "DisplayAspectRatioNumerator": 16.0,
          "DisplayAspectRatioDenominator": 9.0,
          "Framerate": 29.970,
          "Bitrate": 722682,
          "TargetBitrate": 720000
        }
      ],
      "AudioTracks": [
        {
          "ID": 2,
          "Codec": "aac",
          "Language": "eng",
          "Channels": 2,
          "SamplingRate": 48000,
          "Bitrate": 128041
        }
      ],
      "Name": "Ignite-short_480x270_AACAudio_722.mp4",
      "Size": 7554708,
      "Duration": "PT1M10.315S"
    },
    {
      "Sources": [
        {
          "Name": "Ignite-short_320x180_AACAudio_380.mp4"
        }
      ],
      "VideoTracks": [
        {
          "ID": 1,
          "FourCC": "avc1",
          "Profile": "High",
          "Level": "1.3",
          "Width": "320",
          "Height": "180",
          "DisplayAspectRatioNumerator": 16.0,
          "DisplayAspectRatioDenominator": 9.0,
          "Framerate": 29.970,
          "Bitrate": 380655,
          "TargetBitrate": 380000
        }
      ],
      "AudioTracks": [
        {
          "ID": 2,
          "Codec": "aac",
          "Language": "eng",
          "Channels": 2,
          "SamplingRate": 48000,
          "Bitrate": 128041
        }`
      ],
      "Name": "Ignite-short_320x180_AACAudio_380.mp4",
      "Size": 4548932,
      "Duration": "PT1M10.315S"
    }
  ]
}

后续步骤Next steps

从 HTTPS URL 创建作业输入Create a job input from an HTTPS URL