Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created January 28, 2012 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmarini/1691792 to your computer and use it in GitHub Desktop.
Save bmarini/1691792 to your computer and use it in GitHub Desktop.
Toying with apis
it "has a nice api" do
# To set the video bitrate of the output file to 64kbit/s:
# ffmpeg -i input.avi -b:v 64k output.avi
builder = FastForward.build do |ff|
ff.input "input.avi"
ff.output "output.avi" do |o|
o.bitrate("64k").stream("video")
end
end
builder.to_s.should == "ffmpeg -i input.avi -b:v 64k output.avi"
# To force the frame rate of the output file to 24 fps:
# ffmpeg -i input.avi -r 24 output.avi
FastForward.build do |ff|
ff.input "input.avi"
ff.output "output.avi" do |o|
o.frame_rate(24)
end
end
builder.to_s.should == "ffmpeg -i input.avi -r 24 output.avi"
# To force the frame rate of the input file (valid for raw formats only) to 1
# fps and the frame rate of the output file to 24 fps:
# ffmpeg -r 1 -i input.m2v -r 24 output.avi
builder = FastForward.build do |ff|
ff.input "input.m2v" do |i|
i.frame_rate(1)
end
ff.output "output.avi" do |o|
o.frame_rate(24)
end
end
builder.to_s.should == "ffmpeg -r 1 -i input.m2v -r 24 output.avi"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment