tencent cloud

文档反馈

接收事件通知

最后更新时间:2022-09-28 16:00:20

    事件通知会将文件转码结果通知给您,您可以依据该结果进行适当处理。

    事件通知定义

    媒体处理中的事件是指文件在转码服务中任务状态的变化。而“事件通知”是指您最终接收到的,包含文件转码结果等事件的消息通知。

    事件通知类型

    当前提供的事件通知如下:

    事件类型 事件名称 含义
    WorkflowTask WorkflowTaskEvent 状态改变,具体状态参考事件内部Status字段。
    一般为 FINISH,表示任务完成(成功或失败)。

    事件通知方式

    媒体处理使用消息队列 CMQ 发送事件通知。您在使用媒体处理时,需要同时开通 CMQ 服务,并对媒体处理服务进行授权,以便接收转码任务事件通知。如果您选择不开通 CMQ,或者在工作流模板中不设置任何事件通知的 CMQ 队列地址,则不会收到来自媒体处理的任务事件通知。

    注意:

    • 您在使用腾讯云 API 拉取 CMQ 事件消息时,需要对每个消息进行确认,然后该消息才会从 CMQ 中移除,否则会持续拉取到同一个事件消息。
    • CMQ 拉取消息请参见 消费消息。CMQ 确认消息请参见 删除消息

    事件通知示例

    {
      "EventType":"WorkflowTask",
      "WorkflowTaskEvent":{
          "TaskId":"245****654-WorkflowTask-f46dac7fe2436c47******d71946986t0",
          "Status":"FINISH",
          "ErrCode":0,
          "Message":"",
          "InputInfo":{
              "Type":"COS",
              "CosInputInfo":{
                  "Bucket":"macgzptest-125****654",
                  "Region":"ap-guangzhou",
                  "Object":"/dianping2.mp4"
              }
          },
          "MetaData":{
              "AudioDuration":11.261677742004395,
              "AudioStreamSet":[
                  {
                      "Bitrate":127771,
                      "Codec":"aac",
                      "SamplingRate":44100
                  }
              ],
              "Bitrate":2681468,
              "Container":"mov,mp4,m4a,3gp,3g2,mj2",
              "Duration":11.261677742004395,
              "Height":720,
              "Rotate":90,
              "Size":3539987,
              "VideoDuration":10.510889053344727,
              "VideoStreamSet":[
                  {
                      "Bitrate":2553697,
                      "Codec":"h264",
                      "Fps":29,
                      "Height":720,
                      "Width":1280
                  }
              ],
              "Width":1280
          },
          "MediaProcessResultSet":[
              {
                  "Type":"Transcode",
                  "TranscodeTask":{
                      "Status":"SUCCESS",
                      "ErrCode":0,
                      "Message":"SUCCESS",
                      "Input":{
                          "Definition":10,
                          "WatermarkSet":[
                              {
                                  "Definition":515247,
                                  "TextContent":"",
                                  "SvgContent":""
                              }
                          ],
                          "OutputStorage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "OutputObjectPath":"/dasda/dianping2_transcode_10",
                          "SegmentObjectName":"/dasda/dianping2_transcode_10_{number}",
                          "ObjectNumberFormat":{
                              "InitialValue":0,
                              "Increment":1,
                              "MinLength":1,
                              "PlaceHolder":"0"
                          }
                      },
                      "Output":{
                          "OutputStorage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "Path":"/dasda/dianping2_transcode_10.mp4",
                          "Definition":10,
                          "Bitrate":293022,
                          "Height":320,
                          "Width":180,
                          "Size":401637,
                          "Duration":11.26200008392334,
                          "Container":"mov,mp4,m4a,3gp,3g2,mj2",
                          "Md5":"31dcf904c03d0cd78346a12c25c0acc9",
                          "VideoStreamSet":[
                              {
                                  "Bitrate":244608,
                                  "Codec":"h264",
                                  "Fps":24,
                                  "Height":320,
                                  "Width":180
                              }
                          ],
                          "AudioStreamSet":[
                              {
                                  "Bitrate":48414,
                                  "Codec":"aac",
                                  "SamplingRate":44100
                              }
                          ]
                      }
                  },
                  "AnimatedGraphicTask":null,
                  "SnapshotByTimeOffsetTask":null,
                  "SampleSnapshotTask":null,
                  "ImageSpriteTask":null
              },
              {
                  "Type":"AnimatedGraphics",
                  "TranscodeTask":null,
                  "AnimatedGraphicTask":{
                      "Status":"FAIL",
                      "ErrCode":30010,
                      "Message":"TencentVodPlatErr Or Unkown",
                      "Input":{
                          "Definition":20000,
                          "StartTimeOffset":0,
                          "EndTimeOffset":600,
                          "OutputStorage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "OutputObjectPath":"/dasda/dianping2_animatedGraphic_20000"
                      },
                      "Output":null
                  },
                  "SnapshotByTimeOffsetTask":null,
                  "SampleSnapshotTask":null,
                  "ImageSpriteTask":null
              },
              {
                  "Type":"SnapshotByTimeOffset",
                  "TranscodeTask":null,
                  "AnimatedGraphicTask":null,
                  "SnapshotByTimeOffsetTask":{
                      "Status":"SUCCESS",
                      "ErrCode":0,
                      "Message":"SUCCESS",
                      "Input":{
                          "Definition":10,
                          "TimeOffsetSet":[
                           ],
                          "WatermarkSet":[
                              {
                                  "Definition":515247,
                                  "TextContent":"",
                                  "SvgContent":""
                              }
                          ],
                          "OutputStorage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "OutputObjectPath":"/dasda/dianping2_snapshotByOffset_10_{number}",
                          "ObjectNumberFormat":{
                              "InitialValue":0,
                              "Increment":1,
                              "MinLength":1,
                              "PlaceHolder":"0"
                          }
                      },
                      "Output":{
                          "Storage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "Definition":0,
                          "PicInfoSet":[
                              {
                                  "TimeOffset":0,
                                  "Path":"/dasda/dianping2_snapshotByOffset_10_0.jpg",
                                  "WaterMarkDefinition":[
                                      515247
                                  ]
                              }
                          ]
                      }
                  },
                  "SampleSnapshotTask":null,
                  "ImageSpriteTask":null
              },
              {
                  "Type":"ImageSprites",
                  "TranscodeTask":null,
                  "AnimatedGraphicTask":null,
                  "SnapshotByTimeOffsetTask":null,
                  "SampleSnapshotTask":null,
                  "ImageSpriteTask":{
                      "Status":"SUCCESS",
                      "ErrCode":0,
                      "Message":"SUCCESS",
                      "Input":{
                          "Definition":10,
                          "OutputStorage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "OutputObjectPath":"/dasda/dianping2_imageSprite_10_{number}",
                          "WebVttObjectName":"/dasda/dianping2_imageSprite_10",
                          "ObjectNumberFormat":{
                              "InitialValue":0,
                              "Increment":1,
                              "MinLength":1,
                              "PlaceHolder":"0"
                          }
                      },
                      "Output":{
                          "Storage":{
                              "Type":"COS",
                              "CosOutputStorage":{
                                  "Bucket":"gztest-125****654",
                                  "Region":"ap-guangzhou"
                              }
                          },
                          "Definition":10,
                          "Height":80,
                          "Width":142,
                          "TotalCount":2,
                          "ImagePathSet":[
                              "/dasda/imageSprite/dianping2_imageSprite_10_0.jpg"
                          ],
                          "WebVttPath":"/dasda/imageSprite/dianping2_imageSprite_10.vtt"
                      }
                  }
              }
          ]
      }
    }
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持