Search code examples
amazon-s3mp4amazon-cloudfront

Programmatically add meta data for MP4


I have a server from where a single consumer me download MP4 files. I would like to add the username to the meta-data of the file at the time the user clicks "download". Amazon does something like this for the MP3 files.

Now, a slight variation to this is how would I do the same thing if the files are on Amazon Cloudfront.

Thanks!


Solution

  • You would have to route your request through your web server.

    1. Logged-in user clicks
    2. Web server downloads the MP4 file from S3 to its file system.
    3. Web server uses an MP4 editor to add the correct MP4 metadata to the file.
    4. Web server serves the MP4 file back to the customer as a download.

    S3 is dumb file storage, so you can't do any on-the-fly editing or processing. Any such work must occur on a machine with a CPU.

    As such, the question you posed could not be accomplished in any meaningful way using CloudFront, since the traffic needs to route back through your server for post-processing anyway.