|
@@ -1,7 +1,7 @@
|
|
#!/usr/bin/env bash
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
-if [ $# -ne 1 ]; then
|
|
|
|
- echo "Usage: $0 <filename>"
|
|
|
|
|
|
+if [[ $# -lt 1 || $# -gt 2 ]]; then
|
|
|
|
+ echo "Usage: $0 <filename> <separator>"
|
|
exit 1
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
|
|
@@ -10,14 +10,14 @@ if [ ! -f $1 ]; then
|
|
fi
|
|
fi
|
|
|
|
|
|
file=$1
|
|
file=$1
|
|
|
|
+sep=$2
|
|
|
|
|
|
FFMPEG="docker run -ti --rm -v $(pwd):/data -w /data linuxserver/ffmpeg"
|
|
FFMPEG="docker run -ti --rm -v $(pwd):/data -w /data linuxserver/ffmpeg"
|
|
FFPROBE="docker run -ti --rm -v $(pwd):/data -w /data --entrypoint ffprobe linuxserver/ffmpeg"
|
|
FFPROBE="docker run -ti --rm -v $(pwd):/data -w /data --entrypoint ffprobe linuxserver/ffmpeg"
|
|
|
|
|
|
CLIP_LEN=60
|
|
CLIP_LEN=60
|
|
|
|
|
|
-audio_len=$($FFPROBE -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $file | tr -d '\r\n')
|
|
|
|
-audio_len=${audio_len%.*}
|
|
|
|
|
|
+audio_len=$($FFPROBE -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $file | tr -d '\r\n' | sed 's/\..*$//')
|
|
max_start=$(expr $audio_len - $CLIP_LEN)
|
|
max_start=$(expr $audio_len - $CLIP_LEN)
|
|
|
|
|
|
# first make a bunch of 60s clips with random start positions
|
|
# first make a bunch of 60s clips with random start positions
|
|
@@ -29,14 +29,20 @@ done
|
|
|
|
|
|
# next loop over those clips and shrink them appropriately
|
|
# next loop over those clips and shrink them appropriately
|
|
for i in $(seq 0 59); do
|
|
for i in $(seq 0 59); do
|
|
- infile="clip-$i.wav"
|
|
|
|
- outfile="clip-$i-adj.wav"
|
|
|
|
- tempo=$(eval printf 'atempo=0.95\;%.0s' {1..$i})
|
|
|
|
|
|
+ outfile="clip-$i.wav"
|
|
|
|
+ infile="_$outfile.tmp"
|
|
|
|
+ mv $outfile $infile
|
|
|
|
+ tempo=$(eval printf 'atempo=1.1,%.0s' {1..$i} | sed 's/,$//')
|
|
$FFMPEG -i $infile -filter:a "$tempo" -vn $outfile
|
|
$FFMPEG -i $infile -filter:a "$tempo" -vn $outfile
|
|
|
|
+ rm $infile
|
|
done
|
|
done
|
|
|
|
|
|
# stitch em together
|
|
# stitch em together
|
|
# Using a file here because i need to access it in docker
|
|
# Using a file here because i need to access it in docker
|
|
->_concat; for i in $(seq 0 59); do echo "file clip-$i-adj.wav" >>_concat; done
|
|
|
|
|
|
+>_concat
|
|
|
|
+for i in $(seq 0 59); do
|
|
|
|
+ echo "file clip-$i-adj.wav" >>_concat
|
|
|
|
+ [ "$sep" != "" ] && echo "file $sep" >>_concat
|
|
|
|
+done
|
|
|
|
|
|
-ffmpeg -f concat -safe 0 -i _concat -c copy powerhour.wav
|
|
|
|
|
|
+$FFMPEG -f concat -safe 0 -i _concat -c copy powerhour.wav
|