I'm currently looking to write an AWS Lambda function in C#
- File uploaded to S3 triggers my Lambda
- Lambda to interrogate file and get technical metadata about video codecs, frame rates, audio channels, duration
- Lambda to post that data to another service
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...
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