Hamza Khan
Hamza Khan

Reputation: 1491

Create video from list of images using ruby on rails

Hi I want to create a video from list of images on ruby on rails. I have searched alot and all i found out was ffmeg, but i guess that's a command line tool. How do i create it using pure ruby on rails. Is there any gem or tutorial. Please Help.

Upvotes: 2

Views: 2264

Answers (4)

Hamza Khan
Hamza Khan

Reputation: 1491

It seems like i will have to use commandline tool as i did'nt find any gem that does all this stuff for me. install image magick install ffmpeg first convert all the jpg images into a gif file

convert -delay 250 -dispose Background  *.jpg images.gif

then convert that gif file into mp4 format

ffmpeg -f gif -i images.gif outfile.mp4

I would love to have a better answer than this.

Upvotes: 1

Hamza Khan
Hamza Khan

Reputation: 1491

Thanks to LordNeckbeard, i found this single command to convert images into video here ffmpeg .

ffmpeg -framerate 1/3 -pattern_type glob -i '*.jpg' -c:v libx264 out.mp4

Upvotes: 5

alebian
alebian

Reputation: 782

there are some gems that work as an interface between ruby and ffmpeg like https://github.com/streamio/streamio-ffmpeg. There are some other few, try them out!

Upvotes: 2

Jason Brodie
Jason Brodie

Reputation: 330

You can access command line through RoR.

result = %x[some command line call here]

What you would have to do is be sure you have the names path to your end result and confirm the return code from the command line call.

Upvotes: 1

Related Questions