You need to enable JavaScript to run this app.
导航

工作流执行完成事件

最近更新时间2024.05.09 16:43:10

首次发布时间2021.02.23 10:42:39

本文为您介绍工作流执行完成事件的类型、说明、内容和回调示例。

事件类型

WorkflowComplete

事件说明

如果您的空间配置了工作流执行完成回调通知,工作流执行完成后,您将收到事件回调通知。配置方法详见事件通知概览。关联接口:触发工作流

事件内容

参数类型说明
RequestIdString请求的唯一 ID。用于请求跟踪、问题排查。
VersionString回调版本
EventTypeString事件名称
EventTimeString事件产生时间。为 UTC 时间,例如 2006-01-02T15:04:05Z。
DataObject回调内容自定义数据。为 JSON 格式。

Data

参数类型说明
CodeString状态码
MessageString信息
VidString视频 ID
RunIdString工作流任务 ID
SpaceNameString点播空间名
TemplateIdString工作流模板 ID
CallbackArgsString回调透传参数
SourceInfoSourceInfo片源信息
PosterUriString封面图存储位置
TranscodeInfosArray of TranscodeInfo转码流信息

AdaptBitrateTranscodeInfos

Array of AdaptBitrateTranscodeInfos

自适应码流信息

说明

如需使用自适应码流 ABR 功能,请提交工单联系技术支持开通。

SnapshotsArray of Snapshot截图结果

SourceInfo

片源信息

参数类型描述
FileIdString文件 ID
Md5String文件 MD5 值
FileTypeString文件类型。类型为视频、纯音频。
CodecString编码类型
HeightInteger视频高度,单位为 px
WidthInteger视频宽度,单位为 px
FormatString文件格式
DurationFloat视频时长,单位为秒
SizeInteger文件大小,单位为字节
FileNameString文件路径
StoreUriString文件存储位置
DefinitionString视频分辨率
BitrateInteger视频码率,单位为 bps
FpsFloat视频帧率,单位为 fps
CreateTimeString创建时间
InspectionInspection片源检测结果。仅无则为空。
SourceAdjustResultSourceAdjustResult片源调整结果,仅检测时为空。
RepairResultRepairResult片源修复结果,无则为空。

Inspection

片源检测结果

参数类型描述
BlackFramesArray of BlackFrameInfo黑帧检测结果
interlaceBoolean水波纹检测结果
QualityQuality视频质量检测结果
DeLogoArray of DeLogoInfo去水印检测结果
SuffixSuffix后贴片检测结果

BlackFrameInfo

黑帧检测结果

参数类型描述
StartFloat黑帧开始时间,单位为秒
EndFloat黑帧结束时间,单位为秒
DurationFloat黑帧持续时间,单位为秒

Quality

视频质量检测结果

参数类型描述
VisualVisualQuality图像质量参数
VolumeInfoVolumeInfo音量信息

VisualQuality

图像质量参数

参数类型描述
VQScoreFloat画质检测-VQScore 视频质量评分
ContrastFloat对比度
ColorfulnessFloat色彩
BrightnessFloat亮度
TextureFloat纹理
NoiseFloat噪声

VolumeInfo

音量信息

参数类型描述
LoudnessFloat响度, 单位为 LUFS
PeakFloat峰值, 取值范围为(0, 1.0],峰值归一化
MeanVolumeFloat均值, 单位为 dB
MaxVolumeFloat最大值, 单位为 dB

DeLogoInfo

去水印检测结果

参数类型描述
AnchorWidthIntegerAnchor 宽度
AnchorHeightIntegerAnchor 高度
PosXInteger水印左上角 X 坐标
PosYInteger水印左上角 Y 坐标
SizeXInteger水印宽度
SizeYInteger水印高度

Suffix

后贴片检测结果

参数类型描述
StartTimeFloat后贴片开始时间,单位为秒
EndTimeFloat后贴片结束时间,单位为秒

SourceAdjustResult

片源调整结果

参数类型描述

AdjustType

String

片源调整类型:

  • origin_video:替换片源
  • new_vid:生成新 vid
VidString片源新的视频 ID。仅 AdjustTypenew_vid 时会返回该字段。

RepairResult

片源修复结果

参数类型描述

BlackFrames

Integer

黑帧去除结果:

  • 0:未执行
  • 1:已执行

Interlace

Integer

水波纹去除结果:

  • 0:未执行
  • 1:已执行

DeLogo

Integer

去水印去除结果:

  • 0:未执行
  • 1:粗粒度
  • 2 :精细化

Suffix

Integer

后贴片去除结果:

  • 0:未执行
  • 1:已执行

TranscodeInfo

转码流信息

参数类型描述
FileIdString文件 ID
Md5String文件哈希
FileTypeString文件类型
LogoTypeStringLogo 类型
EncryptBoolean是否加密
FormatString文件格式
DurationFloat转码流时长,单位为秒
SizeInteger文件大小,单位为字节
FileNameString文件路径
StoreUriString文件存储地址
VideoStreamMetaVideoStreamMeta视频流元信息
AudioStreamMetaAudioStreamMeta音频流元信息
QualityEncodedQuality转码流质量参数,无则为空
RepairResultRepairResult转码流修复结果,无则为空
CreateTimeString创建时间
HeightInteger视频高度,单位为 px
WidthInteger视频宽度,单位为 px
FpsFloat视频帧率,单位为 fps
BitrateInteger视频码率,单位为 bps

VideoStreamMeta

视频流元信息

参数类型描述
DurationFloat视频流时长,单位为秒
DefinitionFloat清晰度
CodecString编码类型
BitrateInteger视频码率,单位为 bps

AudioStreamMeta

音频流元信息

参数类型描述
CodecString编码类型,仅在纯音频时返回
DurationFloat音频流时长,单位为秒
SampleRateFloat音频采样率,仅在纯音频时返回
BitrateInteger音频码率,仅在纯音频时返回

EncodedQuality

转码流质量参数

参数类型描述
VisualVisualQuality转码流图像质量参数。
VolumeInfoVolumeInfo音量信息。
PSNRPSNR峰值信噪比结果(PSNR,Peak Signal-to-Noise Ratio)
SSIMSSIM结构相似性结果(SSIM,Structural SIMilarity)。仅转码后视频可计算,有则返回
VMAFFloat视频多方法评估融合结果(Video Multi-method Assessment Fusion,VMAF)

PSNR

峰值信噪比结果

参数类型描述
PSNR_YFloaty 分量 psnr
PSNR_UFloatu 分量 psnr
PSNR_VFloatv 分量 psnr
PSNR_GFloatGlobal psnr 默认推荐用 psnr_g

SSIM

结构相似性结果

参数类型描述
SSIM_YFloaty 分量 ssim
SSIM_UFloatu 分量 ssim
SSIM_VFloatv 分量 ssim
SSIM_GFloatGlobal ssim 默认推荐用 ssim_g

AdaptBitrateTranscodeInfos

自适应码流信息

参数类型描述
FileIdString文件 ID
EncryptBoolean是否加密
LogoTypeStringLogo 类型
FormatString格式
SizeInteger文件,单位为字节
StoreUriString对象存储地址
SubAdaptBitrateStreamMetasArray of SubAdaptBitrateStreamMeta子流元信息
CreateTimeString创建时间

SubAdaptBitrateStreamMeta

子流元信息s

参数类型描述

FileType

String

文件类型。取值如下:

  • Video:视频
  • Audio:音频

Codec

String

编码类型。

说明

当参数 FileType 取值为 Video 时,仅返回视频 Codec。

Height

Integer

视频高度,单位为 px

说明

当参数 FileType 取值为 Video 时,返回该参数。

Width

Integer

视频宽度,单位为 px

说明

当参数 FileType 取值为 Video 时,返回该参数。

DurationFloat视频时长,单位为秒

Definition

String

视频清晰度

说明

当参数 FileType 取值为 Video 时,返回该参数。

BitrateInteger视频码率,单位为 bps

Fps

Float

视频帧率,单位为 fps

说明

当参数 FileType 取值为 Video 时,返回该参数。

SizeInteger文件大小,单位为字节

Snapshot

截图结果

参数类型说明

Type

String

截图类型。取值如下:

  • Poster:静态图
  • Dynpost:动态图
  • AnimatedPoster:反复循环动图
  • Sprite:雪碧图
  • Sample:采样截图
  • AIDynpost:智能封面(AI 动图)

Params

Object

不同类型的截图返回不同的结果,详见以下:

Poster

静态图

参数类型说明
FormatString图片格式,如 jpeg
StoreUriString图片存储位置
WidthInteger图片宽度,单位为 px
HeightInteger图片高度,单位为 px

Dynpost

动图

参数类型说明
FormatString图片格式,如 jpeg
StoreUriString图片存储位置
WidthInteger图片宽度,单位为 px
HeightInteger图片高度,单位为 px

AnimatedPoster

反复循环动图

参数类型说明
FormatString图片格式,如 jpeg
StoreUriString图片存储位置
WidthInteger图片宽度,单位为 px
HeightInteger图片高度,单位为 px

Sprite

雪碧图

参数类型说明
FormatString图片格式,如 jpeg
StoreUrisArray of String多张雪碧图的存储位置
CellWidthInteger图片宽度,单位为 px
CellHeightInteger图片高度,单位为 px
ImgXLenInteger水平方向缩略小图个数
ImgYLenInteger垂直方向缩略小图个数
IntervalInteger截图间隔,单位为秒
CaptureNumInteger截取的缩略小图总数量

Sample

采样截图

参数类型说明
FormatString图片格式,如 jpeg

StoreUris

Array of String

多张采样截图的存储地址。在点播控制台的截图模板中配置采样截图的输出方式选择截图 Uri 时,结果在该参数 StoreUris 中获取。具体参数配置请参见配置采样截图参数

说明

StoreUris 参数,会按照 Offsets 参数指定时间点依次返回截图。

IndexUri

String

截图 Index 文件 Uri 地址。在点播控制台的截图模板中配置采样截图的输出方式选择截图地址文件时,结果在该参数 IndexUri 中获取。具体参数配置请参见配置采样截图参数

说明

  • 每行一个截图结果。
  • IndexUri 参数,会按照 Offsets 参数指定时间点依次返回截图。示例:{"StoreUri": "xxx/uri1", "Offset": [2.5]}
WidthInteger图片宽度,单位为 px
HeightInteger图片高度,单位为 px
IntervalFloat截图间隔,单位为秒
CaptureNumint32截图数量
DurationFloat片源时长,单位为秒
OffsetsArray of Float各个截图的时间点。默认会升序排序输出。

AIDynpost

智能封面(AI 动图)

参数类型说明
FormatString图片格式,如 jpeg
StoreUriString图片存储位置
WidthInteger图片宽度,单位为 px
HeightInteger图片高度,单位为 px

错误码

错误码说明
Success成功
InvalidParameter.InvalidMediaStream解析音视频流失败
InvalidParameter.MissingMediaStream缺少音视频流
InvalidParameter.InvalidUriError用户地址非法
InvalidParameter.InvalidVidOrUri输入源不存在
InternalError内部错误
InternalError.DownloadError系统下载错误
InternalError.UploadError系统上传错误
InternalError.ExecutionTimeout系统错误导致执行超时

回调示例

Vid 模式下,工作流执行完成事件的回调示例如下所示。

{
  "Version": "1.0",
  "Data": {
    "Code": "Success",
    "Snapshots": [
      {
        "Params": {
          "OffsetTime": 0,
          "StoreUri": "tos***/cbe797357ecf439291dbec4a26b69dd5",
          "Width": 360,
          "Height": 640,
          "Format": "jpeg"
        },
        "Type": "Poster"
      },
      {
        "Params": {
          "OffsetTime": 0,
          "StoreUri": "tos***/c5d95e55fdbb46709b62c8c5f7e4a6aa",
          "Width": 360,
          "Height": 640,
          "Format": "gif"
        },
        "Type": "Dynpost"
      },
      {
        "Params": {
          "Width": 540,
          "Height": 960,
          "Format": "webp",
          "Uri": "tos***/89523e5554a74***9c6898761055a83"
        },
        "Type": "AIDynpost"
      },
      {
        "Params": {
          "StoreUri": "tos***/250f70a8010945f5b1ca005d315bc889",
          "Width": 360,
          "Height": 640,
          "Format": "webp"
        },
        "Type": "AnimatedPoster"
      },
      {
        "Params": {
          "StoreUris": [
            "tos***/14437a144eb149f7a8a38b8b731f8a96"
          ],
          "CellHeight": 240,
          "ImgXLen": 5,
          "CaptureNum": 1,
          "Interval": 10,
          "ImgYLen": 5,
          "Format": "jpeg",
          "CellWidth": 136
        },
        "Type": "Sprite"
      },
      {
        "Params": {
          "StoreUris": [
            "tos***/fd5856116d7c454daa44b906f37fabee"
          ],
          "CaptureNum": 1,
          "Width": 540,
          "Height": 960,
          "Format": "jpeg",
          "Duration": 14.933333,
          "Interval": 10,
          "Offsets": [1]
        },
        "Type": "Sample"
      }
    ],
    "TemplateId": "995745b286fc4be***3cf6f65877df72",
    "SpaceName": "test",
    "SourceInfo": {
      "Bitrate": 2240042,
      "Definition": "unknown",
      "FileName": "111",
      "RepairResult": {},
      "StoreUri": "tos**/111",
      "Width": 720,
      "FileType": "video",
      "SourceAdjustResult": {},
      "Format": "MP4",
      "Codec": "h264",
      "Inspection": {
        "Quality": {}
      },
      "Md5": "4ee56e0d8a687***173a65dc73b7",
      "FileId": "v0ccfeg7007a***3c77ucpfe19890",
      "Duration": 15.093,
      "Size": 4226121,
      "Height": 1280,
      "Fps": 30,
      "CreateTime": "2023-04-10T11:05:31Z"
    },
    "Vid": "v0ccfeg7007acg***c77ucpfe19890",
    "TranscodeInfos": [
      {
        "Quality": {
          "Visual": {
            "Noise": 0,
            "Contrast": 0,
            "Colorfulness": 0,
            "Texture": 0,
            "Brightness": 0
          }
        },
        "AudioStreamMeta": {
          "Bitrate": 64701,
          "SampleRate": 44100,
          "Duration": 15.046,
          "Codec": "aac"
        },
        "FileName": "owzbee1ls6pzUnZQok2Q0lkgZiDfZIfgecJnQ7",
        "CreateTime": "2023-04-10T11:06:59Z",
        "VideoStreamMeta": {
          "Bitrate": 430977,
          "Definition": "360p",
          "Duration": 14.933,
          "Codec": "h264"
        },
        "StoreUri": "tos***/owzbee1ls6pzUnZQok2Q0lkgZiDfZIfgecJnQ7",
        "Width": 360,
        "FileType": "video",
        "Format": "MP4",
        "Duration": 15.047,
        "Bitrate": 501844,
        "LogoType": "",
        "Encrypt": false,
        "FileId": "e5f487ef36cb47a***1212f8086070",
        "Size": 943907,
        "Height": 640,
        "Fps": 30
      },
      {
        "Quality": {
          "Visual": {
            "Noise": 0,
            "Contrast": 0,
            "Colorfulness": 0,
            "Texture": 0,
            "Brightness": 0
          }
        },
        "AudioStreamMeta": {
          "Bitrate": 64000,
          "Duration": 15.073,
          "Codec": "mp3",
          "SampleRate": 44100
        },
        "FileName": "oIIAzkUPzBf2jH59MwUrIfhCa7z2oMBkyNS6hM",
        "CreateTime": "2023-04-10T11:08:09Z",
        "VideoStreamMeta": {
          "Definition": "",
          "Bitrate": 0,
          "Duration": 0
        },
        "StoreUri": "tos***/oIIAzkUPzBf2jH59MwUrIfhCa7z2oMBkyNS6hM",
        "Width": 0,
        "FileType": "audio",
        "Format": "MP3",
        "Duration": 15.073,
        "Bitrate": 64134,
        "LogoType": "",
        "Encrypt": false,
        "FileId": "24a57db262ec41***3d33577db4e1362",
        "Size": 120834,
        "Height": 0,
        "Fps": 0
      }
    ],
    "SubAdaptBitrateStreamMetas": [
          {
            "Height": 480,
            "Size": 1307500,
            "Fps": 25,
            "Duration": 40.16,
            "Codec": "h264",
            "Definition": "480p",
            "FileType": "Video",
            "Width": 854,
            "Bitrate": 355019
          }

        ],
        "FileId": "cb8873e4cbe5***023b6fb80a8ba",
        "CreateTime": "2023-10-25T08:37:34Z",
        "Format": "DASH",
        "LogoType": "watermark",
        "Encrypt": true
      }
    ],
    "PosterUri": "tos***/0f2cd3c43e8346d096a42ce8f58b466d",
    "CallbackArgs": "",
    "Message": "Success",
    "RunId": "bb:d5d9c4581b238***2a08ccb73457e24"
  },
  "EventType": "WorkflowComplete",
  "RequestId": "20230410190649D***4BE92C2507504B",
  "EventTime": "2023-04-10T11:08:38Z"
}

DirectUrl 模式下,工作流执行完成事件的回调示例如下所示。

{
  "Version": "1.0",
  "Data": {
    "Code": "Success",
    "Snapshots": [
      {
        "Params": {
          "OffsetTime": 0,
          "StoreUri": "tos/f3159cf887***be5815eecd0f429",
          "Width": 360,
          "Height": 640,
          "Format": "jpeg"
        },
        "Type": "Poster"
      },
      {
        "Params": {
          "OffsetTime": 0,
          "StoreUri": "tos/b56db927142***a8ca67e33d9a93",
          "Width": 360,
          "Height": 640,
          "Format": "gif"
        },
        "Type": "Dynpost"
      },
      {
        "Params": {
          "OffsetTime": 0,
          "StoreUri": "tos/5e1296c71af***68e7296e82175e77f",
          "Width": 540,
          "Height": 960,
          "Format": "webp"
        },
        "Type": "AIDynpost"
      },
      {
        "Params": {
          "OffsetTime": 0,
          "StoreUri": "tos/439201bda9a***b44d905504c6d578",
          "Width": 360,
          "Height": 640,
          "Format": "webp"
        },
        "Type": "AnimatedPoster"
      },
      {
        "Params": {
          "StoreUris": [
            "tos/140b0807c2fe4***2e8d807f5bf3c22"
          ],
          "ImgXLen": 5,
          "Interval": 10,
          "CaptureNum": 1,
          "CellWidth": 136,
          "ImgYLen": 5,
          "Format": "jpeg",
          "CellHeight": 240
        },
        "Type": "Sprite"
      },
      {
        "Params": {
          "StoreUris": [
            "tos/e981ff2e41054a2b***63da3703d6ba4f"
          ],
          "CaptureNum": 1,
          "Width": 540,
          "Height": 960,
          "Format": "jpeg",
          "Duration": 14.933333,
          "Interval": 10,
          "Offsets": [1]
        },
        "Type": "Sample"
      }
    ],
    "TemplateId": "995745b286f***3993cf6f65877df72",
    "SpaceName": "test",
    "SourceInfo": {
      "Md5": "4ee56e0d8a6***0d5173a65dc73b7",
      "StoreUri": "tos/111***",
      "Width": 720,
      "Height": 1280,
      "Size": 4226121,
      "Bitrate": 2240042,
      "Duration": 15.093,
      "Fps": 30
    },
    "Vid": "",
    "TranscodeInfos": [
      {
        "AudioStreamMeta": {
          "Bitrate": 64701,
          "SampleRate": 44100,
          "Duration": 15.046,
          "Codec": "aac"
        },
        "Quality": {
          "Visual": {
            "Noise": 0,
            "Contrast": 0,
            "Colorfulness": 0,
            "Texture": 0,
            "Brightness": 0
          }
        },
        "VideoStreamMeta": {
          "Bitrate": 430977,
          "Definition": "360p",
          "Duration": 14.933,
          "Codec": "h264"
        },
        "StoreUri": "tos/d10f3838a86a4***8cdc9452305fb",
        "Width": 360,
        "FileType": "Video",
        "Format": "MP4",
        "Duration": 15.047,
        "Bitrate": 501827,
        "FileId": "15a01d88a6e64***b732f4f5006cf0b6",
        "Encrypt": false,
        "LogoType": "",
        "Size": 943875,
        "Height": 640,
        "Fps": 30
      },
      {
        "AudioStreamMeta": {
          "Bitrate": 64000,
          "Duration": 15.073,
          "Codec": "mp3",
          "SampleRate": 44100
        },
        "Quality": {
          "Visual": {
            "Noise": 0,
            "Contrast": 0,
            "Colorfulness": 0,
            "Texture": 0,
            "Brightness": 0
          }
        },
        "VideoStreamMeta": {
          "Definition": "",
          "Bitrate": 0,
          "Duration": 0
        },
        "StoreUri": "tos/62038dc1a***9718de3344a6d49502d",
        "Width": 0,
        "FileType": "Audio",
        "Format": "MP3",
        "Duration": 15.072653,
        "Bitrate": 64134,
        "FileId": "a3c1862cfe244***0fad9b692b91d",
        "Encrypt": false,
        "LogoType": "",
        "Size": 120834,
        "Height": 0,
        "Fps": 0
      }
    ],
    "CallbackArgs": "",
    "Message": "Success",
    "RunId": "bb:f417ffeac602***738e334bffbef2fd"
  },
  "EventType": "WorkflowComplete",
  "RequestId": "2023041019072***841FA060A92080760",
  "EventTime": "2023-04-10T11:08:46Z"
}