Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Video thumbnails

Pierce Harmon edited this page Sep 4, 2015 · 12 revisions

You can extract thumbnails from videos with ImageMagick via the command below, where [1] denotes which frame to capture the image from.

convert input.mp4[1] thumbnail.jpg

To create a thumbnail from a video using paperclip, define your preferred sizes in your initial has_attached_file call:

class User < ActiveRecord::Base
  # Paperclip
  has_attached_file :photo,
    :styles => {
      :thumb => "100x100#",
      :small  => "150x150>",
      :medium => "200x200" }
end

For more on thumbnails see [Thumbnail Generation](Thumbnail Generation)


It is important to note that ImageMagick does not handle the thumbnail extraction directly. It delegates the extraction to the ffmeg library. If ffmpeg is not installed paperclip will raise Validation failed: Asset Paperclip::Errors::NotIdentifiedByImageMagickError.