4

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?

muds
  • 518
  • 1
  • 3
  • 13
  • I eventually created a temp folder (I'm using Lambda) and saved the screenshots to it, and then uploaded those to S3 (I got rid of the signed URL entirely and just downloaded the video files to Lambda as well). I'm not convinced that there's any way to directly save it to S3, but I'll keep my question alive for someone else to confirm. – muds Jul 18 '17 at 09:07
  • Have you got a solution to directly save it to S3? – prak Aug 03 '20 at 18:17

0 Answers0