So in order to save your fingers the pain I updated the ffmpeg gem today. You see, previously you had to do this:
convert "finding_that_nemo_dude.avi", :to => "finding_that_nemo_dude.flv" do
...
end.run
Doesn’t look to bad, right? Well, maybe not, but if you pay attention you would notice some repetition here, since the only thing different about the filenames is the extension. So, to keep things nice and dry you can now do this instead:
convert "finding_that_nemo_dude.avi", :to => :flv do
...
end.run
The old way still works if you really want a different filename all together or if you just really like to type
Posted in
Ruby,
Utilities,
gems at August 15th, 2009.
2 Comments
Tagged with
dsl,
ffmpeg,
gems,
Ruby. Written by:
Patrik Hedman
FFmpeg is a great tool for recording, converting and streaming audio and video. It can, however, be quite cumbersome to use. For example consider the following command:
ffmpeg -i some_file.flv -ss 00:00:20 -t 00:01:30 -s hd1080 -aspect 16:9 some_file.avi
Now, even though this is a simple example, it’s still kind of hard to know exactly what it does, so you can imagine what it will look like once you need to accomplish more complex tasks. By contrast, here is the same example using my ffmpeg gem (gem install polly-ffmpeg):
require "rubygems"
require "ffmpeg"
include FFMpeg
convert "some_file.flv", :to => "some_file.avi" do
seek "00:00:20"
duration "00:01:30"
resolution "hd1080"
aspect "16:9"
end.run
This is in my opinion much easier to understand and use.
For more information checkout the documentation and the source code
Posted in
Ruby,
Utilities,
gems at August 5th, 2009.
2 Comments
Tagged with
dsl,
ffmpeg,
gems,
Ruby. Written by:
Patrik Hedman