Variations on a theme by Casey & Finch #2

For the second and subsequent variations I used only seven instances of the chorus line as a source. For this variation I then wrote a script on each of the seven videos that created 90 segments of varying lengths (up to 0.999 seconds) from random positions in the video. I then finally composed them into one video.

Observations

With a shorter source input, this variation is more rhythmic than the first. There are more instances of the audio resembling a stuttering CD, though still lots of instances where it jumps around erratically.

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 90 \] 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"/"$filename"\_"$filenumber"\_cut.avi

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

done