bin/datamosh in aviglitch-0.2.0 vs bin/datamosh in aviglitch-0.2.2

- old
+ new

@@ -6,10 +6,11 @@ require 'aviglitch' output = './out.avi' all = false fake = false +tmpdir = nil opts = OptionParser.new do |opts| opts.banner = "datamosh - AviGlitch's datamoshing video generator." opts.define_head "Usage: #{File.basename($0)} [options] file [file2 ...]" opts.separator "Options:" @@ -26,14 +27,18 @@ if all warn "The --fake option cannot use with -a/--all option.\n" exit end end + opts.on("--tmpdir [DIR]", "Specify the temporary directory") do |dir| + tmpdir = dir + end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end + opts.version = AviGlitch::VERSION end input = opts.parse! if input.empty? puts opts @@ -46,11 +51,11 @@ exit 1 end end end -a = AviGlitch.open input.shift +a = AviGlitch.open input.shift, tmpdir: tmpdir unless fake a.glitch_with_index :keyframe do |frame, i| (!all && i == 0) ? frame : "" # keep the first frame end end @@ -60,10 +65,10 @@ else a.mutate_keyframes_into_deltaframes! end input.each do |file| - b = AviGlitch.open file + b = AviGlitch.open file, tmpdir: tmpdir unless fake b.glitch :keyframe do |frame| "" end end