Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
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
- Learn how to provision and run automation of media processing jobs using Pre-Built Functions.
Prerequisites
You must know how to complete the following tasks and the required permissions must be assigned.
- Create and execute Media Flow.
- Create Rules in Events Service.
- Create Applications and Functions.
- Create Object Storage buckets and upload objects to it.
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.
-
Create an input bucket and enable the Emit Object Events feature on this bucket.
-
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).
-
In the OCI web console, under Analytics & AI in the main menu, select Media Flow to create a 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
-
In the OCI web console, go to Developer Services, and then click Pre-Built Functions.
-
Locate the Media Workflow Job Spawner from the catalog and click to proceed.
-
Click Create function to create a new Function resource which will be cloned from the catalog.
-
Next, we will need to configure the function with parameters.
-
Provide a Name for the function.
-
Select an Application or create a new one to run the functions.
-
IAM policies are created as part of this execution if the user has privileges for the same.
-
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.
-
Enable Provisioned Concurrency if the function needs lesser cold-start.
-
Update the MEDIA_WORKFLOW_ID from the previous task.
-
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.
-
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.
-
Optionally, update the PBF_LOG_LEVEL.
-
-
Click Create to create the function with the above defined parameters.
Task 4: Create Rules
-
In the OCI web console, go to Observability & Management and then click Rules.
-
Specify the Display Name and Description.
-
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.
-
-
In the Actions section, select the function we created in Task 3 and then click Create.
Task 5: Run Media Workflow Jobs automation
-
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.
-
Related Links
Acknowledgments
- Author - Sathya Velir (Principal Product Manager)
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.
Automate media processing using OCI Media Flow with Pre‐Built Functions
F79584-01
March 2023
Copyright © 2023, Oracle and/or its affiliates.