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

工作流执行完成事件

最近更新时间2024.04.01 18:01:09

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

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

事件类型

WorkflowComplete

事件说明

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

事件内容

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

Data

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

AdaptBitrateTranscodeInfos

Array of AdaptBitrateTranscodeInfos

自适应码流信息流

说明

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

SnapshotsArray of Snapshot截图结果

SourceInfo

参数类型描述
FileIdString文件 ID
Md5String文件哈希。取值为 FileHash。
FileTypeString文件类型。类型为视频、纯音频。
CodecString编码类型
HeightInteger
WidthInteger
FormatString格式
DurationFloat视频时长
SizeInteger文件大小,单位为字节
FileNameString文件路径
StoreUriString对象存储地址
DefinitionString清晰度
BitrateInteger码率
FpsFloat帧率
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仅生成新 Vid 的方式会返回该字段

RepairResult

参数类型描述
BlackFramesInteger黑帧去除结果。0 未执行,1 已执行。
InterlaceInteger水波纹去除结果。0 未执行,1 已执行。
DeLogoInteger去水印去除结果。0 未执行,1 粗粒度,2 精细化。
SuffixInteger后贴片去除结果。0 未执行,1 已执行。

TranscodeInfo

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

VideoStreamMeta

参数类型描述
DurationFloat视频流时长
DefinitionFloat清晰度
CodecString编码类型
BitrateInteger视频码率

AudioStreamMeta

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

EncodedQuality

参数类型描述
VisualVisualQuality转码流图像质量参数。有则返回
VolumeInfoVolumeInfo音量,有则返回
PSNRPSNRPSNR (Peak Signal-to-Noise Ratio) 峰值信噪比结果。有则返回
SSIMSSIMSSIM (Structural SIMilarity) 结构相似性结果。仅转码后视频可计算,有则返回
VMAFFloatVMAF(Video Multi-method Assessment Fusion),有则返回

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

参数类型描述

FileType

String

文件类型。取值如下:

  • Video:视频
  • Audio:音频

Codec

String

编码类型。

说明

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

Height

Integer

高。

说明

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

Width

Integer

宽。

说明

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

DurationFloat时长,单位为 s。

Definition

String

清晰度。

说明

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

BitrateInteger码率

Fps

Float

帧率。

说明

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

SizeInteger文件大小,单位为字节

Snapshot

参数类型说明

Type

String

截图类型。取值如下:

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

Params

Object

参考下面具体的类型。

Poster

参数类型说明
FormatString文件格式,参照截图模板。如 jpeg
StoreUriString文件存储位置
WidthInteger
HeightInteger

Dynpost

参数类型说明
FormatString文件格式,参照截图模板。如 jpeg
StoreUriString存放地址
WidthInteger
HeightInteger

AnimatedPoster

参数类型说明
FormatString文件格式,参照截图模板。如 jpeg
StoreUriString存放地址
WidthInteger
HeightInteger

Sprite

参数类型说明
FormatString文件格式,参照截图模板。如 jpeg
StoreUrisArray of String多张缩略图存储位置
CellWidthInteger
CellHeightInteger
ImgXLenInteger水平方向小图个数
ImgYLenInteger垂直方向小图个数
IntervalInteger截图间隔,单位为 s
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
HeightInteger
IntervalFloat截图间隔,单位为 s
CaptureNumint32截图数量
DurationFloat原片时长
OffsetsArray of Float记录各个截图的时间点。默认会升序排序输出。

AIDynpost

参数类型说明
FormatString文件格式,参照截图模板。如 jpeg
StoreUriString存储地址
WidthInteger
HeightInteger

错误码

错误码说明
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"
}