![](http://prograils.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bc1d6ef3bce056eeb29b398436e315db30e57f2c/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdEem9MY21WemFYcGxTU0lOTVRFd01IZzNNek1HT2daRlZEb0xabWxzZEdWeVNTSU5WSEpwWVc1bmJHVUdPd1pVT2d0a1pXWnBibVZKSWhWbWFXeDBaWEk2YzNWd2NHOXlkRDB5QmpzR1ZEb01kVzV6YUdGeWNFa2lGakF1TWpWNE1DNHlOU3M0S3pBdU1EWTFCanNHVkRvTFpHbDBhR1Z5U1NJSlRtOXVaUVk3QmxRNkRuQnZjM1JsY21sNlpXa0JpRG9NY1hWaGJHbDBlV2xmT2c1cGJuUmxjbXhoWTJWSklnbHViMjVsQmpzR1ZEb1BZMjlzYjNKemNHRmpaVWtpQ1hOU1IwSUdPd1pVT2dwemRISnBjRlE9IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--cba71b0f3c8996282b4688b9c2826e41318ef4a3/post_Video_encoding_processor_for_CarrierWave.jpg)
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)