Media
An ffmpeg
or avconv
wrapper
Installation
Install ffmpeg:
brew install ffmpeg
Add this line to your application's Gemfile:
gem 'media'
And then execute:
$ bundle
Or install it yourself as:
$ gem install media
Usage
conversion = Media.convert do
y: true
input 'http://www.google.com/images/srpr/logo3w.png' do
loop: 1, f: 'image2'
end
output '/path/to/test2.webm' do
vcodec: 'libvpx', acodec: 'libvorbis', t: 4
maps label('video'), label('audio')
graph do
chain do
filter 'negate'
filter 'hflip' do
outputs 'video'
end
end
chain do
filter 'aevalsrc' do
arguments 'sin(440*2*PI*t)' => true
outputs 'audio'
end
end
end
end
end
conversion.call {|progress| p progress}
Outputs:
ffmpeg -v info -y -loop 1 -f image2 -i http://www.google.com/images/srpr/logo3w.png -vcodec libvpx -acodec libvorbis -t 4 -map [video] -map [audio] -filter_complex negate, hflip [video]; aevalsrc=sin(440*2*PI*t) [audio] /path/to/test2.webm
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