Create video from list of images using ruby on rai

2020-07-29 08:33发布

问题:

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.

回答1:

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


回答2:

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!



回答3:

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.



回答4:

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.