Azure to the Rescue: How The Restaurant of Mistaken Orders Served Up Flawless Video Content

Picture this: In a bustling corner of Tokyo, there is a unique eatery known as The Restaurant of Mistaken Orders. What sets this establishment apart is its endearing waitstaff, who all have dementia. It's a place where you never know what you’ll get, but whatever arrives at your table is served with love and joy. The owners wanted to share this special experience with the world by creating videos that showcase the warmth, understanding, and acceptance that defines their restaurant. There was just one catch: they needed a way to process and upload these videos efficiently and on a budget. The Azure cloud provided just the solution!

Cooking Up A Solution with Azure Batch

Azure Batch is like the kitchen of a restaurant. In the kitchen, there are multiple chefs (nodes) working together to prepare different dishes (tasks) that make up the complete meal (job). The Restaurant of Mistaken Orders decided to use Azure Batch to process their video content, much like how their chefs work together to whip up delightful dishes.

In the provided C# code, an Azure Function called H_AzureBatchVideoProcessing is defined. Azure Functions are serverless, meaning they don’t require you to manage any infrastructure. This is like having an automatic dishwasher that takes care of the dishes while the chefs focus on cooking.

The Ingredients

To start, the Restaurant of Mistaken Orders needs to gather all the necessary ingredients (configurations and credentials) for Azure Batch and Blob Storage.

string batchAccountUrl = _videoBatchConfig.BatchAccountUrl;
string batchAccountName = _videoBatchConfig.BatchAccountName;
string batchAccountKey = _videoBatchConfig.BatchAccountKey;
string storageAccountConnectionString = _blobStorageConfig.ConnectionString;

Much like preparing the perfect broth, setting up the credentials is an essential first step.

Preparing The Kitchen

Just like how the kitchen must be ready before cooking can start, Azure Batch requires a pool of compute nodes. In the code, the CreatePool method sets up a pool in the Batch account.

string poolId = "ffmpeg-pool";
CreatePool(batchClient, poolId, log);

Think of the poolId as the name of the kitchen. The code ensures there’s a kitchen ready with all the tools required, like knives and cutting boards (compute nodes).

Chefs, Ready Your Stations!

Now that the kitchen is ready, it’s time to define the job. A job in Azure Batch is like a complete meal consisting of several dishes.

string jobId = CreateJob(batchClient, poolId, log);

This sets up a job that will use the kitchen (pool) we previously set up. It’s like telling the chefs to start prepping!

The Main Course - Processing The Videos

The AddTask method adds a task to the job, which is like assigning a chef to prepare a dish. The Restaurant of Mistaken Orders is preparing a video, so this is the main course!

AddTask(batchClient, jobId, inputVideoUrl, inputVideoName, outputVideoName, curlBlobSasUrl, ffmpegBlobSasUrl, azcopyBlobSasUrl, storageAccountConnectionString, "video-storage", log);

In this line, a task is added to the job to download a video, process it, and upload the output to Azure Blob Storage.

Patiently Waiting For The Dish To Cook

Just as you have to wait for a dish to cook properly, you have to wait for the video processing task to complete.

log.LogInformation("Task added to job. Waiting for completion...");

var monitor = batchClient.Utilities.CreateTaskStateMonitor();
var cloudTask = await batchClient.JobOperations.GetTaskAsync(jobId, "ffmpegTask");

await monitor.WhenAll(
new List<CloudTask> { cloudTask },

This part of the code monitors the task until it’s completed, like watching the oven to make sure the dish doesn’t burn!

Serving The Dish

Once the video is processed, the function cleans up the task and returns a success message, akin to a chef serving the dish to an eagerly awaiting customer.

log.LogInformation("Task Completed");
await batchClient.JobOperations.DeleteTaskAsync(jobId, "ffmpegTask");
return new OkObjectResult("Video processed successfully.");

Voilà! A Delicious Video is Served

The Restaurant of Mistaken Orders now has a powerful Azure solution to process and share their heartwarming videos with the world. Through Azure Batch and Blob Storage, they can focus on what they do best - serving love and acceptance, one mistaken order at a time.

Exciting News! This post is part of a series on integrating Sitecore Content Hub with Azure for video editing! Sitecore Content Hub is an integrated content management solution that enables organizations to manage and deliver content efficiently across various channels. By leveraging Azure’s powerful processing capabilities, this series will take you through how you can edit and optimize videos directly within Sitecore Content Hub. Stay tuned for more mouth-watering tips and tricks in upcoming posts! 🌟

Whether you are a restaurant owner, a marketer, or a developer, the combination of Azure and Sitecore Content Hub opens up endless possibilities for content creation and delivery. Grab your chef's hat and join us on this culinary tech adventure! 🍽️


Post a Comment