Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 64 lines (47 sloc) 1.52 KB
#make a directory to do the glitching
mkdir /tmp/temp_$rand
cd /tmp/temp_$rand
#convert the movie to frames
avconv -i $file -qscale 0 out_%d.sgi
#count the number files in the directory
fileno=$(ls out_*.sgi -1 | wc -l)
#begin the glitch loop
while [ $no -le $fileno ]
rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1)
rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2)
#glitch the files
sed -i s/$rand1/$rand2/g out_$no.sgi
echo -e "Glitched file $no of $fileno"
no=$(($no + 1))
echo -e "You may see a lot of error messages here. Don't worry about them"
#avconv doesn't seem to like sgi files as input so convert them to bmps
gimp -n -i -b - <<EOF
(let* ( (file's (cadr (file-glob "*.sgi" 1))) (filename "") (image 0) (layer 0) )
(while (pair? file's)
(set! image (car (gimp-file-load RUN-NONINTERACTIVE (car file's) (car file's))))
(set! layer (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
(set! filename (string-append (substring (car file's) 0 (- (string-length (car file's)) 4)) ".bmp"))
(gimp-file-save RUN-NONINTERACTIVE image layer filename filename)
(gimp-image-delete image)
(set! file's (cdr file's))
(gimp-quit 0)
rm out_*.sgi
#get path of file
path=$( readlink -f "$( dirname "$file" )" )
#get filename minus extension
file1=$(basename "$file")
#combine the images into a video
avconv -i out_%d.bmp -qscale 0 "$path"/"$filename"_sgi.mkv
#remove the temporary directory
cd ../
rm -rf temp_$rand/
Something went wrong with that request. Please try again.