A workflow consists of multiple media processing nodes, such as transcoding, analysis, and snapshot capture. After you upload a video file, ApsaraVideo Media Processing (MPS) triggers a workflow to process the file and generate one or more output files. This topic describes how to create and manage workflows. This topic also describes how to configure each type of node in workflows.

Background information

In a workflow, you can add different types of nodes, including the Encode, Analyze, Snapshot, Pack, and Video DNA nodes. You can combine the nodes based on your business requirements. After the workflow is triggered by an uploaded video file, the nodes are run to generate output files. If you need to only transcode video files, you can create transcoding jobs. For more information, see Submit an encoding task.

Note
  • To prevent nodes from being repeatedly run, make sure that the input path and output path that you specify for a workflow are different paths.
  • When new media files are uploaded to the input path of a workflow, MPS triggers the workflow. If you specify the same input path for different workflows, all the workflows are triggered when new media files are uploaded to the input path. For more information, see Matching rule for workflow file triggering.

Prerequisites

Media buckets are added.

Supported nodes

The following table describes the types of nodes that you can add to workflows.

Node type Description
Analyze Intelligently analyzes input media files and recommends appropriate preset templates for the files.
Encode Transcodes input media files to different formats. This ensures that the files can be played on different platforms.
Snapshot Captures snapshots of videos at specific points in time. You can use a snapshot as the video thumbnail or use multiple snapshots to generate a sprite.
Pack Packs video streams that have different bitrates, subtitles, languages, and audio tracks into a Master Playlist file.
Content Moderation Detects pornographic content, terrorism content, and undesirable content in speeches, text, and scenes of a video. This reduces costs for manual review and lowers the risks that may be brought by non-compliant content.
Video DNA Uniquely identifies a video. This allows you to extract and compare fingerprint features of images and audio in videos. This way, you can find duplicate videos, trace the source of video clips, and identify plagiarism.

Create a transcoding workflow

  1. Log on to the MPS console.
  2. In the top navigation bar, select a region from the drop-down list.
  3. In the left-side navigation pane, choose Workflows > Workflow Settings.
  4. Click Create Workflow.
  5. On the Create Workflow page, set the parameters that are described in the following table.
    Parameter Description
    Workflow Name The name of the workflow.
    Configuration Plan Select Custom from the drop-down list.
    Note You can also select other options to meet your business requirements in different scenarios. For example, if you require highly efficient creation, you can select a preset workflow from the Configuration Plan drop-down list. The following preset workflows are available:
    • M3U8: captures a video image as the thumbnail and converts the video format to M3U8.
    • Preset Intelligent Template-based Workflow: captures a video image, transcodes the video to a version of standard definition (SD), and then captures an image of the transcoded video as the thumbnail.
    • Multi-bitrate and Multi-Format Workflow: captures a video image as the thumbnail and transcodes the video to versions of multiple formats and bitrates.
    • Multi-bitrate FLV Workflow, Multi-bitrate M3U8 Workflow, and Multi-bitrate MP4 Workflow: captures a video image as the thumbnail and transcodes the video to versions of multiple bitrates.
    For more information, see Preset template details.
  6. Configure the Input node of the workflow.
    1. Click the Pen icon next to the Input node. The Input dialog box appears.
    2. In the Input dialog box, set the parameters that are described in the following table.
      Parameter Description
      Input Path Click Select next to the Input Path field.

      In the Select Input Path dialog box, select a bucket from the Bucket drop-down list. Then, folders in the bucket are displayed in the Path section. Select a folder as the input path.

      Encoding Pipeline Select an MPS queue for transcoding from the drop-down list.
      Notifications Optional. Specifies whether to send notifications about the workflow. If you turn on the switch, set the Message Type parameter and select a Message Service (MNS) queue or topic from the Queue Name or Topic Name drop-down list.
    3. Click OK. The Input node of the workflow is configured.
  7. Configure the Encode node of the workflow.
    1. Click the Plus icon next to the Input node and select Encode from the drop-down list.
      Note You can click the Plus icon next to the Input, Content Moderation, or Video DNA node to add the Encode node.
    2. Click the Pen icon next to the Encode node. The Encoding dialog box appears.
    3. In the Encoding dialog box, set the parameters that are described in the following table.
      Parameter Description
      Name The name of the transcoding node.
      Encoding Template Click Select next to the Encoding Template field. In the Encoding Template dialog box, select a template from the Template list.
      1. Set the Template Type parameter.
      2. Select an output format from the Output Format drop-down list.
      3. Select a template from the Template list.
      4. Click OK.
      Note For more information about how to create a custom template, see Transcoding templates. For more information about preset templates, see Preset template details.
      Output Path Click Select next to the Output Path field.
      In the Select Output Path dialog box, select a bucket from the Bucket drop-down list. Then, folders in the bucket are displayed in the Path section. Select a folder as the output path.
      Note The output path is a storage path of an Object Storage Service (OSS) bucket. Output media files are stored in this storage path. The output path and the input path cannot reside in the same OSS bucket.
      To prevent an output file from being overwritten when a workflow is executed multiple times, you can specify an output path by combining the following built-in UC variables:
      • {RunId}: the ID of the workflow execution instance.
      • {ObjectPrefix}: the original file path that does not include the bucket information.
      • {FileName}: the original file name that does not include the extension name.
      • {ExtName}: the extension name of the original file.
      Watermark Optional. Specifies whether to add watermarks to media files. If you turn on the switch, perform the following operations:
      1. Select a watermark template from the Watermark Template drop-down list.
        Note If no watermark template is displayed in the drop-down list, create one. For more information, see Watermark templates.
      2. Click Select next to the Watermark Image field. In the Select Path dialog box, select the path of a watermark image.
      Encryption Optional. Specifies whether to encrypt the output file. If you turn on the switch, perform the following operation:

      Set the Encryption parameter to Alibaba Cloud Private Encryption or HLS Standard Encryption. For more information, see Alibaba Cloud proprietary cryptography.

      Clip Optional. Specifies whether to split the video into multiple clips. If you turn on the switch, perform the following operations:
      1. Set the Clip Method parameter to Video Clip or Video Ending Clip.
      2. Set the Start From parameter to the start time when the video is cut.
      3. Set the Length parameter to the length of the clip.
      Add Credits Optional. Specifies whether to add an ending part to the video. If you turn on the switch, perform the following operations:

      Click Select next to the File Path field and select the path of an ending part.

      Rotate Angle Optional. The video rotation angle. Enter a number in the field.
    4. Click OK. The Encode node is configured.
  8. Configure the Publish node of the workflow.
    1. Click the Pen icon next to the Publish node.
    2. In the Publish dialog box, set the parameter that is described in the following table.
      Parameter Description
      Publish Type The way in which the output video is published. Select Auto. Valid values:
      • Manual: The output video is not published after the workflow is run. You need to manually publish the output video.
      • Auto: The output video is automatically published after the workflow is run.
        Note
        • If the output video is published, the access permissions on all resources related to the output video, including playback files and captured video images, are the same as those on the OSS bucket in which the output video resides.
        • If the output video is not published, all these resources can be accessed only by the current user.
    3. Click OK. The Publish node is configured.
  9. Click Save. The workflow is created.
Note The workflow is automatically enabled after it is created. If you upload an audio or video file to the input path of the Input node in the workflow, MPS automatically triggers the workflow for the file. For more information about how to upload files, see Video file upload and workflow execution.

Create an analysis workflow

The procedure for creating an analysis workflow is basically the same as that for creating a transcoding workflow except that you need to configure the Analyze node. This section describes only how to configure the Analyze node.

  1. Click the Plus icon next to the Input node and select Analyze from the drop-down list.
  2. Click the Pen icon next to the Analyze node.
  3. In the Analyze dialog box, set the parameter. Select a definition setting from the Conditional Encoding drop-down list.
  4. Click OK. The Analyze node is configured.

Create a snapshot workflow

The procedure for creating a snapshot workflow is basically the same as that for creating a transcoding workflow except that you need to configure the Snapshot node. This section describes only how to configure the Snapshot node.

  1. Add the Snapshot node. You can click the Plus icon next to the Input, Encode, Content Moderation, Video DNA, or Intelligent Thumbnail node to add the Snapshot node.
  2. Click the Pen icon next to the Snapshot node.
  3. In the Snapshot dialog box, set the parameters.

    You can set the Snapshot Mode parameter to Single, Multiple, or Average.

    • If you set the Snapshot Mode parameter to Single, set the parameters that are described in the following table.
      Parameter Description
      Snapshot Mode Single: captures a snapshot of the video at a specified point in time.
      Name The name of the snapshot.
      Output Path
      1. Click Select next to the Output Path field. The Select Output Path dialog box appears.
      2. In the Select Output Path dialog box, select a bucket from the Bucket drop-down list. Then, folders in the bucket are displayed in the Path section. Select a folder as the output path.
      Start Time Optional. Select the time to capture a snapshot from the drop-down list.
      Width x Height Optional. Enter the weight and height of the snapshot in the fields.
      Note
      • If neither Width nor Height is set, the size of the output image is the same as that of the video.
      • If only one of the Width and Height is set, the unspecified side is scaled based on the aspect ratio of the video. This prevents image deformation.
      Set as Thumbnail Optional. Specifies whether to use the snapshot as the thumbnail of the media file. If you turn on the switch, the snapshot captured at the specified point in time is used as the thumbnail. If multiple snapshots are captured, the first one is used as the thumbnail by default.
      Keyframe Optional. Specifies whether to capture only keyframes as snapshots. If you turn on the switch, only keyframes are captured as snapshots. If the frame at the specified point in time is not a keyframe, MPS captures the snapshot of the nearest keyframe.
    • Multiple
      Parameter Description
      Snapshot Mode Multiple: specifies a time interval to evenly capture multiple snapshots of a video. Each snapshot is an image file. This operation is also called batch snapshot or ordinal snapshot.
      Snapshot Interval (Seconds) The interval at which two consecutive snapshots are captured.
      Snapshots The number of snapshots to be captured.
      Note
      • If the Snapshots parameter is not specified, snapshots are captured based on the specified interval until the end of the video.
      • If the value of Snapshots is greater than 1, snapshots are captured based on the specified interval until the number of snapshots reaches the specified number.
      • If the value of Snapshots is 1, a snapshot is asynchronously captured for each frame.
      Name The name of the snapshot.
      Output Path
      1. Click Select next to the Output Path field. The Select Output Path dialog box appears.
      2. In the Select Output Path dialog box, select a bucket from the Bucket drop-down list. Then, folders in the bucket are displayed in the Path section. Select a folder as the output path.
      Start Time Optional. Select the time to capture a snapshot from the drop-down list.
      Width x Height Optional. Enter the weight and height of the snapshot in the fields.
      Note
      • If neither Width nor Height is set, the size of the output image is the same as that of the video.
      • If only one of the Width and Height is set, the unspecified side is scaled based on the aspect ratio of the video. This prevents image deformation.
      Generate WebVTT Index File Optional. Specifies whether to use a thumbnail in the WebVTT format.
      Set as Thumbnail Optional. Specifies whether to use the snapshot as the thumbnail of the media file. If you turn on the switch, the snapshot captured at the specified point in time is used as the thumbnail. If multiple snapshots are captured, the first one is used as the thumbnail by default.
      Keyframe Optional. Specifies whether to capture only keyframes as snapshots. If you turn on the switch, only keyframes are captured as snapshots. If the frame at the specified point in time is not a keyframe, MPS captures the snapshot of the nearest keyframe.
      Black Screen Detection Optional. Specifies whether to detect the first 5 seconds of the video. If you turn on the switch and images appear in the first 5 seconds, the first non-black frame is captured.
    • Average
      Parameter Description
      Snapshot Mode Average: evenly splits the video and captures snapshots based on the specified number of snapshots.
      Snapshots The number of snapshots to be captured.
      Name The name of the snapshot.
      Output Path
      1. Click Select next to the Output Path field. The Select Output Path dialog box appears.
      2. In the Select Output Path dialog box, select a bucket from the Bucket drop-down list. Then, folders in the bucket are displayed in the Path section. Select a folder as the output path.
      Start Time Optional. Select the time to capture a snapshot from the drop-down list.
      Width x Height Optional. Enter the weight and height of the snapshot in the fields.
      Note
      • If neither Width nor Height is set, the size of the output image is the same as that of the video.
      • If only one of the Width and Height is set, the unspecified side is scaled based on the aspect ratio of the video. This prevents image deformation.
      Generate WebVTT Index File Optional. Specifies whether to use a thumbnail in the WebVTT format.
      Set as Thumbnail Optional. Specifies whether to use the snapshot as the thumbnail of the media file. If you turn on the switch, the snapshot captured at the specified point in time is used as the thumbnail. If multiple snapshots are captured, the first one is used as the thumbnail by default.
      Keyframe Optional. Specifies whether to capture only keyframes as snapshots. If you turn on the switch, only keyframes are captured as snapshots. If the frame at the specified point in time is not a keyframe, MPS captures the snapshot of the nearest keyframe.
      Black Screen Detection Optional. Specifies whether to detect the first 5 seconds of the video. If you turn on the switch and images appear in the first 5 seconds, the first non-black frame content is captured.
  4. Click OK. The Snapshot node is configured.

Create a packaging workflow

The procedure for creating a packing workflow is basically the same as that for creating a transcoding workflow except that you need to configure the Pack node group. This section describes only how to configure the Pack node.

  1. Add the Pack node group. You can click the Plus icon next to the Input node to add the Pack node group.

    The Pack node group consists of three nodes: Pack, Extract Video, and Generate.

  2. Click the Pen icon next to the Pack node.
    1. In the Pack dialog box, set the parameters that are described in the following table.
      Parameter Description
      Name The name of the packing configuration.
      Packing Type The default value is HLS.
      Output Bucket You do not need to set this parameter. The name of the output bucket automatically appears after you set the Output Path parameter.
      Output Path Click Select next to the Output Path field. In the Select Output Path dialog box, select a path.
    2. Click OK. The Pack node is configured.
  3. Click the Pen icon next to the Extract Video node.
    1. In the Extract Video dialog box, set the parameters that are described in the following table.
      Parameter Description
      Encoding Template Click Select next to the Encoding Template field. In the Encoding Template dialog box, select a transcoding template. For more information about preset transcoding templates, see Preset template details. For more information about custom transcoding template, see Transcoding templates.
      Watermark Optional. Specifies whether to add watermarks to media files. If you turn on the switch, perform the following operations:
      1. Select a watermark template from the Watermark Template drop-down list. For more information about how to create a watermark template, see Watermark templates.
      2. Click Select next to the Watermark Image. In the Select Path dialog box, select the path of a watermark image.
    2. Click OK. The Extract Video node is configured.
  4. Click the Pen icon next to the Generate node.
    1. In the Generate dialog box, set the parameters that are described in the following table.
      Parameter Description
      Bandwidth (b/s) The network bandwidth that you need to pack media files.
      Audio Group Set the value to Do Not Use Audio.
      Subtitle Group Set the value to Do Not Use Audio.
    2. Click OK. The Generate node is configured. This way, the Pack node group is configured.

Create a content moderation workflow

Note The Content Moderation node can be configured only in the China (Beijing), China (Shanghai), and Singapore (Singapore) regions.

The procedure for creating a content moderation workflow is basically the same as that for creating a transcoding workflow except that you need to configure the Content Moderation node. This section describes only how to configure the Content Moderation node.

  1. Add the Content Moderation node. You can click the Plus icon next to the Input or Encode node to add the Content Moderation node.
  2. Click the Pen icon next to the Content Moderation node.
  3. In the Content Moderation dialog box, set the parameters that are described in the following table.
    Parameter Description
    Moderation Pipeline Select an MPS queue for content moderation from the drop-down list.
    Note If no MPS queue name is displayed in the Moderation Pipeline drop-down list, enable an MPS queue for content moderation. For more information, see Activate or pause an MPS queue.
    Output Path The path of the output file that is stored in an OSS bucket. Click Select next to the Output Path field. In the Select Output Path dialog box, select a path.
    Workflow Termination Set this parameter based on your business requirements.
  4. Click OK. The Content Moderation node is configured.

Create a media fingerprinting workflow

Note The Video DNA node can be configured only in the China (Beijing), China (Hangzhou), China (Shanghai), and Singapore (Singapore) regions.

The procedure for creating a media fingerprinting workflow is basically the same as that for creating a transcoding workflow except that you need to configure the Video DNA node. This section describes only how to configure the Video DNA node.

  1. Add the Video DNA node. You can click the Plus icon next to the Input or Encode node to add the Video DNA node.
  2. Click the Pen icon next to the Video DNA node.
  3. In the Video DNA dialog box, set the parameters that are described in the following table.
    Parameter Description
    Video DNA Pipeline Select an MPS queue for media fingerprinting from the drop-down list.
    Note If no MPS queue name is displayed in the Video DNA Pipeline drop-down list, enable an MPS queue for media fingerprinting. For more information, see Activate or pause an MPS queue.
    Inbound Rule
    • Save Non-duplicated Content Only: If you select Save Non-duplicated Content Only, MPS adds only fingerprints of non-duplicate videos to the media fingerprint library.
    • Do Not Save Any Media Content: If you select Do Not Save Any Media Content, MPS only compares videos and does not add fingerprints of videos to the library.
    Note
    Are you sure you want to terminate the workflow? Set this parameter based on your business requirements.
  4. Click OK. The Video DNA node is configured.

Edit and delete a workflow

If you want to edit or delete a workflow, find the workflow on the Workflow Settings page. Click Disable in the Actions column to disable the workflow before you edit or delete the workflow.

After you edit the workflow, click Enable in the Actions column to enable the workflow.

Notice
  • After you delete or disable a workflow, the workflow cannot be used. In this case, the workflow is not automatically triggered when you upload a file to the specified path in the bucket associated with the workflow.
  • After you delete or disable a workflow, nodes that have been submitted can still be run. Nodes that have entered MPS queues cannot be canceled and will be charged as usual.