Reputation: 397
I'm currently looking to write an AWS Lambda function in C#
I've taken a look at MediaInfo and FFMPeg wrappers on Nuget but the issue is they all accept FilePaths to open the file whereas in S3 / Lambda land I'm working with streams.
I don't want to create an EFS to temporarily store the file as it seems overkill and I don't think the library should need to read the entire stream to get the metadata either.
Essentially what I would like to do is similar to this but I'm a .net guy and would rather not learn Python / Docker / Linux etc...
Upvotes: 2
Views: 2680
Reputation: 119
Just want to add here as I have spend a good few hours on this (although the documentation is okay, I feel it would benefit a reorg).
For C# framewrok:
using System.IO;
using MediaInfoLib;
namespace MediaInfoNetFramework
{
internal class Program
{
static void Main(string[] args)
{
var purl = "https://presignedS3URL";
MediaInfo MI = new MediaInfo();
MI.Open(purl);
MI.Option("Complete");
var x = MI.Inform();
MI.Close();
return;
}
}
}
Notes:
Upvotes: 0
Reputation: 617
To ensure that you will support all the formats (demuxers/codecs) I would use FFmpeg.Autogen .NET bindings with FFmpeg win builds. Then you can get all the information that you require for all the streams (including codecs & metadata).
(Not familiar with AWS lambda so not sure if that will work)
Upvotes: 0
Reputation: 1207
You can use MediaInfo library from C#, the DLL without installer has the C# binding and there is also a C# MediaInfo binding example, which provide information about how to use MediaInfo library either by providing a URL (HTTP, FTP, S3...) or by buffer (you get yourself the content, in C#, as you are the only one who knows how to get the stream) the buffer data from your stream, and send buffer data to MediaInfo; MediaInfo says when it does not need any more data, so no read of the entire stream).
Jérôme, developer of MediaInfo
Upvotes: 2