From 49f5506222daa23cb14ef40c84fdfe72f8742bee Mon Sep 17 00:00:00 2001 From: Antonio Roberts Date: Sun, 5 May 2013 18:34:57 +0100 Subject: [PATCH] Made glitches more random --- README | 6 +++--- what_glitch_1bitgif.sh | 14 ++++---------- what_glitch_CMYK.sh | 33 ++++++++++++++++++--------------- what_glitch_bmp.sh | 20 ++++++++------------ what_glitch_jpg.sh | 20 ++++++++------------ what_glitch_pcx.sh | 20 ++++++++------------ what_glitch_pix.sh | 27 ++++++++------------------- what_glitch_ppm.sh | 15 ++++----------- what_glitch_rgb.sh | 29 +++++++++++++++-------------- what_glitch_sgi.sh | 20 ++++++++------------ what_glitch_tga.sh | 20 ++++++++------------ 11 files changed, 92 insertions(+), 132 deletions(-) diff --git a/README b/README index ddd3670..b3a634e 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -What Glitch? +What Glitch? scripts By Antonio Roberts www.hellocatfood.com GNU/GPL. @@ -18,11 +18,11 @@ Basic Usage ================== 1. Make the file executable: In a terminal type chmod+x what_glitch_1bitgif.sh 2. Run ./what_glitch_1bitgif.sh /path/to/video/file -3. Hit enter +3. Hit Enter 4. Wait Notes ================== The scripts have only been tested on Ubuntu 10.10 and 12.04. If you are able to get them working with other operating systems please feel free to share your techniques -As this scripts processes each frame of a video file it will take a very long time to complete. It is recommended for use only on small video clips! \ No newline at end of file +As this scripts processes each frame of a video file it will take a very long time to complete. It is recommended for use only on short video clips! \ No newline at end of file diff --git a/what_glitch_1bitgif.sh b/what_glitch_1bitgif.sh index 4784819..052f8fd 100755 --- a/what_glitch_1bitgif.sh +++ b/what_glitch_1bitgif.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.bmp @@ -41,5 +36,4 @@ avconv -i out_%d.gif -b "$bitRate"k "$file"_1bitgif.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_1bitgif.mkv" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_CMYK.sh b/what_glitch_CMYK.sh index 6ac69e9..a016220 100755 --- a/what_glitch_CMYK.sh +++ b/what_glitch_CMYK.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.bmp @@ -26,19 +21,29 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand3=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand4=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) + +rand5=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) +rand6=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) +rand7=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) +rand8=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) + convert -colorspace CMYK -separate out_$no.bmp in_%d.bmp #glitch the cyan channel -sed -i s/t/63a/g in_0.bmp +sed -i s/$rand1/$rand5/g in_0.bmp #glitch the magenta channel -sed -i s/l/££uns/g in_1.bmp +sed -i s/$rand2/$rand6/g in_1.bmp #glitch the yellow channel -sed -i s/h/£24/g in_2.bmp +sed -i s/$rand3/$rand7/g in_2.bmp #glitch the key channel -sed -i s/a/64a/g in_3.bmp +sed -i s/$rand4/$rand8/g in_3.bmp #combine the channels into one image convert in_0.bmp in_1.bmp in_2.bmp in_3.bmp -set colorspace CMYK -combine out_$no.bmp @@ -57,6 +62,4 @@ avconv -i out_%d.bmp -b "$bitRate"k "$file"_bmpcmyk.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_bmpcmyk.mkv" -echo -e "----------------------------------------------------" +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_bmp.sh b/what_glitch_bmp.sh index a8694f8..23372d0 100755 --- a/what_glitch_bmp.sh +++ b/what_glitch_bmp.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.bmp @@ -26,8 +21,11 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 3) + #glitch the files -sed -i s/a/633/g out_$no.bmp +sed -i s/$rand1/$rand2/g out_$no.bmp echo -e "Glitched file $no of $fileno" @@ -40,6 +38,4 @@ avconv -i out_%d.bmp -b "$bitRate"k "$file"_bmp.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_bmp.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_jpg.sh b/what_glitch_jpg.sh index cb2c679..7fb451f 100755 --- a/what_glitch_jpg.sh +++ b/what_glitch_jpg.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.jpg @@ -26,8 +21,11 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 3) + #glitch the files -sed -i s/@/63/g out_$no.jpg +sed -i s/$rand1/$rand2/g out_$no.jpg echo -e "Glitched file $no of $fileno" @@ -40,6 +38,4 @@ avconv -i out_%d.jpg -b "$bitRate"k "$file"_jpg.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_jpg.mkv" -echo -e "----------------------------------------------------" +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_pcx.sh b/what_glitch_pcx.sh index fcb5db7..71598d9 100755 --- a/what_glitch_pcx.sh +++ b/what_glitch_pcx.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.pcx @@ -26,8 +21,11 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 3) + #glitch the files -sed -i s/#/6a/g out_$no.pcx +sed -i s/$rand1/$rand2/g out_$no.pcx echo -e "Glitched file $no of $fileno" @@ -40,6 +38,4 @@ avconv -i out_%d.pcx -b "$bitRate"k "$file"_pcx.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_pcx.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_pix.sh b/what_glitch_pix.sh index a17ead0..3723d0f 100755 --- a/what_glitch_pix.sh +++ b/what_glitch_pix.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.bmp @@ -42,16 +37,12 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) + #glitch the files -sed -i s/a/b/g out_$no.pix -sed -i s/A/h/g out_$no.pix -sed -i s/K/0/g out_$no.pix -sed -i s/¿/e/g out_$no.pix -sed -i s/@/$/g out_$no.pix -sed -i s/t/b/g out_$no.pix -sed -i s/#/g/g out_$no.pix -sed -i s/h/o/g out_$no.pix +sed -i s/$rand1/$rand2/g out_$no.pix echo -e "Glitched file $no of $fileno" @@ -82,6 +73,4 @@ avconv -i out_%d.bmp -b "$bitRate"k "$file"_pix.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_pix.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_ppm.sh b/what_glitch_ppm.sh index 2b80ef3..410231c 100755 --- a/what_glitch_ppm.sh +++ b/what_glitch_ppm.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.ppm @@ -40,6 +35,4 @@ avconv -i out_%d.ppm -b "$bitRate"k "$file"_ppm.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_ppm.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_rgb.sh b/what_glitch_rgb.sh index 184d9b7..25d75e3 100755 --- a/what_glitch_rgb.sh +++ b/what_glitch_rgb.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.bmp @@ -26,16 +21,24 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand3=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) + +rand4=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand5=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) +rand6=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 2) + convert -separate out_$no.bmp in_%d.bmp #glitch the red channel -sed -i s/a/63/g in_0.bmp +sed -i s/$rand1/$rand4/g in_0.bmp #glitch the green channel -sed -i s/b/bn£/g in_1.bmp +sed -i s/$rand2/$rand5/g in_1.bmp #glitch the blue channel -sed -i s/h/^2/g in_2.bmp +sed -i s/$rand3/$rand6/g in_2.bmp #combine the channels into one image convert in_0.bmp in_1.bmp in_2.bmp -combine out_$no.bmp @@ -54,6 +57,4 @@ avconv -i out_%d.bmp -b "$bitRate"k "$file"_bmprgb.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_bmprgb.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_sgi.sh b/what_glitch_sgi.sh index 96c2343..1ae5e78 100755 --- a/what_glitch_sgi.sh +++ b/what_glitch_sgi.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.sgi @@ -26,8 +21,11 @@ no=1 while [ $no -le $fileno ] do +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/a/ae/g out_$no.sgi +sed -i s/$rand1/$rand2/g out_$no.sgi echo -e "Glitched file $no of $fileno" @@ -57,6 +55,4 @@ avconv -i out_%d.bmp -b "$bitRate"k "$file"_sgi.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_sgi.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file diff --git a/what_glitch_tga.sh b/what_glitch_tga.sh index 821d4bd..f2b6287 100755 --- a/what_glitch_tga.sh +++ b/what_glitch_tga.sh @@ -1,20 +1,15 @@ #!/bin/bash -echo -e $0 -echo -e "By Antonio Roberts | hellocatfood" -echo -e "www.hellocatfood.com" -echo -e "GNU/GPL. See Licence" file=$1 -echo -e "Lets glitch $file" - -#get bitrate -bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) #make a directory to do the glitching rand=$RANDOM mkdir /tmp/temp_$rand cd /tmp/temp_$rand +#get bitrate +bitRate=$(avprobe $1 2>&1 | grep bitrate | cut -d ':' -f 6 | sed s/"kb\/s"//) + #convert the movie to frames avconv -i $file -b "$bitRate"k out_%d.tga @@ -26,8 +21,11 @@ no=1 while [ $no -le $fileno ] do +rand1=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) +rand2=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 1) + #glitch the files -sed -i s/7!/4ha/ out_$no.tga +sed -i s/$rand1/$rand2/ out_$no.tga echo -e "Glitched file $no of $fileno" @@ -58,6 +56,4 @@ avconv -i out_%d.bmp -b "$bitRate"k "$file"_tga.mkv #remove the temporary directory cd ../ -rm -rf temp_$rand/ -echo -e "Job done. Check for "$file"_tga.mkv" -echo -e "----------------------------------------------------" \ No newline at end of file +rm -rf temp_$rand/ \ No newline at end of file