This topic describes the methods supported for media workflows and the supported parameters.

Start

You can configure trigger conditions and global settings for media workflows. The start method obtains media information. If the media information fails to be obtained, the subsequent methods are skipped until the report method is called.
ParameterTypeRequiredDescription
InputFileStringYesThe information about the input file, including the Object Storage Service (OSS) bucket in which the input file is stored, the region where the bucket is deployed, and the prefix of the input file.
PipelineIdStringYesThe ID of the pipeline. This is a global parameter. In a media workflow, the value of QueueName or TopicName specified for the workflow takes effect.
MessageTypeStringNoThe type of the message.
  • Valid values: Queue and Topic.
  • Default value: Queue.
QueueNameStringNoThe name of the queue. This is a global parameter.
TopicNameStringNoThe name of the topic. This is a global parameter.
RoleNameStringNoThe name of the authorized RAM role. This is a global parameter. Default value: AliyunMTSDefaultRole.

Transcode

ParameterTypeRequiredDescription
OutputsStringNoThis parameter is optional for extracting subtitle streams.
  • For more information, see Parameter details.
  • Example: [{"OutputObject":"transcode%2F%7BObjectPrefix%7D%2F%7BFileName%7D.%7BExtName%7D","TemplateId": "S00000001-000070"}].
OutputBucketStringNoThe OSS bucket in which the output file is stored. The Bucket configuration in PackageConfig takes precedence over the OutputBucket configuration during HTTP Live Streaming (HLS) and Dynamic Adaptive Streaming over HTTP (DASH) packaging.
OutputLocationStringNoThe region where the output bucket is deployed. The Location configuration in PackageConfig takes precedence over the OutputLocation configuration during HLS and DASH packaging.
MultiBitrateVideoStreamStringNoThis parameter is required for extracting video streams during HLS packaging.
ExtXMediaStringNoThis parameter is required for extracting audio or subtitle streams during HLS packaging.
  • For more information, see Parameter details.
  • Example: {"Name": "english","Language": "en-US","URI":"c/d/audio-1.m3u8"}.
WebVTTSubtitleURLStringNoThe URL of the subtitles. This parameter is supported only for HLS packaging.
  • Only Web Video Text Tracks (WebVTT) subtitle files are supported. The subtitle URL must comply with the URL standard. The subtitle URL is overwritten when you call AddMedia.
  • Example: http://example-bucket-****.oss-cn-hangzhou.aliyuncs.com/subtitles****-en.vtt.
RepresentationStringNoThis parameter is required for extracting audio, video, or subtitle streams during DASH packaging.
  • For more information, see Parameter details.
  • Example: {\"Id\":\"480p\", \"URI\":\"videoSD/xx.mpd\"}.
InputConfigStringNoThis parameter is supported only for DASH packaging and is required for extracting subtitle streams.
  • For more information, see Parameter details.
  • Example: "{\"Format\":\"vtt\",\"InputFile\":{\"URL\":\"http://example-Bucket-****.oss-cn-hangzhou.aliyuncs.com/subtitle/subtitle****-en.vtt\"}}".

Screenshot

ParameterTypeRequiredDescription
SnapshotConfigStringYes
  • For more information, see Parameter details.
  • Example: {"OutputFile": {"Bucket": "example-001", "Location": "oss-cn-hangzhou", "Object":"snapshot%2F%7BObjectPrefix%7D%2F%7BFileName%7D.%7BExtName%7D%2F1.jpg"},"Time": "5"}.
MediaCoverStringNoSpecifies whether to set the snapshot as the media thumbnail.
  • This parameter is supported only for a single snapshot.
  • Valid values: true and false.
  • Default value: false.

Analysis

ParameterTypeRequiredDescription
KeepOnlyHighestDefinitionStringNoSpecifies whether to retain only the analysis results for videos in the highest definition.
  • Valid values: True and False.
  • Default value: False.

Report

ParameterTypeRequiredDescription
PublishTypeStringNoThe publishing type of the media file.
Valid values: Auto, Manual, and TranscodeCompletedAuto.
  • Auto indicates that the media file is automatically published after the workflow is complete.
  • Manual indicates that the media file is not published.
  • TranscodeCompletedAuto indicates that the media file is automatically published after a transcoding event is complete. You can configure message settings in the start method to notify users when transcoding events are complete. Users can then play the output media file.

Default value: Manual.

Note
  • ApsaraVideo Media Processing processes media files in a workflow and uses Security Token Service (STS) to grant permissions to RAM users. This allows users to configure how media files are published.
  • If this parameter is set to TranscodeCompletedAuto and the transcode method is skipped, no message is sent to the users.

PackageConfig

ParameterTypeRequiredDescription
OutputStringYesThe JSON string that contains information about the output file. Example: {"Bucket":"output","Location":"oss-cn-hangzhou","MasterPlayListName":"a/b/c.m3u8"}.
Note Supported placeholders in MasterPlayListName:
  • {ObjectPrefix}: the directory of the output file. The bucket information is not included.
  • {FileName}: the name of the output file. The file name extension is not included.
  • {ExtName}: the file name extension of the output file.
  • {RunId}: the ID of the workflow execution instance.
  • {MediaId}: the ID of the media file that is processed in the workflow.
All placeholders can be dynamically replaced.
ProtocolStringYesValid values: hls and dash.

SubtitleGroup

ParameterTypeRequiredDescription
GroupIdStringNoThe ID of the group.
  • This parameter is required only for HLS packaging.
  • The ID can be up to 32 bytes in length.
AdaptationSetStringNo
  • This parameter is required only for DASH packaging. For more information, see Parameter details.
  • Example: "{\"Lang\":\"english\", \"Group\":\"SubtitleENGroup\"}".

AudioGroup

ParameterTypeRequiredDescription
GroupIdStringNoThe ID of the group.
  • This parameter is required only for HLS packaging.
  • The ID can be up to 32 bytes in length.
AdaptationSetStringNo
  • This parameter is required only for DASH packaging. For more information, see Parameter details.
  • Example: "{\"Lang\":\"english\", \"Group\":\"AudioGroupEnglish\"}". Files in a language are stored in the AudioGroup folder.

VideoGroup

ParameterTypeRequiredDescription
AdaptationSetStringNo
  • This parameter is required only for DASH packaging. For more information, see Parameter details.
  • Example: "AdaptationSet":"{\"Group\":\"VideoGroup\"}".

GenerateMasterPlayList

ParameterTypeRequiredDescription
MasterPlayListStringNo
  • The list of multi-bitrate video streams. This parameter is required only for HLS packaging. For more information, see Parameter details.
  • Example: {"MultiBitrateVideoStreams": [{"RefActivityName": "video-1","ExtXStreamInf": {"BandWidth": "111110","Audio": "auds","Subtitles": "subs"}}]}.