I have a reasonable sized music collection that I keep in FLAC format on my Ubuntu laptop. I'd like to start playing this music on my Mac, and to sync it from there to my iPod. People have suggested that the best way to do this is to convert my collection to ALAC, and I've decided that's what I want to do.
Before I dive in and write custom shell scripts that call ffmpeg
through some complex find
command, I thought I'd ask for advice.
How can I best convert my existing FLAC collection to ALAC, without any loss of audio quality and preserving all of the metadata?
avconv (or ffmpeg, which avconv is a fork of) can do this from the command line:
It should preserve the metadata by itself.
To do every flac in a directory:
To do every flac recursively (in the current directory and all sub-directories):
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:Note that deleting files with rm is irreversible (outside of forensic data recovery), so be careful using it.