6

According to the MediaInfo ChangeLog, Amazon S3 support was added in v0.7.76 and even patched in v0.7.77 (latest).

However, I can't find any documentation on how to implement it. It's not in CLI help menu nor the SourceForge project pages. I was hoping someone here might have some insight as the SourceForge forum is closed off.

How do I craft a MediaInfo command to use Amazon S3 with Access Key & Secret Key? I'm using the CLI.

The closest thing I could find was someone's example Java code: http://fossies.org/linux/MediaInfo_CLI/MediaInfoLib/Source/Example/HowToUse_Dll.JNA.java

It looks like they're crafting a custom HTTP request to S3 and streaming the response to MediaInfo. I'm not sure. I don't know Java; I only know Bash, Ruby, PHP.

Has anyone successfully got MediaInfo working with S3; something like this?

mediainfo https://AWSAccessKeyId:AWSSecretAccessKey@s3.amazonaws.com/bucketname/filename
BoomShadow
  • 912
  • 1
  • 18
  • 31

3 Answers3

4

Mediainfo executable can be built with libcurl on linux distribution using below commands: (I used centos)

yum groupinstall 'Development Tools'
yum install libcurl-devel
yum install wget
wget http://mediaarea.net/download/binary/mediainfo/17.12/MediaInfo_CLI_17.12_GNU_FromSource.tar.xz
tar xvf MediaInfo_CLI_17.12_GNU_FromSource.tar.xz
cd MediaInfo_CLI_GNU_FromSource/
./CLI_Compile.sh --with-libcurl
cd MediaInfo/Project/GNU/CLI
./mediainfo --version

Then following command will provide media information for Amazon S3 url.

mediainfo --Output=XML https://AWSAccessKeyId:AWSSecretAccessKey@s3.amazonaws.com/bucketname/filename

The above command won't work with AWS keys(filename) having special characters. By using pre-signed url, it is possible to use special characters in AWS Keys.

aws s3 presign 's3://bucketname/testing/mini & bar™©.mp4' 
mediainfo 'presignd url'
Swati
  • 577
  • 6
  • 15
  • Amazon has updated their URL mapping, so you need to move the bucketname to the beginning of the hostname, and use a period in place of the forward slash. For example, `@bucketname.s3.amazonaws.com/filename`. – jerhewet Sep 10 '20 at 13:51
3

The Java example is an example about how to download with Java and send data to MediaInfo from Memory. Now MediaInfo has native support of S3. So just provide this URL.

The only issue is that you must have libcurl available and MediaInfo compiled with libcurl support. This is not already available on all platforms (e.g. on Windows you must put libcurl.dll from libcurl website in the same folder as mediainfo).

Better delivery of such support (with libcurl provided directly, and fully tested, on all platforms) is planned but there is no ETA.

bastelflp
  • 9,362
  • 7
  • 32
  • 67
Jérôme Martinez
  • 1,118
  • 5
  • 10
  • Thanks for clarifying the Java example. That's what I thought. I have libcurl compiled (on Ubuntu) and I can successfully use S3 URL's. But those objects must have public-read access for it to work. Are you able to please provide an example using the new feature with S3 credentials (Access Key & Secret Access Key), please? I want to access private objects in S3. – BoomShadow Sep 29 '15 at 20:01
  • The example you provided is the right way to provide private URL. I tested it myself when I developped the private URL feature. Unfortunately there is no debug feature (no explaination about the error) for the moment. – Jérôme Martinez Sep 30 '15 at 20:32
1

I face the same problem. Please try this, it will work

https://{yourAwsAccessKey}:{yourAwswsSecretKey}@{yourBucketName}.s3.awsamazon.com/{file_path_in_bucket}

Adam Jaamour
  • 1,326
  • 1
  • 15
  • 31