Video encoding processor for CarrierWave
Recently I was wondering if it’s really easy to create own processor / converter for CarrierWave.
Check out the updated version of this post
Recently I was wondering if it’s really easy to create own processor / converter for CarrierWave. Well, the answer is YES. We’ve needed video converting utility in our app that would output given video file in mp4 / webm format (suitable for both flash and HTML5 video players). Recently I also found new gem called voyeur – a nice ffmpeg wrapper (needs to be added in your Gemfile).
Custom processor will then look like this (put this in lib/carrierwave_processing/ dir):
Usign this in uploader is very easy, but remember to define a custom filename for version – encoded file will have different extension
I also have a custom initializer, that automagically loads all processors:
And that’s it – from this moment on your app will be able to convert uploaded video files to “displayable” format. I hope that above solution will save you some time.
(credits: photo from unsplash.com)