Sha256: bdf2bb76e39e2903b7b2403eed7140ebc39bc8cb51201dffd3ede196e91c37b4

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
# Generate datamoshing

require 'optparse'
require 'rubygems'
require 'aviglitch'

output = './out.avi'
all = false

opts = OptionParser.new do |opts|
  opts.banner = "datamosh - AviGlitch's datamoshing video generator."
  opts.define_head "Usage: #{File.basename($0)} <input> [options]"
  opts.separator "Options:"
  opts.on("-o", "--output [OUTPUT]", 
    "Output the video to OUTPUT (./out.avi by default)") do |f|
    output = f
  end
  opts.on("-a", "--all", 
    "Remove all keyframes (It remains a first keyframe by default)") do
    all = true
  end
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end

input = opts.parse!
if input.empty?
  puts opts
  exit 1
end

a = AviGlitch.open input.shift
a.glitch_with_index :keyframe do |frame, i|
  (!all && i == 0) ? frame : "\000" * frame.size # keep the first frame
end
input.each do |file|
  b = AviGlitch.open file
  b.glitch :keyframe do |frame|
    "\000" * frame.size
  end
  a.frames.concat b.frames
end

a.output output

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aviglitch-0.0.3 bin/datamosh