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

jamiehodge/media

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Media

An ffmpeg or avconv wrapper

Installation

Install ffmpeg:

brew install ffmpeg --with-tools --with-libvpx --with-libvorbis --with-libtheora

Add this line to your application's Gemfile:

gem 'media'

And then execute:

$ bundle

Or install it yourself as:

$ gem install media

Usage

Convert:

conversion = Media.convert do
  options y: true

  # this example is slow, due to heavy network usage
  input 'http://www.google.com/images/srpr/logo3w.png' do
    options loop: 1, f: 'image2'
  end

  output '/path/to/example.webm' do
    options vcodec: 'libvpx', acodec: 'libvorbis', t: 4
    maps label('video'), label('audio')
    graph do
      chain do
        filter 'negate'
        filter 'hflip' do |f| # optional
          f.outputs 'video'
        end
      end
      chain do
        filter 'aevalsrc' do
          expressions 'sin(440*2*PI*t)'
          outputs 'audio'
        end
      end
    end
  end
end

conversion.call {|progress| p progress}

Probe:

probe = Media.probe('/path/to/example.mov') do
  options show_frames: true
end

probe.format
probe.streams
probe.streams('audio')
probe.frames   # requires show_frames option
probe.metadata # => Hash

Contributing

  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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages