Search code examples
ruby-on-railsherokuamazon-web-servicesamazon-s3ffmpeg

Amazon S3: how to combine all images into a video?


I'm in my Rails app, I enable users to upload images, which get processed using ffmpeg to create a video slideshow.

I have this working locally, but am wondering how to do this when deploying the app using Heroku. In particular, I know Heroku has limited storage and has a read-only filesystem, so using Carrierwave without S3 or an external storage option doesn't seem like an option.

But how would I run a task like the following using S3, where I combine all images into a video?

The ffmpeg command is

ffmpeg -r 5 -i https://s3.amazonaws.com/[]/uploads/image/image_file/26/img%03d.jpg output.mp4 -y

And the AWS "folder" contains the following: https://s3.amazonaws.com/[]/uploads/image/image_file/26/img001.jpg https://s3.amazonaws.com/[]/uploads/image/image_file/26/img002.jpg https://s3.amazonaws.com/[]/uploads/image/image_file/26/img003.jpg

When I try to do the following, I get an error with ffmpeg not knowing what to do with:

https://s3.amazonaws.com/[]/uploads/image/image_file/26/img%03d.jpg

Note, this whole video compilation process works fine for me locally, so I know in theory it should work.


Solution

  • This was actually really straightforward to fix - just replace https with http!