Skip to content

Dragonfly video plugin for analysing and generating screenshots of videos

License

Notifications You must be signed in to change notification settings

asgerb/dragonfly_video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4449d40 · Feb 6, 2025

History

36 Commits
Jan 28, 2025
Mar 6, 2018
Feb 6, 2025
Jan 25, 2025
Feb 6, 2025
Mar 7, 2018
Mar 15, 2018
Feb 6, 2025
Mar 6, 2018
Mar 6, 2018
Mar 19, 2018
Feb 6, 2025
Mar 15, 2018
Jan 25, 2025

Repository files navigation

Dragonfly Video

Build Status Gem Version Maintainability Test Coverage

Wraps common video-related tasks into Dragonfly analysers and processors.

Installation

Add this line to your application's Gemfile:

gem 'dragonfly_video'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dragonfly_video

Dependencies

The gem relies on ffmpeg (and ruby implementation streamio-ffmpeg) for reading metadata and generating screenshots of video files.

On a Mac you can install ffmpeg with homebrew: brew install ffmpeg.

Usage

Add the :video plugin to your Dragonfly config block:

Dragonfly.app.configure do
  plugin :video
end

Analysers

video_properties

Reads properties of a video file:

video.video_properties

# => {
#   duration: 7.5,
#   bitrate: 481,
#   size: 455546,
#   video_stream: "h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 371 kb/s, 16.75 fps, 15 tbr, 600 tbn, 1200 tbc",
#   video_codec: "h264",
#   colorspace: "yuv420p",
#   resolution: "640x480",
#   width: 640,
#   height: 480,
#   frame_rate: 16.72,
#   audio_stream: "aac, 44100 Hz, stereo, s16, 75 kb/s",
#   audio_codec: "aac",
#   audio_sample_rate: 44100,
#   audio_channels: 2
# }

Processors

screenshot

Generates a screenshot of the video's first frame:

video.screenshot

remove_audio

Removes audio from the video:

video.remove_audio

optimize

Optimizes the video based on predefined profiles: :streaming, :archive, :mobile or :default

video.optimize

Contributing

  1. Fork it ( https://github.com/asgerb/dragonfly_video/fork )
  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 a new Pull Request

About

Dragonfly video plugin for analysing and generating screenshots of videos

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published