summaryrefslogtreecommitdiffstats
path: root/tools/convert2vorbis
blob: 2a7b2d283e70c03f8b73ea2b07daa6a8ad02aead (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
35
36
37
38
#!/bin/bash
#
# Date:    2009-12-16
# Author:  Ole Kristian Lien
# License: GNU General Public License
#
# Convert the sound from the video to Ogg Vorbis.


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 oggenc # vorbis-tools

if [ ! -f $BASENAME.wav ]; then
	echo "File $BASENAME.wav does not exists"
	./audio_extract $1
fi

echo "Generating $BASENAME.ogg ($BITRATE kbps)..."

# --downmix
#Downmix stereo to mono. Only allowed on stereo input.
# sjekke om det er stero først? hvis ja, legg på downmix..

if [ "$2" ]; then
	$BITRATE=$2
fi

oggenc "$BASENAME.wav" --downmix -b $BITRATE \
	2>&1