Skip to main content

Video Processing Workflow

The video_recipes.json workflow has several potential invocations.

Below, find two example invocations of the workflow that do slightly different tasks:

  1. Video Transcoding: Take one video and convert into many different formats.
  2. Watermark a video: Add a watermark to your video, and upload to S3.
Try it in Orkes Playground

Workers required

The workers that power these workflows can be found in the orkesworkers GitHub repository. There are 2 workers used here:

  1. video_recipes_prefork: This worker takes the input parameters provided and creates all of the parameters required for the dynamic forks - how many forks to instantiate and the parameters for each of the forks.
  2. video_recipes: This worker takes the inputs and (in the 2 examples below) either transcodes or adds a watermark to the video.

These workers are configured to run in Orkes Playground by default.

Video Transcoding

Workflow definition

The video_recipes.json workflow (see it live on Orkes Playground) is a general purpose workflow designed for doing various recipes around video processing. One of the provided recipes includes transcode.

  • fileLocation: A http location to a video file
  • recipeInfos: An array of recipe names (‘transcode’, ‘watermark’ etc..) and their corresponding parameters recipeParmaters
  • outputSizes: An array of sizes. Each size object has a width and height property

Here is an example of an input payload to transcode a mp4 file into 4 different formats and encodes

  • Transcode mp4 into h264 mp4 with aac audio and different bit rates, frame rates and audioSamplingFrequency
  • Transcode mp4 into h264 mov with aac audio and different bit rates, frame rates and audioSamplingFrequency
  • Transcode mp4 into libvpx webm with libvorbis audio and different bit rates, frame rates and audioSamplingFrequency
  • Transcode mp4 into another mp4 with same encoder as input but with aac audio and different bit rates, frame rates and audioSamplingFrequency
{
"fileLocations": [
"https://file-examples.com/storage/fe9e2635216297e77988972/2017/04/file_example_MP4_480_1_5MG.mp4"
],
"recipeInfos": [
{
"recipe": "transcode",
"recipeParameters": {
"videoEncoder": "h264",
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "aac",
"audioBitRate": 27780,
"audioSamplingFrequency": 96000,
"outputFileFormat": "mp4"
}
},
{
"recipe": "transcode",
"recipeParameters": {
"videoEncoder": "h264",
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "aac",
"audioBitRate": 27780,
"audioSamplingFrequency": 96000,
"outputFileFormat": "mov"
}
},
{
"recipe": "transcode",
"recipeParameters": {
"videoEncoder": "libvpx",
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "libvorbis",
"outputFileFormat": "webm"
}
},
{
"recipe": "transcode",
"recipeParameters": {
"frameRate": 24,
"audioEncoder": "aac",
"audioBitRate": 27780,
"audioSamplingFrequency": 96000,
"outputFileFormat": "mp4"
}
}
]
}

Visual Workflow Definition

https://play.orkes.io/workflowDef/video_recipes

screenshot of the workflow

Invoking a Workflow

The workflow can be invoked using one of following ways:

UI: There is a Run Workflow option in the Conductor UI to invoke a workflow and see the results:

run workflow screenshot

Workflow Executions

You can view a specific workflow invocation using the workflow invocation ID that is returned as part of the invocation. E.g https://play.orkes.io/execution/978dc7e7-e238-11ec-a6d8-32508b865be6

You can also find an workflows execution from the workflow search console

screenshot of workflow search

In the execution view you have multiple tabs where you can see the following

Invocation path

Input and outputs of the workflow

Input

{
"fileLocations": [
"https://file-examples.com/storage/fe9e2635216297e77988972/2017/04/file_example_MP4_480_1_5MG.mp4"
],
"recipeInfos": [
{
"recipe": "transcode",
"recipeParameters": {
"videoEncoder": "h264",
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "aac",
"audioBitRate": 27780,
"audioSamplingFrequency": 96000,
"outputFileFormat": "mp4"
}
},
{
"recipe": "transcode",
"recipeParameters": {
"videoEncoder": "h264",
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "aac",
"audioBitRate": 27780,
"audioSamplingFrequency": 96000,
"outputFileFormat": "mov"
}
},
{
"recipe": "transcode",
"recipeParameters": {
"videoEncoder": "libvpx",
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "libvorbis",
"outputFileFormat": "webm"
}
},
{
"recipe": "transcode",
"recipeParameters": {
"frameRate": 24,
"audioEncoder": "aac",
"audioBitRate": 27780,
"audioSamplingFrequency": 96000,
"outputFileFormat": "mp4"
}
}
]
}

Output

{
"fileLocations": {
"video_recipes_file_example_MP4_480_1_5MG.mp4_transcode_0": {
"fileLocation": "https://image-processing-orkes.s3.amazonaws.com/991fa7d0-3b13-4940-9265-6cc328d38f91-TRANSCODE.mp4",
"recipe": "TRANSCODE",
"recipeParameters": {
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "aac",
"audioSamplingFrequency": 96000,
"audioBitRate": 27780,
"videoEncoder": "h264",
"outputFileFormat": "mp4"
}
},
"video_recipes_file_example_MP4_480_1_5MG.mp4_transcode_1": {
"fileLocation": "https://image-processing-orkes.s3.amazonaws.com/5abf642a-5fc3-49ac-b83c-f6e6c047c3cb-TRANSCODE.mov",
"recipe": "TRANSCODE",
"recipeParameters": {
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "aac",
"audioSamplingFrequency": 96000,
"audioBitRate": 27780,
"videoEncoder": "h264",
"outputFileFormat": "mov"
}
},
"video_recipes_file_example_MP4_480_1_5MG.mp4_transcode_2": {
"fileLocation": "https://image-processing-orkes.s3.amazonaws.com/84e9a990-d586-48c3-b04b-917e16d3ae72-TRANSCODE.webm",
"recipe": "TRANSCODE",
"recipeParameters": {
"videoBitRate": 971520,
"frameRate": 24,
"audioEncoder": "libvorbis",
"videoEncoder": "libvpx",
"outputFileFormat": "webm"
}
},
"video_recipes_file_example_MP4_480_1_5MG.mp4_transcode_3": {
"fileLocation": "https://image-processing-orkes.s3.amazonaws.com/11865799-b573-4623-8e3c-4786df25a996-TRANSCODE.mp4",
"recipe": "TRANSCODE",
"recipeParameters": {
"frameRate": 24,
"audioEncoder": "aac",
"audioSamplingFrequency": 96000,
"audioBitRate": 27780,
"outputFileFormat": "mp4"
}
}
}
}

In the results you can see the output blob has 4 different transcoded videos as the results of the workflow:

Video Watermarking

This is the same workflow, but by changing the input parameters, we obtain a different result:

Input parameters

The recipe changes to watermark, and there is just one recipeParameters, the watermarkFileLocation.

{
"fileLocations": [
"https://image-processing-sandbox.s3.amazonaws.com/test-files/V3c0kxFjLsk-CCL-Youtube.mp4"
],
"recipeInfos": [
{
"recipe": "watermark",
"recipeParameters": {
"watermarkFileLocation": "https://orkes.io/logo/orkes/png/4X/orkes-logo-purple-inverted-4x.png"
}
}
]
}

Output parameters

{
"fileLocations": {
"video_recipes_V3c0kxFjLsk-CCL-Youtube.mp4_watermark_0": {
"fileLocation": "https://image-processing-orkes.s3.amazonaws.com/86daa8e3-e35f-42dc-94d2-94092ce366a8-WATERMARK.mp4",
"recipe": "WATERMARK",
"recipeParameters": {
"watermarkFileLocation": "https://orkes.io/logo/orkes/png/4X/orkes-logo-purple-inverted-4x.png"
}
}
}
}