Giter Club home page Giter Club logo

jwthumbs's Introduction

Build Status

JWthumbs

Want to add tooltip thumbnails to your JWPlayer? You're welcome!

JWthumbs is a Ruby gem to create a .VTT file and a sprite of thumbnails of a given video file (mp4, mpg, avi, mov and so on...). You can't create timeline thumnails easier than this. Heavily inspired by vlanard's great Python script.

System requirements

In order to use JWthumbs, you must have ffmpeg and imagemagick installed.

Installation

Installation of JWthumbs is pretty straigt forward. Add this to your Gemfile:

gem 'jwthumbs'

And then:

$ bundle install

Or install it yourself as:

$ gem install jwthumbs

Usage

Instantiate your video file:

movie = Jwthumbs::Movie.new("YOUR_VIDEO.mp4")

Jwthumbs::Movie.new accepts second parameter as a options hash. You can configure several stuff at the same time you instantiate your video like this:

movie = Jwthumbs::Movie.new("YOUR_VIDEO.mp4", seconds_between: 60, sprite_name: "my_sprite_name.jpg")

or after you instentiated your video, you can use Jwthumbs::Movie file to configure things:

movie = Jwthumbs::Movie.new("YOUR_VIDEO.mp4")
movie.seconds_between = 60
movie.sprite_name = "my_sprite_name.jpg"

and then to create your thumbnails and .VTT file just run this command.

movie.create_thumbs!

If you haven't changed defaults, your _sprite.jpg and _thumbs.vtt file will be exportes to output directory of your root path.

"What will I do now?"

If you're using JWPlayer, there is a cool tutorial on their web site, see Adding Tooltip Thumbnails

Configuration

:outdir (string): The path you want your files to be exported. Example: /this/is/my/path

:seconds_between (integer): Time in seconds between each of snapshots to be taken. Default is video duration / 10.

:thumb_width (integer): Width of thumbnails that will be placed in the sprite of images. Bigger thumb width size means bigger sprite and bigger file size. Default is 100 which is also recommended.

:vttfile (string): Name of your .VTT file. Default is file_name_thumbs.vtt

:spritefile (string): Name of your sprite file. Default is file_name_sprite.jpg

:clear_files (true / false): Thumbnails should be deleted or not? Before creating sprite, number of snapshots will be taken from the video in respect of :seconds_between parameter. Sprite is created by montageing those thumbnails into one file. So you may need to use thumbnails or you may not. Your choice. Default is true.

:gallery_mode_on (true / false): You can use JwThumbs to create snapshot galleries. When this option is true, snapshots of the video will be created but .VTT file and image sprite will be skipped. Default value is false.

Contributing

Any kind of participation is welcomed.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author, Licence and Permissions

scaryguy - 2014 - MIT

CAUTION: YOU CAN NOT USE THIS GEM IN APPLICATIONS HAVING ANY KIND OF INAPPROPRIATE CONTENT (see YouTube's [policy](http://www.youtube.com/yt/policyandsafety/policy.html) that I support).

jwthumbs's People

Contributors

scaryguy avatar vireshas avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.