How to set the destination folder of a Node.js fluent-ffmpeg screenshot to your AWS S3 bucket using getSignedUrl()?

Viewed 581

I'm writing a program to generate .png thumbnails (with the same name, in the same folder) for a set of .mp4 videos in my Amazon S3 bucket. For this example, I'm going to create a /folder/file.png for a /folder/file.mp4 in the bucket. I've managed to set the source URL using the s3 object and getSignedUrl as follows:

var srcurl = s3.getSignedUrl('getObject', {
        Bucket: 'bucket-name',
        Key: '/folder/file.mp4'
      });

and

new ffmpeg({ source: srcurl })
     .screenshots({
        count: 1, 
        filename: '%f'.substr(0, '%f'.indexOf('.')) + '.png', 
        /* To shorten the long string that's returned */ 
        folder: desturl,
        size: MAX_WIDTH + 'x' + MAX_HEIGHT
      });

The destination URL has to be the same folder as the source. So I set it as follows:

var desturl = s3.getSignedUrl('putObject', {
        Bucket: 'bucket-name',
        Key: '/folder/file' + '.png'
      });

This combination doesn't work - is there a way to do this correctly?

0 Answers
Related