Sha256: 3e0d217a9cf03de9b33af810ec38fb34632437860ce27b2771637cef3a1fcd3e

Contents?: true

Size: 1015 Bytes

Versions: 2

Compression:

Stored size: 1015 Bytes

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)} [options] file [file2 ...]"
  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 : nil # keep the first frame
end
input.each do |file|
  b = AviGlitch.open file
  b.glitch :keyframe do |frame|
    nil
  end
  a.frames.concat b.frames
end

a.output output

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aviglitch-0.1.1 bin/datamosh
aviglitch-0.1.0 bin/datamosh