Convert lossless m4a to flac

I tried to convert a file with pacpl, but I get the well-known "256" error. With the -v flag, the FAQ of pacpl tells me:

"The file you are trying to convert is a lossless .m4a file. The format is not yet supported by FAAC/FAAD."

Since faac/faad seems to be used in every other converting tool on Ubuntu, how can I successfully convert formats?


Solution 1:

You can convert an m4a file to flac with the ffmpeg command-line tool:

To install ffmpeg:

sudo apt-get install ffmpeg

To convert:

ffmpeg -i filein.m4a -f flac fileout.flac

Solution 2:

sudo aptitude install libav-tools

for file in *.m4a; do avconv -i "$file" -f flac "`basename "$file" .m4a`.flac"; done