|
@@ -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
|
|
@@ -39,6 +39,10 @@ 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
|