3

I have a video stored in aws s3 bucket I want to get the metadata of the video (like framerate, resolution, etc) inside aws lambda which is using node js runtime.

It will be better if this can be done in memory instead of downloading the whole video in lambda temp memory

war-turtle
  • 85
  • 1
  • 7

2 Answers2

3

You can fetch metadata of your video via the headObject operation.

This is done without downloading the actual content of the video.

Edit: You're right, this doesn't help you. Extracting actual technical metadata of videos seems to be non-trivial. There's a good example on the AWS blog where they extract metadata via MediaInfo on lambda.

tpschmidt
  • 2,479
  • 2
  • 17
  • 30
  • 1
    data returned by headObject operation doesn't contain data like framerate, resolution, etc of the video. It contain data like contentLength, lastModified, etc. – war-turtle Jul 21 '20 at 13:00
  • you're absolutely right. I've edited my answer, maybe this of some help! – tpschmidt Jul 21 '20 at 13:12
2

MediaInfo supports natively AWS, without having to download the file in a first step. MediaInfo downloads in RAM what it needs for the analysis, and does itself the seek requests when needed.

URL style is https://AWSKey:AWSSecret@s3....
Using pre-signed URLs is also possible but the 20.03 version is buggy, you need to use MediaInfo snapshots.

Jérôme, developer of MediaInfo.

Jérôme Martinez
  • 1,118
  • 5
  • 10
  • what if I use url from some other site will it be fully downloaded or partially to get the metadata? – war-turtle Jul 22 '20 at 10:58
  • I'm trying to use pre-signed URLs with version 19.09 and 20.03 and it's not working. The pre-signed URLs r working fine in the browser. How can i download more older version in aws lambda – war-turtle Jul 22 '20 at 14:08
  • I have also tried `https://AWSKEY:AWSSECRET@s3.amazonaws.com/bucket/key` url and it's also not working – war-turtle Jul 22 '20 at 14:39
  • Behavior of MediaInfo is same on S3 or other sites. S3 is used by a lot of users, AWSKEY:AWSSECRET style is known (use by several sponsors) to be fine and pre signed URls buggy with 20.03 (19.09 and snapshots are fine). if you think there is an issue, please send the command with a real use case (URL or temporary key/secret) at info@mediaarea.net for debugging. – Jérôme Martinez Jul 22 '20 at 17:44
  • Okay. So, I downloaded the lambda zip file from the lastest snapshot and it's working previously I was downloading zip from the site. Thanks for making this tool – war-turtle Jul 23 '20 at 07:37