miércoles, abril 02, 2008

aac2mp3

I've been looking for a program that convert me files from aac to mp3. But my internet connection has gone down. I said me, Why not to write my aac2mp3 converter?
Ok, I do it!

I left the code, and the link to download.

#!/bin/bash

INFILE=$1
OUTFILE=${INFILE:0:${#INFILE}-4} #Delete the file exstension.
OUTFILE=$OUTFILE.mp3 #Add mp3 extension

if [ -e "$INFILE" ]
then
#Proceso el archivo
if [ -e "$OUTFILE" ]
then
echo "File $OUTFILE already exists."
else
echo "Converting $INFILE to $OUTFILE."
faad -o /tmp/output_faad.wav "$INFILE"
if [ $? -eq 0 ]
then
lame --preset standard /tmp/output_faad.wav "$OUTFILE"
rm -f /tmp/output_faad.wav
else
echo "Faad finished with error."
fi
fi
else
echo "The file $INFILE not exists."
fi