No description, website, or topics provided.
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

carrierwave-video-thumbnailer

Build Status Code Climate

Description

A thumbnailer plugin for Carrierwave. It mixes into your uploader setup and makes easy thumbnailing of your uploaded videos. This software is quite an alpha right now so any kind of OpenSource collaboration is welcome.

Features

Runs ffmpegthumbnailer with CLI keys provided by your configuration or just uses quite a reasonable ffmpegthumbnailer's defaults. See Examples section for details.

Examples

Here's a working example:

In your Rails app/uploaders/reel_uploader.rb:

class ReelUploader < CarrierWave::Uploader::Base
  include CarrierWave::Video  # for your video processing
  include CarrierWave::Video::Thumbnailer

  version :thumb do
    process thumbnail: [{format: 'png', quality: 10, size: 192, strip: true, 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
end

Thumbnailer Options

The options are passed as a hash to the thumbnail processing callback as shown in the example. The options may be, according to ffmpegthumbnailer's manual:

  • format: 'jpg' or 'png' ('jpg' is the default).
  • quality: compression quality (1 to 10, default is 8).
  • size: thumbnail length in pixels (defaults to 128).
  • strip: movie film strip decoration (defaults to false).
  • seek: where to take the snapshot. May be specified as HH:MM:SS or X%. Defaults to 10%.
  • square: if set to true makes a square thumbnail regardless of an initial aspect ratio.
  • workaround: if set to true runs ffmpegthumbnailer in some safe mode (read man ffmpegthumbnailer for further explanations).
  • logger: an object behaving like Rails.logger (may be omitted).

Requirements

ffmpegthumbnailer binary should be present on the PATH.

Install

$ gem install carrierwave-video-thumbnailer

Or

gem 'carrierwave-video-thumbnailer'

in your Gemfile.

Contributions

If you'like to contribute to the code please note that we are now using A Successful Git Branching Model. So, please commit your changes to feature/* branches and make Pull Requests to the development branch. BTW you can install and use git flow Git plugin, too. Thanks in advance!

Acknowledgements

Huge Thanks to Rachel Heaton (https://github.com/rheaton) whose carrierwave-video gem has inspired me (and where I've borrowed some code as well).

Thanks to Evrone Web Laboratory which feeds me well enough (with the tasks of course) to do this job.

Copyright

Copyright (c) 2012 Pavel Argentov Copyright (c) 2012 Evrone.com

See LICENSE.txt for details.