Skip to content

Instantly share code, notes, and snippets.

@c9s
Created May 13, 2009 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/111156 to your computer and use it in GitHub Desktop.
Save c9s/111156 to your computer and use it in GitHub Desktop.
this script convert m4a audio file to mp3 file
#!/bin/bash
input=$1
if [[ -z "$input" ]] ; then
echo "Usage: $0 [m4a filepath]"
exit
fi
if [[ -z $(which faad) ]] ; then
echo "Can not found faad , please install it"
exit
fi
if [[ -z $(which lame) ]] ; then
echo "Can not found lame , please install lame"
exit
fi
noext=$(echo $input | sed -e 's/.m4a$//g' )
faad -w "$input" > "$noext.wav"
# -r : for assume raw pcm data
# -V : for varialbe rate
lame -r -h -V 6 "$noext.wav" "$noext.mp3"
# lame -h -b 64 "$noext.wav" "$out.mp3"
rm -v "$noext.wav"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment