-
Notifications
You must be signed in to change notification settings - Fork 1
/
m4a-to-mp3.sh
executable file
·49 lines (37 loc) · 1 KB
/
m4a-to-mp3.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
#!/bin/bash
INFILE="$1"
if [ "$INFILE" == "" ] ; then
echo "no input file specified"
exit 1
fi
if [ "$2" == "" ] ; then
OUTFILE=`echo $INFILE | sed 's/m4a$/mp3/g'`
echo "Info, output file name $OUTFILE was derived from input file name"
else
OUTFILE="$2"
fi
if [ "$OUTFILE" == "" ] ; then
echo "Error, OUTFILE blank"
exit 1
fi
if [ "$INFILE" == "$OUTFILE" ] ; then
echo "Error, INFILE '$INFILE' same as OUTFILE '$OUTFILE'"
exit 1
fi
if [ ! -f "$INFILE" ] ; then
echo "Error, input file doesn't exist"
exit 1
fi
if [ -f "$OUTFILE" ] ; then
echo "Error, output file already exists"
exit 1
fi
#nice ffmpeg -nostdin --enable-libfdk-aac --enable-nonfree -i "$INFILE" -ab 320k -map_metadata 0 "$OUTFILE"
#nice ffmpeg -nostdin --enable-nonfree -i "$INFILE" -ab 320k -map_metadata 0 "$OUTFILE"
time nice ffmpeg -nostdin -loglevel warning -i "$INFILE" -ab 320k -map_metadata 0 "$OUTFILE"
errcode=$?
if [ $errcode -ne 0 ] ; then
echo "ffmpeg returned error code $errcode"
fi
exit $errcode
# end m4a-to-mp3.sh