How to Create video Thumbnailer in rails
1. In model you have to write
mount_uploader :video, AvatarUploader
2. write gem in your gemfile
gem 'carrierwave'
gem 'carrierwave-video-thumbnailer'
3. and install dependance for thumbnailer
sudo apt-get install ffmpegthumbnailer
4. write code in your uploader folder
include CarrierWave::Video # for your video processing
include CarrierWave::Video::Thumbnailer
version :thumb do
process thumbnail: [{format: 'png', quality: 10, size: 192, strip: false, logger: Rails.logger}]
def full_filename for_file
png_name for_file, version_name
end
end
def png_name for_file, version_name
%Q{#{version_name}_#{for_file.chomp(File.extname(for_file))}.png}
end
Note : strip should be false for thumbnailer , go to public folder -> tmp->video -> 1-> you can file thumbnailer in your folder
No comments:
Post a Comment