0

I have an API with a POST method which captures images and stores them to a blob container on Azure. These images will make up a sequence of frames for a video file once ready to process. I have another endpoint that my application calls when it is ready to process the sequence and get back a video file.

I have everything in place and ready for video processing but I am stuck on how to achieve what I thought would be very simple! Since my endpoint runs in .NET Core I cannot use any legacy .Net libraries and since I am deploying to an Azure WebApp (Windows OS) that may need to scale up/out I cannot install anything other than pre-compiled .Net Core compatible Nuget packages on the hardware as part of my deployment from DevOps.

I can't find any good libraries or examples that run in this scenario. I've run into issues trying to use anything related to GDI+ or FFMPEG...

Was hoping to find something similar to SixLabors.ImageSharp

I have a list of all the images in order and ready to be processed like so:

var frames = new List<Image>();

// (Removed for brevity) Retrieve images from blobs & append to frame list...

foreach(var frame in frames)
{
    // Convert frames/sequence to video file
}

// Save to blob storage as .mp4

Any help would be appreciated!

INNVTV
  • 2,623
  • 3
  • 30
  • 54

1 Answers1

2

Per my experience, the solution to convert image sequence to a video streaming or file is normally to use some popular libraries like ffmpeg or libav to do that.

If you search for some keywords like C# ffmpeg images video or C# libav images video, you will get much useful content to help realizing it, as below, there are few threads you can refer to.

  1. Image sequence to video stream?
  2. Converting Images into Video using C#
  3. tomaszzmuda/Xabe.FFmpeg

And then, you can get the video streaming or file to upload to Azure Blob Storage as a block blob, please follow the offical tutorial Quickstart: Azure Blob storage client library for .NET to know how to use Azure Storage SDK for .NET standard and the key class in C# is CloudBlockBlob Class which functions enter link description hereBeginUploadFromFile for video file or BeginUploadFromStream for video stream.

But there is an issue about your app deployment. Due to the limitation of Azure Web App sandbox about Win32k.sys (User32/GDI32) Restrictions as the figure below, you can not deploy any app used GDI system call to Azure WebApp.

enter image description here

So a normal recommended Azure service for your app is Azure VM.


Update:

If you considered to use dotNet Core to realize it, I suggested that you can try to use Azure App Service on Linux which be based on Docker and no limits for GDI. Also, Azure Batch is the other choice for realizing your needs in any language. And I wish you will complete your evaluation.

Peter Pan
  • 20,663
  • 4
  • 18
  • 35
  • Thanks Peter. I actually went through all 3 of those links already. As you mentioned the main problem I have is attempting to do this using a WebApp and not a VM. I wanted to avoid having to manage a VM in my scenario and was hoping I could find a solution that I could leverage that is easy to deploy/scale using a managed solution. Possibly even cross-platform using .Net Core. I'm looking at 3rd party services offering API's right now that may actually allow me to do this. The main contender is Translodeit: https://transloadit.com/ I will update this answer once my evaluation is complete. – INNVTV Sep 10 '19 at 14:55
  • Thank you Peter! The Azure Batch option is actually very compelling! For anyone interested I found a good video on it [here](https://www.youtube.com/watch?v=jvX0IeFMmCE) as well as a starter project [here](https://docs.microsoft.com/en-us/azure/batch/tutorial-parallel-dotnet) and the associated code [here](https://github.com/Azure-Samples/batch-dotnet-ffmpeg-tutorial). For the Transcodeit option they have a compelling endpoint [here](https://transloadit.com/demos/video-encoding/generate-a-video-from-image-sequence/) - I may end up using the Azure Batch solution as it is the most flexible. – INNVTV Sep 10 '19 at 21:14