Created
September 12, 2009 15:54
-
-
Save ucnv/185886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Screen size glitch for xvid encoded avi | |
require 'aviglitch' | |
avi = AviGlitch.open ARGV.shift | |
avi.glitch_with_index(:keyframe) do |data, i| | |
x = data[25..28].unpack('B*').first | |
w = rand(('0b' + x[0..12]).oct * 1.5) | |
h = rand(('0b' + x[14..26]).oct * 1.5) | |
x[0..12] = "%013b" % ((w > 50) ? w : 50) | |
x[14..26] = "%013b" % ((h > 50) ? h : 50) | |
(i == 0) ? data : data[0..24] + [x].pack('B*') + data[29..data.size] | |
end | |
avi.output 'out.avi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment