Note:

Automate media processing using OCI Media Flow with Pre-Built Functions

Introduction

Oracle Cloud Infrastructure (OCI) Media Flow offers transcoding videos to multiple formats and sizes and OCI AI integrations. OCI Media Flow takes the media from the OCI Object Storage and processes it using the OCI Media Workflow job.

You can automate the Media Workflow Job submission when a video is uploaded to an Object Storage bucket.

Objectives

Prerequisites

You must know how to complete the following tasks and the required permissions must be assigned.

Task 1: Provision Object Storage buckets

Create an input bucket to upload video that needs to be processed and an output bucket to store the processed videos into Object Storage.

  1. Create an input bucket and enable the Emit Object Events feature on this bucket.

    Create bucket and enable emit events

  2. Create an output bucket.

Task 2: Create a Media Workflow with video processing tasks

A Media Workflow needs to be defined with tasks that will be executed as part of processing the video. The tasks by default include transcoding and thumbnail generation. Additionally, you can configure AI Speech to text, AI language for analysis of text or AI Vision (object or text detection).

  1. In the OCI web console, under Analytics & AI in the main menu, select Media Flow to create a Media Workflow.

    Create Media Workflow

    Note: While saving the workflow, it will prompt you for running a job with the new Media Workflow. You can cancel it or attempt a test job if you are doing this for the first time.

Task 3: Create a Function from Pre-Built Functions

  1. In the OCI web console, go to Developer Services, and then click Pre-Built Functions.

    Navigate to Pre-built Functions

  2. Locate the Media Workflow Job Spawner from the catalog and click to proceed.

    Locate Media Automation Function

  3. Click Create function to create a new Function resource which will be cloned from the catalog.

    Create Function

  4. Next, we will need to configure the function with parameters.

    Update Function Parameters

    1. Provide a Name for the function.

    2. Select an Application or create a new one to run the functions.

    3. IAM policies are created as part of this execution if the user has privileges for the same.

    4. You can leave the Do not create a dynamic group and an IAM policy checkbox unchecked if you want IAM policies to be created as part of Functions creation.

    5. Enable Provisioned Concurrency if the function needs lesser cold-start.

    6. Update the MEDIA_WORKFLOW_ID from the previous task.

    7. Update the DESTINATION_BUCKET name which was created in the first task.

      Note: Refrain from using the input bucket as destination bucket for this setup.

    8. Optionally, update the COMPARTMENT_ID where the Media Workflow Job needs to be executed from. By default, it will use the same Compartment as the input bucket.

    9. Optionally, update the PBF_LOG_LEVEL.

  5. Click Create to create the function with the above defined parameters.

Task 4: Create Rules

  1. In the OCI web console, go to Observability & Management and then click Rules.

    Navigate to Rules

  2. Specify the Display Name and Description.

  3. In the Rule Conditions section:

    • Specify the Event Type as Object - Create.

    • For the Attribute condition: Attribute Name: bucketName, specify the input bucket name that was created in the first task as the Attribute Value.

    Create Rule

  4. In the Actions section, select the function we created in Task 3 and then click Create.

Task 5: Run Media Workflow Jobs automation

  1. Upload a video file to the input bucket which we created in the first task.

    • The events will be emitted from the input bucket and rules mapped to this event will invoke the function.

    • The function will know the object details and submit a media workflow job to process it.

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.