summaryrefslogtreecommitdiffstats
path: root/tools/convert2speex
blob: 3600c2a801b2d6148ccaec9c3d7ebe705d5890ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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!"