Input metadata

Media Services logo v3


Warning

Azure Media Services will be retired June 30th, 2024. For more information, see the AMS Retirement Guide.

An encoding job is associated with an input asset (or assets) on which you want to perform some encoding tasks. Upon completion of a task, an output asset is produced. The output asset contains video, audio, thumbnails, manifest, and other files.

The output asset also contains a file with metadata about the input asset. The name of the metadata JSON file has a random ID, do not use it to identify the input asset that output asset belongs to. To identify the input asset it belongs to, use the Uri field (for more information, see Other child elements).

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.

This article discusses the elements and types of the JSON schema on which the input metada (<asset_id>_metadata.json ) is based. For information about the file that contains metadata about the output asset, see Output metadata.

You can find the JSON schema example at the end of this article.

Note

All time is based on the ISO-8601 format. For more information about duration formatting, see Times and Durations in the same article.

AssetFile

Contains a collection of AssetFile elements for the encoding job.

Note

The following four child elements must appear in a sequence.

Name Description
VideoTracks Each physical asset file can contain zero or more videos tracks interleaved into an appropriate container format. For more information, see VideoTracks.
AudioTracks Each physical asset file can contain zero or more audio tracks interleaved into an appropriate container format. For more information, see AudioTracks
Metadata Asset file’s metadata represented as key\value strings.
For example: <Metadata key="language" value="eng" />

Other child elements

Name Description
Name
Required
Asset file name.

Example: "Name": "Ignite-short.mp4"
Uri
Required
The URL where the input asset is located. To identify the input asset the output asset belongs to, use the Uri field instead of ID.
Size
Required
Size of the asset file in bytes.

Example: "Size": 75739259
Duration
Required
Content play back duration.

Example: "Duration": "PT1M10.304S".
NumberOfStreams
Required
Number of streams in the asset file.

Example: "NumberOfStreams": 2
FormatNames
Required
Format names.

Example: "FormatNames": "mov,mp4,m4a,3gp,3g2,mj2"
FormatVerboseName
Required
Format verbose names.

Example: "FormatVerboseName": "QuickTime / MOV"
StartTime Content start time.

Example: "StartTime": "PT0S"
OverallBitRate Average bitrate of the asset file in bits per second.

Example: "OverallBitRate": 8618539

VideoTracks

Name Description
FourCC
Required
Video codec FourCC code that is reported by ffmpeg.

Example: "FourCC": "avc1" | "hev1" | "hvc1"
Profile Video track's profile.

Example: "Profile": "Main"
Level Video track's level.

Example: "Level": "3.2"
PixelFormat Video track's pixel format.

Example: "PixelFormat": "yuv420p"
Width
Required
Encoded video width in pixels.

Example: "Width": "1280"
Height
Required
Encoded video height in pixels.

Example: "Height": "720"
DisplayAspectRatioNumerator
Required
Video display aspect ratio numerator.

Example: "DisplayAspectRatioNumerator": 16.0
DisplayAspectRatioDenominator
Required
Video display aspect ratio denominator.

Example: "DisplayAspectRatioDenominator": 9.0
SampleAspectRatioNumerator Video sample aspect ratio numerator.

Example: "SampleAspectRatioNumerator": 1.0
SampleAspectRatioDenominator Example: "SampleAspectRatioDenominator": 1.0
FrameRate
Required
Measured video frame rate in .3f format.

Example: "FrameRate": 29.970
Bitrate Average video bit rate in bits per second, as calculated from the asset file. Only the elementary stream payload is counted, and the packaging overhead is not included.

Example: "Bitrate": 8421583
HasBFrames Video track number of B frames.

Example: "HasBFrames": 2
Metadata Generic key/value strings that can be used to hold a variety of information.
See the full example at the end of the article.
Id
Required
Zero-based index of this audio or video track.

This Id is not necessarily the TrackID as used in an MP4 file.

Example: "Id": 2
Codec Video track codec string.

Example: "Codec": "h264 | hev1"
CodecLongName Audio or video track codec long name.

Example: "CodecLongName": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
Codec Video track codec string.

Example: "Codec": "h264 | hev1"
TimeBase
Required
Time base.

Example: "TimeBase": "1/30000"
NumberOfFrames Number of frames (present for video tracks).

Example: "NumberOfFrames": 2107
StartTime Track start time.

Example: "StartTime": "PT0.033S"
Duration Track duration.

Example: "Duration": "PT1M10.304S"

AudioTracks

Name Description
SampleFormat Sample format.

Example: "SampleFormat": "fltp"
ChannelLayout Channel layout.

Example: "ChannelLayout": "stereo"
Channels
Required
Number (0 or more) of audio channels.

Example: "Channels": 2
SamplingRate
Required
Audio sampling rate in samples/sec or Hz.

Example: "SamplingRate": 48000
Bitrate Average audio bit rate in bits per second, as calculated from the asset file. Only the elementary stream payload is counted, and the packaging overhead is not included in this count.

Example: "Bitrate": 192080
Metadata Generic key/value strings that can be used to hold a variety of information.
See the full example at the end of the article.
Id
Required
Zero-based index of this audio or video track.

This is not necessarily that the TrackID as used in an MP4 file.

Example: "Id": 1
Codec Video track codec string.

Example: "Codec": "aac"
CodecLongName Audio or video track codec long name.

Example: "CodecLongName": "AAC (Advanced Audio Coding)"
TimeBase
Required
Time base.

Example: "TimeBase": "1/48000"
NumberOfFrames Number of frames (present for video tracks).

Example: "NumberOfFrames": 3294
StartTime Track start time.

Example: "StartTime": "PT0S"
Duration Track duration.

Example: "Duration": "PT1M10.272S"

Metadata

Name Description
key
Required
The key in the key/value pair.
value
Required
The value in the key/value pair.

Schema example

{
  "AssetFile": [
    {
      "VideoTracks": [
        {
          "FourCC": "avc1",
          "Profile": "Main",
          "Level": "3.2",
          "PixelFormat": "yuv420p",
          "Width": "1280",
          "Height": "720",
          "DisplayAspectRatioNumerator": 16.0,
          "DisplayAspectRatioDenominator": 9.0,
          "SampleAspectRatioNumerator": 1.0,
          "SampleAspectRatioNumeratorSpecified": true,
          "SampleAspectRatioDenominator": 1.0,
          "SampleAspectRatioDenominatorSpecified": true,
          "FrameRate": 29.970,
          "Bitrate": 8421583,
          "BitrateSpecified": true,
          "HasBFrames": 2,
          "HasBFramesSpecified": true,
          "Disposition": {
            "Default": 1
          },
          "Metadata": [
            {
              "key": "creation_time",
              "value": "2018-02-21T21:42:08.000000Z"
            },
            {
              "key": "language",
              "value": "eng"
            },
            {
              "key": "handler_name",
              "value": "Video Media Handler"
            },
            {
              "key": "encoder",
              "value": "AVC Coding"
            }
          ],
          "Id": 2,
          "Codec": "h264",
          "CodecLongName": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
          "TimeBase": "1/30000",
          "NumberOfFrames": 2107,
          "NumberOfFramesSpecified": true,
          "StartTime": "PT0.033S",
          "Duration": "PT1M10.304S"
        }
      ],
      "AudioTracks": [
        {
          "SampleFormat": "fltp",
          "ChannelLayout": "stereo",
          "Channels": 2,
          "SamplingRate": 48000,
          "Bitrate": 192080,
          "BitrateSpecified": true,
          "BitsPerSampleSpecified": true,
          "Disposition": {
            "Default": 1
          },
          "Metadata": [
            {
              "key": "creation_time",
              "value": "2018-02-21T21:42:08.000000Z"
            },
            {
              "key": "language",
              "value": "eng"
            },
            {
              "key": "handler_name",
              "value": "Sound Media Handler"
            }
          ],
          "Id": 1,
          "Codec": "aac",
          "CodecLongName": "AAC (Advanced Audio Coding)",
          "TimeBase": "1/48000",
          "NumberOfFrames": 3294,
          "NumberOfFramesSpecified": true,
          "StartTime": "PT0S",
          "Duration": "PT1M10.272S"
        }
      ],
      "Metadata": [
        {
          "key": "major_brand",
          "value": "mp42"
        },
        {
          "key": "minor_version",
          "value": "19529854"
        },
        {
          "key": "compatible_brands",
          "value": "mp42isom"
        },
        {
          "key": "creation_time",
          "value": "2018-02-21T21:42:08.000000Z"
        }
      ],
      "Name": "Ignite-short.mp4",
      "Uri": "https://amsstorageacct.blob.core.windows.net/asset-00000000-0000-0000-000000000000/ignite.mp4",
      "Size": 75739259,
      "Duration": "PT1M10.304S",
      "NumberOfStreams": 2,
      "FormatNames": "mov,mp4,m4a,3gp,3g2,mj2",
      "FormatVerboseName": "QuickTime / MOV",
      "StartTime": "PT0S",
      "OverallBitRate": 8618539,
      "OverallBitRateSpecified": true
    }
  ]
}

Get help and support

You can contact Media Services with questions or follow our updates by one of the following methods: