bin/datamosh in aviglitch-0.1.2 vs bin/datamosh in aviglitch-0.1.3
- old
+ new
@@ -5,10 +5,11 @@
require 'rubygems'
require 'aviglitch'
output = './out.avi'
all = false
+fake = false
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:"
@@ -18,10 +19,17 @@
end
opts.on("-a", "--all",
"Remove all keyframes (It remains a first keyframe by default)") do
all = true
end
+ opts.on("--fake", "Remains all keyframes as full pixel included deltaframe") do
+ fake = true
+ if all
+ warn "The --fake option cannot use with -a/--all option.\n"
+ exit
+ end
+ end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
@@ -31,18 +39,22 @@
puts opts
exit 1
end
a = AviGlitch.open input.shift
-a.glitch_with_index :keyframe do |frame, i|
- (!all && i == 0) ? frame : "" # keep the first frame
+unless fake
+ a.glitch_with_index :keyframe do |frame, i|
+ (!all && i == 0) ? frame : "" # keep the first frame
+ end
end
-a.clear_keyframes!(!all ? 1..a.frames.size : nil)
+a.clear_keyframes!(!all && !fake ? 1..a.frames.size : nil)
input.each do |file|
b = AviGlitch.open file
- b.glitch :keyframe do |frame|
- ""
+ unless fake
+ b.glitch :keyframe do |frame|
+ ""
+ end
end
b.clear_keyframes!
a.frames.concat b.frames
end