3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/moshy/bake.rb', line 3
def cli(args)
opts = Slop::Options.new
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - can be anything that ffmpeg supports.'
opts.string '-o', '--output', 'File output path - should end in .avi.'
opts.separator 'Optional Parameters:'
opts.integer '-b', '--bitrate', 'Bitrate amount (kb/s). Defaults to 4196. Larger number means higher quality, but larger size.'
opts.string '-p', '--pframes', 'Makes sure that there are only P-Frames (no B-Frames). Set this true if you plan to mosh your baked file again. Defaults false.'
opts.integer '-n', '--iframe-interval', 'Ideal interval for I-Frames to be distributed. Set this to a high number (600) if you plan to mosh your baked file again.'
default = {
:bitrate => 4196
}
parser = Slop::Parser.new(opts)
slop_options = parser.parse(ARGV)
@options = default.merge(slop_options) { |key, oldval, newval|
if newval.nil?
oldval
else
newval
end
}
if @options[:pframes] == "false"
@options[:pframes] = false
else
@options[:pframes] = true
end
mandatory = [:input, :output]
missing = mandatory.select{ |param| @options[param].nil? }
unless missing.empty?
puts "Missing options: #{missing.join(', ')}"
puts slop_options
exit
end
prep @options[:input], @options[:output], @options[:pframes], @options[:'iframe-interval'], @options[:bitrate]
end
|