summaryrefslogtreecommitdiffstats
path: root/tools/audio_extract
diff options
context:
space:
mode:
Diffstat (limited to 'tools/audio_extract')
-rw-r--r--tools/audio_extract26
1 files changed, 16 insertions, 10 deletions
diff --git a/tools/audio_extract b/tools/audio_extract
index 2c040ea..a37bcdf 100644
--- a/tools/audio_extract
+++ b/tools/audio_extract
@@ -15,20 +15,26 @@ if [ -z "$1" ]; then
exit 1
fi
-./require ffmpeg
+./require ffmpeg || { exit 1; }
+
#if [ "$FORMAT" == "pcm_s16le" ]; then
# FORMAT="wav"
#fi
-echo -n " * Extracting audio ($FORMAT)..."
+if [ ! -f $BASENAME.wav ]; then
+ echo " * File $BASENAME.wav does not exists:"
+ echo -n " * Extracting audio ($FORMAT)..."
+
+ if [ "$3" ]; then
+ #DURATION="30" #`./duration$1`
+ DURATION="$3"
+ #echo "start: $2 - Dur: $DURATION"
+ ffmpeg -i $1 -ss $2 -t $DURATION -vn -acodec copy $NAME.$FORMAT 2> /dev/null
+ else
+ ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT 2> /dev/null
+ fi
-if [ "$3" ]; then
- #DURATION="30" #`./duration$1`
- DURATION="$3"
- #echo "start: $2 - Dur: $DURATION"
- ffmpeg -i $1 -ss $2 -t $DURATION -vn -acodec copy $NAME.$FORMAT 2> /dev/null
+ echo -e "OK!"
else
- ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT 2> /dev/null
+ echo " * File $BASENAME.wav already exists."
fi
-
-echo -e "OK!"