Variations on a theme by Casey & Finch #1

For the first variation I used the video of the entire performance – minus the introduction from Don Cornelius and the fade out – as input. I then wrote a script that created 600 segments of varying lengths (up to 0.999 seconds) from random positions in the video and finally composed them into one video.

Observations

This variation is perhaps too chaotic to be considered a reproduction of the aesthetics of a skipping CD. The individual segments jump from extreme ends of the video too quickly to be recognisable, which bears little resemblance to skipping CDs or broken video files, which often repeat segments at the point at which they encounter an error.

Code

This script requires libav to run and has been tested on Ubuntu 13.04.

#!/bin/bash
#Usage: ./movie_cut.sh /path/to/file.avi
#e.g. ./movie_cut.sh video.avi

filenumber=$(printf "%05d")	
while [ $filenumber -le 600 ]
do

#calculate the length of the video
length=`expr $(avprobe -loglevel error -show_streams $1 | grep duration | cut -f 2 -d = | head -1 | cut -d "." -f 1) \* 100`
 
#start position
startPos=$(echo "scale=2;$(shuf -i 1-$length -n 1) / 100" | bc | sed -e s/^/0/)

#define random duration (up to 0.999 seconds)
duration=$(echo "0.$RANDOM")

#get path of file
path=$( readlink -f "$( dirname "$1" )" )

#get filename minus extension
file=$(basename "$1")
filename="${file%.*}"

#cut the video
avconv -i $1 -ss $startPos -t $duration -qscale 0 -ab 384k -y "$path"/"$filenumber"_"$filename"_cut.avi

filenumber=`expr $filenumber + 1`
filenumber=$(printf "%05d" $filenumber)

done