avconv (or ffmpeg, which avconv is a fork of) can do this from the command line:
avconv -i input.flac -c:a alac output.m4a
It should preserve the metadata by itself.
To do every flac in a directory:
for f in ./*.flac; do avconv -i "$f" -c:a alac "${f%.*}.m4a"; done
To do every flac recursively (in the current directory and all sub-directories):
shopt -s globstar
for f in ./**/*.flac; do avconv -i "$f" -c:a alac "${f%.*}.m4a"; done
If you've got the flacs in ogg files or something, obviously change ./*.flac
to ./*.ogg
.
I think this should work with avconv/ffmpeg from the repositories (since ALAC is released under the Apache license, and can be legally distributed), though I have the version from medibuntu installed.
If you want to get rid of the original files, you can put rm
into the loop. This version uses the -n
flag for avconv, so it will not overwrite any already-existing ALAC files, and using &&
instead of ;
means that if avconv stops with an error then the original FLAC file will not be deleted:
for f in ./*.flac; do avconv -n -i "$f" -c:a alac "${f%.*}.m4a" && rm "$f"; done
Note that deleting files with rm is irreversible (outside of forensic data recovery), so be careful using it.
Following Toon's Unix Recipes, for example (and the above examples):
sudo apt-get install ffmpeg
ffmpeg -i track1.aiff -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 track1.mp3
(Older versions of Ubuntu can use avconv
instead of ffmpeg
.)
Best Answer
Best way under Trusty Tahr or Xenial Xerus is to use the Monkey's Audio Console Front End of Matthew T. Ashland. mc3man holds a package in his PPAs for either Trusty or Xenial. Add the required PPA and install this application as follows:
1. Installation for Trusty Tahr
Use the following commands from a Terminal window to add this PPA and install the monkeys-audio package:
2.Installation for Xenial Xerus
Use the following commands from a Terminal window to add this PPA and install the monkeys-audio package:
3. Usage
Installation instructions are fairly basic and can be seen by running
mac -h
. For a single file the following would work well:And for a collection of wav files the following loop would also work quite nicely:
And now enjoy your Monkey's Audio music :).
References: