充当事件网格源的 Azure 媒体服务Azure Media Services as an Event Grid source

本文介绍媒体服务事件的架构和属性。This article provides the schemas and properties for Media Services events.

媒体服务会发出如下所述的作业相关事件类型。Media Services emits the Job related event types described below. 有两类作业相关事件 :“监视作业状态更改”和“监视作业输出状态更改”。There are two categories for the Job related events: "Monitoring Job State Changes" and "Monitoring Job Output State Changes".

可通过订阅 JobStateChange 事件来注册所有事件。You can register for all of the events by subscribing to the JobStateChange event. 或者,可以只订阅特定事件(例如,JobErrored、JobFinished 和 JobCanceled 等最终状态)。Or, you can subscribe for specific events only (for example, final states like JobErrored, JobFinished, and JobCanceled).

监视作业状态更改Monitoring Job state changes

事件类型Event type 说明Description
Microsoft.Media.JobStateChangeMicrosoft.Media.JobStateChange 获取所有作业状态更改的事件。Get an event for all Job State changes.
Microsoft.Media.JobScheduledMicrosoft.Media.JobScheduled 获取当作业转换为已计划状态时的事件。Get an event when Job transitions to scheduled state.
Microsoft.Media.JobProcessingMicrosoft.Media.JobProcessing 获取当作业转换为正在处理状态时的事件。Get an event when Job transitions to processing state.
Microsoft.Media.JobCancelingMicrosoft.Media.JobCanceling 获取当作业转换为正在取消状态时的事件。Get an event when Job transitions to canceling state.
Microsoft.Media.JobFinishedMicrosoft.Media.JobFinished 获取当作业转换为已完成状态时的事件。Get an event when Job transitions to finished state. 这是包含作业输出的最终状态。This is a final state that includes Job outputs.
Microsoft.Media.JobCanceledMicrosoft.Media.JobCanceled 获取当作业转换为已取消状态时的事件。Get an event when Job transitions to canceled state. 这是包含作业输出的最终状态。This is a final state that includes Job outputs.
Microsoft.Media.JobErroredMicrosoft.Media.JobErrored 获取当作业转换为错误状态时的事件。Get an event when Job transitions to error state. 这是包含作业输出的最终状态。This is a final state that includes Job outputs.

请参阅后面的架构示例See Schema examples that follow.

监视作业输出状态更改Monitoring job output state changes

一个作业可能包含多个作业输出(如果将转换配置为具有多个作业输出。)如果要跟踪单个作业输出的详细信息,请侦听作业输出更改事件。A job may contain multiple job outputs (if you configured the transform to have multiple job outputs.) If you want to track the details of the individual job output, listen for a job output change event.

每个 Job 的级别高于 JobOutput 的级别,因此作业输出事件会在相应的作业内触发。Each Job is going to be at a higher level than JobOutput, thus job output events get fired inside of a corresponding job.

JobFinishedJobCanceledJobError 中的错误消息输出各个作业输出的聚合结果(当所有作业都完成时),The error messages in JobFinished, JobCanceled, JobError output the aggregated results for each job output - when all of them are finished. 而作业输出事件会在每个任务完成时触发。Whereas, the job output events fire as each task finishes. 例如,如果你有一个编码输出,后跟一个视频分析输出,则在使用聚合数据触发最终 JobFinished 事件之前,你将得到两个作为作业输出事件触发的事件。For example, if you have an encoding output, followed by a Video Analytics output, you would get two events firing as job output events before the final JobFinished event fires with the aggregated data.

事件类型Event type 说明Description
Microsoft.Media.JobOutputStateChangeMicrosoft.Media.JobOutputStateChange 获取所有作业输出状态更改的事件。Get an event for all Job output State changes.
Microsoft.Media.JobOutputScheduledMicrosoft.Media.JobOutputScheduled 获取当作业输出转换为已计划状态时的事件。Get an event when Job output transitions to scheduled state.
Microsoft.Media.JobOutputProcessingMicrosoft.Media.JobOutputProcessing 获取当作业输出转换为正在处理状态时的事件。Get an event when Job output transitions to processing state.
Microsoft.Media.JobOutputCancelingMicrosoft.Media.JobOutputCanceling 获取当作业输出转换为正在取消状态时的事件。Get an event when Job output transitions to canceling state.
Microsoft.Media.JobOutputFinishedMicrosoft.Media.JobOutputFinished 获取当作业输出转换为已完成状态时的事件。Get an event when Job output transitions to finished state.
Microsoft.Media.JobOutputCanceledMicrosoft.Media.JobOutputCanceled 获取当作业输出转换为已取消状态时的事件。Get an event when Job output transitions to canceled state.
Microsoft.Media.JobOutputErroredMicrosoft.Media.JobOutputErrored 获取当作业输出转换为错误状态时的事件。Get an event when Job output transitions to error state.

请参阅后面的架构示例See Schema examples that follow.

监视作业输出进度Monitoring job output progress

事件类型Event type 说明Description
Microsoft.Media.JobOutputProgressMicrosoft.Media.JobOutputProgress 此事件反映了作业处理进度,从 0% 到 100%。This event reflects the job processing progress, from 0% to 100%. 如果进度值增加了 5% 或更多,或者自上次事件(检测信号)以来已超过 30 秒,则服务会尝试发送事件。The service attempts to send an event if there has been 5% or greater increase in the progress value or it has been more than 30 seconds since the last event (heartbeat). 无法保证进度值从 0% 开始或达到 100%,也无法保证其随时间推移而以恒定速率增加。The progress value is not guaranteed to start at 0%, or to reach 100%, nor is it guaranteed to increase at a constant rate over time. 不应使用此事件来确定处理是否已完成,应改用状态更改事件。This event should not be used to determine that the processing has been completed - you should instead use the state change events.

请参阅后面的架构示例See Schema examples that follow.

实时事件类型Live event types

媒体服务也会发出如下所述的实时事件类型。Media Services also emits the Live event types described below. 实时事件有两种类别:流级事件和轨迹级事件。There are two categories for the Live events: stream-level events and track-level events.

流级事件Stream-level events

按流或连接引发流级事件。Stream-level events are raised per stream or connection. 每个事件具有一个用于标识连接或流的 StreamId 参数。Each event has a StreamId parameter that identifies the connection or stream. 每个流或连接具有一个或多个不同类型的轨迹。Each stream or connection has one or more tracks of different types. 例如,来自编码器的一个连接可能具有一个音频轨迹和四个视频轨迹。For example, one connection from an encoder may have one audio track and four video tracks. 流事件类型包括:The stream event types are:

事件类型Event type 说明Description
Microsoft.Media.LiveEventConnectionRejectedMicrosoft.Media.LiveEventConnectionRejected 编码器的连接尝试被拒绝。Encoder's connection attempt is rejected.
Microsoft.Media.LiveEventEncoderConnectedMicrosoft.Media.LiveEventEncoderConnected 编码器与直播活动建立连接。Encoder establishes connection with live event.
Microsoft.Media.LiveEventEncoderDisconnectedMicrosoft.Media.LiveEventEncoderDisconnected 编码器断开连接。Encoder disconnects.

请参阅后面的架构示例See Schema examples that follow.

轨迹级事件Track-level events

按轨迹引发轨迹级事件。Track-level events are raised per track.

Note

所有轨迹级事件都在连接实时编码器后引发。All track-level events are raised after a live encoder is connected.

轨迹级事件类型包括:The track-level event types are:

事件类型Event type 说明Description
Microsoft.Media.LiveEventIncomingDataChunkDroppedMicrosoft.Media.LiveEventIncomingDataChunkDropped 媒体服务器删除了数据区块,因为该区块的抵达时间过迟,或者带有重叠的时间戳(新数据区块的时间戳小于前一数据区块的结束时间)。Media server drops data chunk because it's too late or has an overlapping timestamp (timestamp of new data chunk is less than the end time of the previous data chunk).
Microsoft.Media.LiveEventIncomingStreamReceivedMicrosoft.Media.LiveEventIncomingStreamReceived 媒体服务器收到流或连接中每个轨迹的第一个数据区块。Media server receives first data chunk for each track in the stream or connection.
Microsoft.Media.LiveEventIncomingStreamsOutOfSyncMicrosoft.Media.LiveEventIncomingStreamsOutOfSync 媒体服务器检测到音频和视频流不同步。用作警告,因为用户体验可能不受影响。Media server detects audio and video streams are out of sync. Use as a warning because user experience may not be impacted.
Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSyncMicrosoft.Media.LiveEventIncomingVideoStreamsOutOfSync 媒体服务器检测到来自外部编码器的任意两个视频流不同步。用作警告,因为用户体验可能不受影响。Media server detects any of the two video streams coming from external encoder are out of sync. Use as a warning because user experience may not be impacted.
Microsoft.Media.LiveEventIngestHeartbeatMicrosoft.Media.LiveEventIngestHeartbeat 当直播活动正在运行时,每隔 20 秒为每个轨迹发布。Published every 20 seconds for each track when live event is running. 提供引入运行状况摘要。Provides ingest health summary.

在编码器最初连接后,无论编码器是否仍然处于连接状态,检测信号事件都会继续按 20 秒 1 次的频率发出。After the encoder was initially connected, the heartbeat event continues to emit every 20 sec whether the encoder is still connected or not.
Microsoft.Media.LiveEventTrackDiscontinuityDetectedMicrosoft.Media.LiveEventTrackDiscontinuityDetected 媒体服务器检测到传入轨迹中存在不连续的情况。Media server detects discontinuity in the incoming track.

请参阅后面的架构示例See Schema examples that follow.

事件架构示例Event schema examples

JobStateChangeJobStateChange

以下示例显示 JobStateChange 事件的架构:The following example shows the schema of the JobStateChange event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "transforms/VideoAnalyzerTransform/jobs/<job-id>",
    "eventType": "Microsoft.Media.JobStateChange",
    "eventTime": "2018-04-20T21:26:13.8978772",
    "id": "b9d38923-9210-4c2b-958f-0054467d4dd7",
    "data": {
      "previousState": "Processing",
      "state": "Finished"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
previousStatepreviousState stringstring 事件发生前的作业状态。The state of the job before the event.
statestate stringstring 此事件中通知的作业的新状态。The new state of the job being notified in this event. 例如,“已计划:作业已准备就绪”或“已完成:作业已完成。”For example, "Scheduled: The job is ready to start" or "Finished: The job is finished" .

作业状态可以是以下任何一个值:已排队、已计划、正在处理、已完成、错误、已取消、正在取消 Where the Job state can be one of the values: Queued, Scheduled, Processing, Finished, Error, Canceled, Canceling

Note

已排队仅出现在 previousState 属性中,不出现在 state 属性中 。Queued is only going to be present in the previousState property but not in the state property.

JobScheduled、JobProcessing、JobCancelingJobScheduled, JobProcessing, JobCanceling

对于每个非最终作业状态更改(例如 JobScheduled、JobProcessing、JobCanceling),示例架构类似于以下内容:For each non-final Job state change (such as JobScheduled, JobProcessing, JobCanceling), the example schema looks similar to the following:

[{
  "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
  "subject": "transforms/VideoAnalyzerTransform/jobs/<job-id>",
  "eventType": "Microsoft.Media.JobProcessing",
  "eventTime": "2018-10-12T16:12:18.0839935",
  "id": "a0a6efc8-f647-4fc2-be73-861fa25ba2db",
  "data": {
    "previousState": "Scheduled",
    "state": "Processing",
    "correlationData": {
      "testKey1": "testValue1",
      "testKey2": "testValue2"
    }
  },
  "dataVersion": "1.0",
  "metadataVersion": "1"
}]

JobFinished、JobCanceled、JobErroredJobFinished, JobCanceled, JobErrored

对于每个最终作业状态更改(例如 JobFinished、JobCanceled、JobErrored),示例架构类似于以下内容:For each final Job state change (such as JobFinished, JobCanceled, JobErrored), the example schema looks similar to the following:

[{
  "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
  "subject": "transforms/VideoAnalyzerTransform/jobs/<job-id>",
  "eventType": "Microsoft.Media.JobFinished",
  "eventTime": "2018-10-12T16:25:56.4115495",
  "id": "9e07e83a-dd6e-466b-a62f-27521b216f2a",
  "data": {
    "outputs": [
      {
        "@odata.type": "#Microsoft.Media.JobOutputAsset",
        "assetName": "output-7640689F",
        "error": null,
        "label": "VideoAnalyzerPreset_0",
        "progress": 100,
        "state": "Finished"
      }
    ],
    "previousState": "Processing",
    "state": "Finished",
    "correlationData": {
      "testKey1": "testValue1",
      "testKey2": "testValue2"
    }
  },
  "dataVersion": "1.0",
  "metadataVersion": "1"
}]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
outputsoutputs ArrayArray 获取作业输出。Gets the Job outputs.

JobOutputStateChangeJobOutputStateChange

以下示例展示了 JobOutputStateChange 事件的架构:The following example shows the schema of the JobOutputStateChange event:

[{
  "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
  "subject": "transforms/VideoAnalyzerTransform/jobs/<job-id>",
  "eventType": "Microsoft.Media.JobOutputStateChange",
  "eventTime": "2018-10-12T16:25:56.0242854",
  "id": "dde85f46-b459-4775-b5c7-befe8e32cf90",
  "data": {
    "previousState": "Processing",
    "output": {
      "@odata.type": "#Microsoft.Media.JobOutputAsset",
      "assetName": "output-7640689F",
      "error": null,
      "label": "VideoAnalyzerPreset_0",
      "progress": 100,
      "state": "Finished"
    },
    "jobCorrelationData": {
      "testKey1": "testValue1",
      "testKey2": "testValue2"
    }
  },
  "dataVersion": "1.0",
  "metadataVersion": "1"
}]

JobOutputScheduled、JobOutputProcessing、JobOutputFinished、JobOutputCanceling、JobOutputCanceled、JobOutputErroredJobOutputScheduled, JobOutputProcessing, JobOutputFinished, JobOutputCanceling, JobOutputCanceled, JobOutputErrored

对于每个 JobOutput 状态更改,示例架构类似于以下内容:For each JobOutput state change, the example schema looks similar to the following:

[{
  "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
  "subject": "transforms/VideoAnalyzerTransform/jobs/<job-id>",
  "eventType": "Microsoft.Media.JobOutputProcessing",
  "eventTime": "2018-10-12T16:12:18.0061141",
  "id": "f1fd5338-1b6c-4e31-83c9-cd7c88d2aedb",
  "data": {
    "previousState": "Scheduled",
    "output": {
      "@odata.type": "#Microsoft.Media.JobOutputAsset",
      "assetName": "output-7640689F",
      "error": null,
      "label": "VideoAnalyzerPreset_0",
      "progress": 0,
      "state": "Processing"
    },
    "jobCorrelationData": {
      "testKey1": "testValue1",
      "testKey2": "testValue2"
    }
  },
  "dataVersion": "1.0",
  "metadataVersion": "1"
}]

JobOutputProgressJobOutputProgress

示例架构类似如下:The example schema looks similar to the following:

[{
 "topic": "/subscriptions/<subscription-id>/resourceGroups/belohGroup/providers/Microsoft.Media/mediaservices/<account-name>",
 "subject": "transforms/VideoAnalyzerTransform/jobs/job-5AB6DE32",
 "eventType": "Microsoft.Media.JobOutputProgress",
 "eventTime": "2018-12-10T18:20:12.1514867",
 "id": "00000000-0000-0000-0000-000000000000",
 "data": {
   "jobCorrelationData": {
     "TestKey1": "TestValue1",
     "testKey2": "testValue2"
   },
   "label": "VideoAnalyzerPreset_0",
   "progress": 86
 },
 "dataVersion": "1.0",
 "metadataVersion": "1"
}]

LiveEventConnectionRejectedLiveEventConnectionRejected

以下示例显示 LiveEventConnectionRejected 事件的架构:The following example shows the schema of the LiveEventConnectionRejected event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaServices/<account-name>",
    "subject": "/LiveEvents/MyLiveEvent1",
    "eventType": "Microsoft.Media.LiveEventConnectionRejected",
    "eventTime": "2018-01-16T01:57:26.005121Z",
    "id": "b303db59-d5c1-47eb-927a-3650875fded1",
    "data": { 
      "streamId":"Mystream1",
      "ingestUrl": "http://abc.ingest.isml",
      "encoderIp": "118.238.251.xxx",
      "encoderPort": 52859,
      "resultCode": "MPE_INGEST_CODEC_NOT_SUPPORTED"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
streamIdstreamId stringstring 流或连接的标识符。Identifier of the stream or connection. 编码器或客户负责在引入 URL 中添加此 ID。Encoder or customer is responsible to add this ID in the ingest URL.
ingestUrlingestUrl stringstring 直播活动提供的引入 URL。Ingest URL provided by the live event.
encoderIpencoderIp stringstring 编码器的 IP。IP of the encoder.
encoderPortencoderPort stringstring 此流的来源编码器的端口。Port of the encoder from where this stream is coming.
resultCoderesultCode stringstring 拒绝连接的原因。The reason the connection was rejected. 下表中列出了结果代码。The result codes are listed in the following table.

LiveEventEncoderConnectedLiveEventEncoderConnected

以下示例显示 LiveEventEncoderConnected 事件的架构:The following example shows the schema of the LiveEventEncoderConnected event:

[
  { 
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "liveEvent/mle1",
    "eventType": "Microsoft.Media.LiveEventEncoderConnected",
    "eventTime": "2018-08-07T23:08:09.1710643",
    "id": "<id>",
    "data": {
      "ingestUrl": "http://mle1-amsts03mediaacctgndos-ts031.channel.media.azure-test.net:80/ingest.isml",
      "streamId": "15864-stream0",
      "encoderIp": "131.107.147.xxx",
      "encoderPort": "27485"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
streamIdstreamId stringstring 流或连接的标识符。Identifier of the stream or connection. 编码器或客户负责在引入 URL 中提供此 ID。Encoder or customer is responsible for providing this ID in the ingest URL.
ingestUrlingestUrl stringstring 直播活动提供的引入 URL。Ingest URL provided by the live event.
encoderIpencoderIp stringstring 编码器的 IP。IP of the encoder.
encoderPortencoderPort stringstring 此流的来源编码器的端口。Port of the encoder from where this stream is coming.

LiveEventEncoderDisconnectedLiveEventEncoderDisconnected

以下示例显示 LiveEventEncoderDisconnected 事件的架构:The following example shows the schema of the LiveEventEncoderDisconnected event:

[
  { 
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "liveEvent/mle1",
    "eventType": "Microsoft.Media.LiveEventEncoderDisconnected",
    "eventTime": "2018-08-07T23:08:09.1710872",
    "id": "<id>",
    "data": {
      "ingestUrl": "http://mle1-amsts03mediaacctgndos-ts031.channel.media.azure-test.net:80/ingest.isml",
      "streamId": "15864-stream0",
      "encoderIp": "131.107.147.xxx",
      "encoderPort": "27485",
      "resultCode": "S_OK"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
streamIdstreamId stringstring 流或连接的标识符。Identifier of the stream or connection. 编码器或客户负责在引入 URL 中添加此 ID。Encoder or customer is responsible to add this ID in the ingest URL.
ingestUrlingestUrl stringstring 直播活动提供的引入 URL。Ingest URL provided by the live event.
encoderIpencoderIp stringstring 编码器的 IP。IP of the encoder.
encoderPortencoderPort stringstring 此流的来源编码器的端口。Port of the encoder from where this stream is coming.
resultCoderesultCode stringstring 编码器断开连接的原因。The reason for the encoder disconnecting. 可能是正常断开连接,或者是由于出错而断开连接。It could be graceful disconnect or from an error. 下表中列出了结果代码。The result codes are listed in the following table.

正常断开连接结果代码为:The graceful disconnect result codes are:

结果代码Result code 说明Description
S_OKS_OK 编码器已成功断开连接。Encoder disconnected successfully.
MPE_CLIENT_TERMINATED_SESSIONMPE_CLIENT_TERMINATED_SESSION 编码器已断开连接 (RTMP)。Encoder disconnected (RTMP).
MPE_CLIENT_DISCONNECTEDMPE_CLIENT_DISCONNECTED 编码器已断开连接 (FMP4)。Encoder disconnected (FMP4).
MPI_REST_API_CHANNEL_RESETMPI_REST_API_CHANNEL_RESET 收到通道重置命令。Channel reset command is received.
MPI_REST_API_CHANNEL_STOPMPI_REST_API_CHANNEL_STOP 收到通道停止命令。Channel stop command received.
MPI_REST_API_CHANNEL_STOPMPI_REST_API_CHANNEL_STOP 正在维护通道。Channel undergoing maintenance.
MPI_STREAM_HIT_EOFMPI_STREAM_HIT_EOF 编码器已发送 EOF 流。EOF stream is sent by the encoder.

LiveEventIncomingDataChunkDroppedLiveEventIncomingDataChunkDropped

以下示例显示 LiveEventIncomingDataChunkDropped 事件的架构:The following example shows the schema of the LiveEventIncomingDataChunkDropped event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaServices/<account-name>",
    "subject": "/LiveEvents/MyLiveEvent1",
    "eventType": "Microsoft.Media.LiveEventIncomingDataChunkDropped",
    "eventTime": "2018-01-16T01:57:26.005121Z",
    "id": "03da9c10-fde7-48e1-80d8-49936f2c3e7d",
    "data": { 
      "trackType": "Video",
      "trackName": "Video",
      "bitrate": 300000,
      "timestamp": 36656620000,
      "timescale": 10000000,
      "resultCode": "FragmentDrop_OverlapTimestamp"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
trackTypetrackType stringstring 轨道类型(音频/视频)。Type of the track (Audio / Video).
trackNametrackName stringstring 轨道名称。Name of the track.
比特率bitrate integerinteger 轨道的比特率。Bitrate of the track.
timestamptimestamp stringstring 已删除的数据区块的时间戳。Timestamp of the data chunk dropped.
timescaletimescale stringstring 时间戳的时间刻度。Timescale of the timestamp.
resultCoderesultCode stringstring 删除数据区块的原因。Reason of the data chunk drop. FragmentDrop_OverlapTimestampFragmentDrop_NonIncreasingTimestampFragmentDrop_OverlapTimestamp or FragmentDrop_NonIncreasingTimestamp.

LiveEventIncomingStreamReceivedLiveEventIncomingStreamReceived

以下示例显示 LiveEventIncomingStreamReceived 事件的架构:The following example shows the schema of the LiveEventIncomingStreamReceived event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "liveEvent/mle1",
    "eventType": "Microsoft.Media.LiveEventIncomingStreamReceived",
    "eventTime": "2018-08-07T23:08:10.5069288Z",
    "id": "7f939a08-320c-47e7-8250-43dcfc04ab4d",
    "data": {
      "ingestUrl": "http://mle1-amsts03mediaacctgndos-ts031.channel.media.azure-test.net:80/ingest.isml/Streams(15864-stream0)15864-stream0",
      "trackType": "video",
      "trackName": "video",
      "bitrate": 2962000,
      "encoderIp": "131.107.147.xxx",
      "encoderPort": "27485",
      "timestamp": "15336831655032322",
      "duration": "20000000",
      "timescale": "10000000"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
trackTypetrackType stringstring 轨道类型(音频/视频)。Type of the track (Audio / Video).
trackNametrackName stringstring 轨迹的名称(由编码器提供;对于 RTMP,由服务器以 TrackType_Bitrate 格式生成)。Name of the track (either provided by the encoder or, in case of RTMP, server generates in TrackType_Bitrate format).
比特率bitrate integerinteger 轨道的比特率。Bitrate of the track.
ingestUrlingestUrl stringstring 直播活动提供的引入 URL。Ingest URL provided by the live event.
encoderIpencoderIp stringstring 编码器的 IP。IP of the encoder.
encoderPortencoderPort stringstring 此流的来源编码器的端口。Port of the encoder from where this stream is coming.
timestamptimestamp stringstring 收到数据区块的第一个时间戳。First timestamp of the data chunk received.
timescaletimescale stringstring 用于表示时间戳的时间刻度。Timescale in which timestamp is represented.

LiveEventIncomingStreamsOutOfSyncLiveEventIncomingStreamsOutOfSync

以下示例显示 LiveEventIncomingStreamsOutOfSync 事件的架构:The following example shows the schema of the LiveEventIncomingStreamsOutOfSync event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "liveEvent/mle1",
    "eventType": "Microsoft.Media.LiveEventIncomingStreamsOutOfSync",
    "eventTime": "2018-08-10T02:26:20.6269183Z",
    "id": "b9d38923-9210-4c2b-958f-0054467d4dd7",
    "data": {
      "minLastTimestamp": "319996",
      "typeOfStreamWithMinLastTimestamp": "Audio",
      "maxLastTimestamp": "366000",
      "typeOfStreamWithMaxLastTimestamp": "Video",
      "timescaleOfMinLastTimestamp": "10000000", 
      "timescaleOfMaxLastTimestamp": "10000000"       
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
minLastTimestampminLastTimestamp stringstring 所有轨迹(音频或视频)中最后一个时间戳的最小值。Minimum of last timestamps among all the tracks (audio or video).
typeOfTrackWithMinLastTimestamptypeOfTrackWithMinLastTimestamp stringstring 最后一个时间戳最小的轨迹的类型(音频或视频)。Type of the track (audio or video) with minimum last timestamp.
maxLastTimestampmaxLastTimestamp stringstring 所有轨迹(音频或视频)中所有时间戳的最大值。Maximum of all the timestamps among all the tracks (audio or video).
typeOfTrackWithMaxLastTimestamptypeOfTrackWithMaxLastTimestamp stringstring 最后一个时间戳最大的轨迹的类型(音频或视频)。Type of the track (audio or video) with maximum last timestamp.
timescaleOfMinLastTimestamptimescaleOfMinLastTimestamp stringstring 获取用于表示“MinLastTimestamp”的时间刻度。Gets the timescale in which "MinLastTimestamp" is represented.
timescaleOfMaxLastTimestamptimescaleOfMaxLastTimestamp stringstring 获取用于表示“MaxLastTimestamp”的时间刻度。Gets the timescale in which "MaxLastTimestamp" is represented.

LiveEventIncomingVideoStreamsOutOfSyncLiveEventIncomingVideoStreamsOutOfSync

以下示例显示 LiveEventIncomingVideoStreamsOutOfSync 事件的架构:The following example shows the schema of the LiveEventIncomingVideoStreamsOutOfSync event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaServices/<account-name>",
    "subject": "/LiveEvents/LiveEvent1",
    "eventType": "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync",
    "eventTime": "2018-01-16T01:57:26.005121Z",
    "id": "6dd4d862-d442-40a0-b9f3-fc14bcf6d750",
    "data": {
      "firstTimestamp": "2162058216",
      "firstDuration": "2000",
      "secondTimestamp": "2162057216",
      "secondDuration": "2000",
      "timescale": "10000000"      
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
firstTimestampfirstTimestamp stringstring 收到视频类型的某个轨迹/质量级别的时间戳。Timestamp received for one of the tracks/quality levels of type video.
firstDurationfirstDuration stringstring 具有第一个时间戳的数据区块的持续时间。Duration of the data chunk with first timestamp.
secondTimestampsecondTimestamp stringstring 收到视频类型的其他某个轨迹/质量级别的时间戳。Timestamp received for some other track/quality level of the type video.
secondDurationsecondDuration stringstring 具有第二个时间戳的数据区块的持续时间。Duration of the data chunk with second timestamp.
timescaletimescale stringstring 时间戳和持续时间的时间刻度。Timescale of timestamps and duration.

LiveEventIngestHeartbeatLiveEventIngestHeartbeat

以下示例显示 LiveEventIngestHeartbeat 事件的架构:The following example shows the schema of the LiveEventIngestHeartbeat event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "liveEvent/mle1",
    "eventType": "Microsoft.Media.LiveEventIngestHeartbeat",
    "eventTime": "2018-08-07T23:17:57.4610506",
    "id": "7f450938-491f-41e1-b06f-c6cd3965d786",
    "data": {
      "trackType": "audio",
      "trackName": "audio",
      "bitrate": 160000,
      "incomingBitrate": 155903,
      "lastTimestamp": "15336837535253637",
      "timescale": "10000000",
      "overlapCount": 0,
      "discontinuityCount": 0,
      "nonincreasingCount": 0,
      "unexpectedBitrate": false,
      "state": "Running",
      "healthy": true
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
trackTypetrackType stringstring 轨道类型(音频/视频)。Type of the track (Audio / Video).
trackNametrackName stringstring 轨迹的名称(由编码器提供;对于 RTMP,由服务器以 TrackType_Bitrate 格式生成)。Name of the track (either provided by the encoder or, in case of RTMP, server generates in TrackType_Bitrate format).
比特率bitrate integerinteger 轨道的比特率。Bitrate of the track.
incomingBitrateincomingBitrate integerinteger 基于来自编码器的数据区块计算出的比特率。Calculated bitrate based on data chunks coming from encoder.
lastTimestamplastTimestamp stringstring 在过去 20 秒收到的轨迹的最新时间戳。Latest timestamp received for a track in last 20 seconds.
timescaletimescale stringstring 用于表示时间戳的时间刻度。Timescale in which timestamps are expressed.
overlapCountoverlapCount integerinteger 在过去 20 秒数据区块数目包含重叠的时间戳。Number of data chunks had overlapped timestamps in last 20 seconds.
discontinuityCountdiscontinuityCount integerinteger 在过去 20 秒观察到的不连续性数目。Number of discontinuities observed in last 20 seconds.
nonIncreasingCountnonIncreasingCount integerinteger 在过去 20 秒收到的具有以往时间戳的数据区块数。Number of data chunks with timestamps in the past were received in last 20 seconds.
unexpectedBitrateunexpectedBitrate boolbool 在过去 20 秒,预期和实际比特率之差是否超过了允许的限制。If expected and actual bitrates differ by more than allowed limit in last 20 seconds. 当且仅当 incomingBitrate >= 2* 比特率,或者 incomingBitrate <= 比特率/2,或者 IncomingBitrate = 0 时,此属性的值才为 true。It's true if and only if, incomingBitrate >= 2* bitrate OR incomingBitrate <= bitrate/2 OR IncomingBitrate = 0.
statestate stringstring 直播活动的状态。State of the live event.
healthyhealthy boolbool 指示引入是否正常(基于计数和标志判断)。Indicates whether ingest is healthy based on the counts and flags. 如果 overlapCount = 0 并且 discontinuityCount = 0 并且 nonIncreasingCount = 0 并且 unexpectedBitrate = false,则 Healthy 为 true。Healthy is true if overlapCount = 0 && discontinuityCount = 0 && nonIncreasingCount = 0 && unexpectedBitrate = false.

LiveEventTrackDiscontinuityDetectedLiveEventTrackDiscontinuityDetected

以下示例显示 LiveEventTrackDiscontinuityDetected 事件的架构:The following example shows the schema of the LiveEventTrackDiscontinuityDetected event:

[
  {
    "topic": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.Media/mediaservices/<account-name>",
    "subject": "liveEvent/mle1",
    "eventType": "Microsoft.Media.LiveEventTrackDiscontinuityDetected",
    "eventTime": "2018-08-07T23:18:06.1270405Z",
    "id": "5f4c510d-5be7-4bef-baf0-64b828be9c9b",
    "data": {
      "trackName": "video",
      "previousTimestamp": "15336837615032322",
      "trackType": "video",
      "bitrate": 2962000,
      "newTimestamp": "15336837619774273",
      "discontinuityGap": "575284",
      "timescale": "10000000"
    },
    "dataVersion": "1.0",
    "metadataVersion": "1"
  }
]

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
trackTypetrackType stringstring 轨道类型(音频/视频)。Type of the track (Audio / Video).
trackNametrackName stringstring 轨迹的名称(由编码器提供;对于 RTMP,由服务器以 TrackType_Bitrate 格式生成)。Name of the track (either provided by the encoder or, in case of RTMP, server generates in TrackType_Bitrate format).
比特率bitrate integerinteger 轨道的比特率。Bitrate of the track.
previousTimestamppreviousTimestamp stringstring 前一个片段的时间戳。Timestamp of the previous fragment.
newTimestampnewTimestamp stringstring 当前片段的时间戳。Timestamp of the current fragment.
discontinuityGapdiscontinuityGap stringstring 上面两个时间戳之间的差距。Gap between above two timestamps.
timescaletimescale stringstring 用于表示时间戳和非连续性差距的时间刻度。Timescale in which both timestamp and discontinuity gap are represented.

自定义事件属性Common event properties

事件具有以下顶级数据:An event has the following top-level data:

属性Property 类型Type 说明Description
主题topic stringstring EventGrid 主题。The EventGrid topic. 此属性包含媒体服务帐户的资源 ID。This property has the resource ID for the Media Services account.
subjectsubject stringstring 媒体服务帐户下媒体服务通道的资源路径。The resource path for the Media Services channel under the Media Services account. 连接主题和使用者可以获得作业的资源 ID。Concatenating the topic and subject give you the resource ID for the job.
eventTypeeventType stringstring 此事件源的一个注册事件类型。One of the registered event types for this event source. 例如,“Microsoft.Media.JobStateChange”。For example, "Microsoft.Media.JobStateChange".
EventTimeeventTime stringstring 基于提供程序 UTC 时间的事件生成时间。The time the event is generated based on the provider's UTC time.
idid stringstring 事件的唯一标识符。Unique identifier for the event.
数据data objectobject 媒体服务事件数据。Media Services event data.
dataVersiondataVersion stringstring 数据对象的架构版本。The schema version of the data object. 发布者定义架构版本。The publisher defines the schema version.
metadataVersionmetadataVersion stringstring 事件元数据的架构版本。The schema version of the event metadata. 事件网格定义顶级属性的架构。Event Grid defines the schema of the top-level properties. 事件网格提供此值。Event Grid provides this value.

另请参阅See also