### Install AviGlitch Gem Source: https://ucnv.github.io/aviglitch Install the AviGlitch library using RubyGems. Ensure Ruby is installed first. ```bash $ sudo gem install aviglitch ``` -------------------------------- ### Datamosh AVI Files using Command Line Source: https://ucnv.github.io/aviglitch Use the `datamosh` command-line tool provided by the AviGlitch gem to remove keyframes from an AVI file without writing Ruby code. ```bash $ datamosh file.avi ``` -------------------------------- ### Randomize Screen Size Data in Keyframes Source: https://ucnv.github.io/aviglitch This Ruby code overwrites the screen size data of keyframes in an AVI file with random values, potentially causing playback issues with certain players/codecs. Requires the 'aviglitch' gem. ```ruby require 'aviglitch' a = AviGlitch.open 'file.avi' a.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 a.output 'out.avi' ``` -------------------------------- ### Repeat Frames in AVI Files Source: https://ucnv.github.io/aviglitch This Ruby code manipulates frames in an AVI file, collecting delta frames and repeating a selected non-keyframe multiple times to create a glitch effect. Requires the 'aviglitch' gem. ```ruby require 'aviglitch' a = AviGlitch.open 'file.avi' d = [] a.frames.each_with_index do |f, i| d.push(i) if f.is_deltaframe? end q = a.frames[0, 5] 100.times do x = a.frames[d[rand(d.size)], 1] q.concat(x * rand(50)) end o = AviGlitch.open q o.output 'out.avi' ``` -------------------------------- ### Datamosh AVI Files by Removing Keyframes Source: https://ucnv.github.io/aviglitch This Ruby code removes keyframes from an AVI file to create a datamoshing effect. Returning nil in the glitch block removes the frame. Requires the 'aviglitch' gem. ```ruby require 'aviglitch' a = AviGlitch.open 'file.avi' # Rewrite this line for your file. a.glitch :keyframe do |f| nil end a.output 'out.avi' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.