Please try OCG options combination generator.
require "ocg"
generator = OCG.new(
:bitrate => %w[100 500 1000],
:fps => %w[15 30],
:qp => %w[20 30]
)
puts generator.next until generator.finished?
Generator includes much more functionality that will help you to deal with other options.