summaryrefslogtreecommitdiffstats
path: root/tools/convert2speex
diff options
context:
space:
mode:
Diffstat (limited to 'tools/convert2speex')
-rwxr-xr-xtools/convert2speex34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/convert2speex b/tools/convert2speex
new file mode 100755
index 0000000..3600c2a
--- /dev/null
+++ b/tools/convert2speex
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Date: 2010-01-15
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Convert the sound from the video to mp3.
+
+
+EXT=`echo "$1"|awk -F . '{print $NF}'`
+BASENAME=`basename $1 .$EXT`
+
+BITRATE="64"
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <video-file> [<audio-quality>]"
+ exit 1
+fi
+
+./require speex || { exit 1; }
+./audio_extract $1
+
+echo -n " * Generating $BASENAME.spx ($BITRATE kbps)..."
+
+if [ "$2" ]; then
+ $BITRATE=$2
+fi
+
+speexenc $1
+ -b $BITRATE -a "$BASENAME.wav" "$BASENAME.mp3" > \
+"$BASENAME.mp3-compresslog" 2>&1
+
+
+echo -e "OK!"