Sha256: 38900966a36cc167eab5a25a1afa9359051c7d4f925d41d486e7048e1dea9766
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
#!/usr/bin/env ruby # Generate datamoshing require 'optparse' require 'rubygems' require 'aviglitch' output = './out.avi' all = false force = 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("-f", "--force", "Overwrite an existing output file") do force = true 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 if !force && File.exists?(output) puts "!!! `#{output}' already exists. Use -f option to overwrite." exit 1 end a = AviGlitch.open input.first a.glitch_with_index :keyframe do |frame, i| if !all && i == 0 # keep the first frame frame else "\000" * frame.size end end a.output(output)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aviglitch-0.0.2 | bin/datamosh |