How can I upload and convert video using RoR?
User can upload any video of any type... after that I need to convert this video to *.flv开发者_开发百科 How can I do this using RoR?
We do this with paperclip and ffmpeg. Paperclip allows you to add custom processors to a Paperclip attachment. We created such a processor which just calls ffmpeg on the command line to create the flash version of the video. ffmpeg even allows you to extract stills from the video for thumbnail representations.
With paperclip and ffmpeg and flvtool2
Have look at this gist with all you'll need. https://gist.github.com/507804
It has:
- Video to thumbnails
- Video to flash
- Correct geometry calculations etc...
There are two ways to do it, yourself or hosted solution.
- If you want to do it yourself, start with Bert's solution and go from there. Remember transcoding is CPU intensive, so you likely need to have a another server/on-demand instance doing this
- If you want to go for a hosted solution, see Kaltura.com or encoding.com
sign up for pandastream - available as a heroku add-on as is zencoder
they're not cheap options though so maybe look around for something less costly first
精彩评论