public
Last active

  • Download Gist
datamoshing.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env ruby
# remove key frame information from AVI (codec: Cinepak)
# example result http://www.vimeo.com/3334387
 
# a name of AVI file
filename = ARGV.shift
 
f = open(filename)
data = f.read
f.close
 
main, index = data.split('idx1')
frames = main.split('00dc')
header = frames.shift
 
indexes = index.split('00dc')
indexes.shift
 
frames.each_with_index do |frame, i|
if indexes[i][0] == 18
frames[i] = "\x00" * frame.size
end
end
 
print [([header] + frames).join('00dc'), index].join('idx1')

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.