Is there a way to convert audio files in Mac OS X or the command line without using iTunes?
Now, I know I can use iTunes to convert music. But it's quite a pain.. All I'm asking is: Is there anything built into OS X or UNIX for converting files? Right now I simply want to convert .mp4 to .mp3..
Doug's AppleScripts for iTunes
including
Convert and Export 2.0
is a collection of useful scripts that you can run from the Finder or the command line. Of course they all use iTunes to process data, but you might find it more convenient than having to use iTunes' GUI and mouse commands to convert files.
I installed ffmpeg
via MacPorts, although it also available via Homebrew (brew install ffmpeg
) or download the binary.
To convert something like that, (without worrying about audio quality, which I know nothing about), I just use:
ffmpeg -i input.mp4 output.mp3
Here is an example of how you would convert a .wav
file to .mp3
from their website:
ffmpeg -i input.wav -codec:a libmp3lame -qscale:a 2 output.mp3
Here is an example of how to find all .wav
files larger than 50M, convert them to mp3 and then delete the original wav (aka, batch mode -- alter the find command to create your 'batch')
find . -size +50M -iname *.wav -type f -exec ffmpeg -i {} -codec:a libmp3lame -qscale:a 2 {}.mp3 -y \; -exec /bin/rm {} \;
OS X does not ship with any MP3 encoder apart from the one in iTunes. For converting to mpeg4 audio you can use the CLI command afconvert (afconvert -h for available options). For example:
afconvert track.aiff -o track.m4a -q 127 -b 128000 -f m4af -d aac
Help for this tool can be found by running "afconvert --help" as "man afconvert" doesn't point to a useful manual page.