tencent cloud

Feedback

Workflow

Last updated: 2021-12-22 16:06:47

    A workflow refers to a set of job tasks performed on a source audio/video file. Job tasks can be parallel or serial and are simply referred to as tasks in MPS. A workflow is as shown below.

    Symbol Meaning
    Circle Start and end of a task
    Diamond Task breakdown
    Rectangle Task unit
    Dot Assembly or combination of task units
    Arrow Order of executing different tasks or different steps of a task

    An MPS workflow may consist of tasks such as transcoding, sampled screenshot, time point screenshot, animated image generating, image sprite generating, and watermarking. Below is a typical example of an MPS workflow:

    If a task involves multiple outputs, such as transcoding to SD and HD or taking screenshots of different sizes, it will be broken down into multiple subtasks that will be executed simultaneously. After all subtasks are completed, MPS will combine the results, and the task ends.

    How a Workflow Works

    The process of executing a workflow involves workflow configuration, task triggering, task execution, and event notification sending, as shown below:

    1. Workflow configuration: You can configure a workflow in the console as an admin. Before configuration, you must create a CMQ queue and a COS bucket and grant your MPS service role access to the two services.
    2. Task triggering: After an audio/video file is uploaded via the console or through an SDK to the COS bucket created, the task bound to the bucket will be triggered. You can also use the ProcessMedia API to initiate a task on a specific file.
    3. Task execution: Read/Write operations such as downloading source files from COS and uploading output files to COS will be performed during task execution.
    4. Event notification sending: After the workflow is completed, MPS will send a notification to the CMQ queue created. You can receive the notification through a CMQ API.
      Note:

      • For more information on workflows, see Workflow. For how to set up a workflow, see Setting Workflow.
      • After a file is transcoded successfully, you can proceed with your subsequent business logic, such as distributing the transcoded video through CDNs.

    Configuring workflow

    You need to configure a workflow if you want a task to be triggered automatically upon file upload. After configuration, the task will be initiated automatically on files uploaded to the specified COS bucket and the output files will be uploaded to the same or a different COS bucket.

    You can also call an API to initiate a task on a specific file, in which case workflow configuration is not required.

    Triggering task

    A transcoding task can be automatically or manually triggered.

    • Automatic triggering: If a workflow is configured, the transcoding task will be automatically triggered upon file upload.
    • Manual triggering: You can call an API to initiate a transcoding task and receive task completion notifications through CMQ or query the task status by TaskId. For details, see Manually Initiating Transcoding.
    Note:

    • Step 5 is the query of the task status via an API. The request parameter is the TaskId returned after task initiation.
    • Steps in the red box are optional. When you manually trigger a transcoding task, you can use CMQ to receive notifications or query the task status through an API as shown in step 5.

    Executing task

    Task execution may involve transcoding, screenshot taking, watermarking, and output file upload. A task is broken down into several subtasks, which are executed in parallel or in series to speed up the process.

    After the task is completed, MPS will upload the output files to the specified COS bucket. If upload fails, the task status will be "failed".

    Sending event notification

    You will be notified when a task is completed, whether it succeeds or fails. You can determine what to do next depending on the notification.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support