Reputation: 51
I am building an Azure Function in Visual Studio to convert a videos frames to images. I'm using the VideoFileReader class from Accord.Video.FFMPEG class. The code works on my machine but when trying to build this as an Azure Function Project, the using directive Accord.Video.FFMPEG errors. And subsequently the type VideoFileReader can not be found.
I have tried re-installing the Accord, Accord.Video and Accord.Video.FFMPEG NuGet packages.
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Accord;
using Accord.Video;
using Accord.Video.FFMPEG;
namespace ConvertVideo
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([BlobTrigger("videos/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)
{
log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
//start a new videoFileReader
using (var vFReader = new VideoFileReader())
{
//open the video
vFReader.Open(name);
//get the framerate
double frameRate = vFReader.FrameRate.ToDouble();
//more code which converts a frame to jpg
}
}
}
}
Upvotes: 2
Views: 2321
Reputation: 51
It seems the problem is the FFMPEG dll from Accord is only for .Net Frameworks and doesn't work with .Net Standard or .Net Core which Azure function app uses. I had to give up with Function App and use an Azure Webjob instead. Webjobs can use .Net frameworks.
Upvotes: 2
Reputation: 15754
If you didn't publish "Accord.Video.FFMPEG" to azure function successfully, you can add it manually on Azure portal.
Download the nupkg of "Accord.Video.FFMPEG" and drag the dll file in nupkg from local to "bin" folder which you created above.
Then use it in your function(shown as below screenshot)
Upvotes: 0