ruby-av / paperclip-av-transcoder

Audio/Video Transcoder for Paperclip using FFMPEG/Avconv
MIT License
136 stars 82 forks source link

Generate multiple thumbnails from video #25

Closed dashingspidy closed 9 years ago

dashingspidy commented 9 years ago

Greetings, I'm trying to find a way to generate multiple thumbnails from uploaded video. After lot of searching i've found a way but it's pure ffmpeg command.

ffmpeg -ss number_of_thumb * (total_video/number_of_thumb)  -i video_file  -vframes 1 -s 320x240 thumb_%03d.jpg 

This is the url where i find this code: Debuggable please somebody help me to generate this command to paperclip way or tell me how can i generate multiple thumbnails using paperclip-av-transcoder!

Thank you in advance.

Regards, Arif

attenzione commented 9 years ago

You can define multiple styles for paperclip attachment with different time: option

attenzione commented 9 years ago
# app/models/user.rb
class User < ActiveRecord::Base
  has_attached_file :avatar, styles: {
    medium: { geometry: "640x480", format: 'flv' },
    thumb_10: { geometry: "100x100#", format: 'jpg', time: 10 }
    thumb_20: { geometry: "100x100#", format: 'jpg', time: 20 }
  }, processors: [:transcoder]
end