-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconvertAudioFiles.sh
65 lines (52 loc) · 2.25 KB
/
convertAudioFiles.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/bash
cd "$(dirname "$0")"
# You need ffmpeg avconv to run this script
# put your files with lowercase ".ogg" extension into the audio directory
# the script will store converted .aac and .wav versions in audio/conversions/
mkdir ./audio/conversions > /dev/null 2>&1
for A in ./audio/*.ogg
do
filename=`basename ${A}`
filename="${filename%.*}"
# overwrite existing files, take ogg and convert to acc and wav
# ogg to aac
echo "converting ${A} to ./audio/conversions/${filename}.aac ... \c"
`avconv -v warning -y -i ${A} -strict experimental ./audio/conversions/${filename}.aac`
echo "done!"
# ogg to wav
echo "converting ${A} to ./audio/conversions/${filename}.wav ... \c"
`avconv -v warning -y -i ${A} ./audio/conversions/${filename}.wav`
echo "done!"
# x to ogg
#echo "converting ${A} to ./audio/conversions/${filename}.ogg ... \c"
#`avconv -v warning -y -i ${A} -acodec libvorbis -f ogg ./audio/conversions/${filename}.ogg`
#echo "done!"
# I disabled this conversion, because you need a license to use mp3 in your app
# An additional package libmp3lame is also required
# ogg to mp3
#echo "converting ${A} to ./audio/conversions/${filename}.mp3 ... \c"
#`avconv -v warning -y -i ${A} ./audio/conversions/${filename}.mp3`
#echo "done!"
done
#convert wav files in audio and move them to conversions
for A in ./audio/*.wav
do
filename=`basename ${A}`
filename="${filename%.*}"
# wav to aac
echo "converting ${A} to ./audio/conversions/${filename}.aac ... \c"
`avconv -v warning -y -i ${A} -strict experimental ./audio/conversions/${filename}.aac`
echo "done!"
# wav to ogg
echo "converting ${A} to ./audio/${filename}.ogg ... \c"
`avconv -v warning -y -i ${A} -acodec libvorbis -f ogg ./audio/${filename}.ogg`
echo "done!"
mv "${A} ./audio/conversions/"
# I disabled this conversion, because you need a license to use mp3 in your app
# An additional package libmp3lame is also required
# ogg to mp3
#echo "converting ${A} to ./audio/conversions/${filename}.mp3 ... \c"
#`avconv -v warning -y -i ${A} ./audio/conversions/${filename}.mp3`
#echo "done!"
done
echo "Everything converted"