简体   繁体   中英

Best way to upload video via a presigned URL to S3?

I'm wondering what the best way is to upload a video to S3 via a presigned URL. I am primarily considering using a standard HTTP PUT request, placing video/mp4 as the Content-Type , and then attaching the video file as the body.

I'm wondering if there are more efficient approaches to doing this, such as using a third party library or possibly compressing the video before sending it via the PUT request?

In general, when your object size reaches 100 MB, you should consider using multipart uploads instead of uploading the object in a single operation.

https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html

I had most success using Uppy for this

https://uppy.io/docs/aws-s3-multipart/

You will need to provide some backend endpoints though:

  1. https://uppy.io/docs/aws-s3-multipart/#createMultipartUpload-file
  2. https://uppy.io/docs/aws-s3-multipart/#listParts-file-uploadId-key
  3. https://uppy.io/docs/aws-s3-multipart/#prepareUploadParts-file-partData
  4. https://uppy.io/docs/aws-s3-multipart/#abortMultipartUpload-file-uploadId-key
  5. https://uppy.io/docs/aws-s3-multipart/#completeMultipartUpload-file-uploadId-key-parts

On compression part of you question, S3 does not have any compute. It will not modify your sent bytes, it will just store it. If want to use compression, you need to do that before upload, upload to cloud, unzip there with some compute (Ec2, Lambda etc.) and then put to S3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM