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
y: true
# this example is slow, due to heavy network usage
input 'http://www.google.com/images/srpr/logo3w.png' do
loop: 1, f: 'image2'
end
output '/path/to/example.webm' do
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
show_frames: true
end
probe.format
probe.streams
probe.streams('audio')
probe.frames # requires show_frames option
probe. # => Hash
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request