Overview
I frequently listen to music in our cars. Having purchased upgraded entertainment systems for our cars, it only makes sense to listen to my music in lossless format. Over the years, I have ripped all my CDs to Apple Lossless format, stored in iTunes on my Mac. With 128 and 256GB thumb drives available for $30-60, you can now export your entire CD collection to a thumb drive and listen to it in your BMW with no loss of audio fidelity. Not only does this save space on your iPhone but it also permits you to listen to lossless audio collections that are larger than your iPhone storage. So, the challenge is how to get the music from my iTunes collection to my car via USB thumbdrive, in a lossless format with full metadata including album artwork.
Embedding Your Album Artwork
Before exporting, you should use the Library > Get Album Artwork to download album artwork for your iTunes collection. This artwork is stored separate from your music files. So you must then embed your album artwork within your music files. I recommend using Dougscript‘s Re-Embed Artwork, which is compatible with iTunes 12.6 and Mac 10.13 (“High Sierra”).
Exporting Your Music from iTunes
Next, you need to transfer your audio files from iTunes.
iTunes Smart Playlist for Your Rated Lossless Music
Before doing so, you likely will wish to create a smart playlist within iTunes that limits which tracks will be exported. I created a “Rated Lossless” smart playlist that matches music for all of the following rules:
- Media Kind is Music
- Kind contains Lossless
- Rating is greater than **
- You may also wish to exclude certain tracks, for example music or language lessons if you previously ripped those to lossless format.
Exporting from iTunes
I recommend using Export for iTunes to export your Rated Lossless playlist from iTunes. Make sure that you select the following export options:
- Export checked content
- Export only files
- Do not convert to either MP3 or AAC
- Under advanced, save music files to a playlist folder; remove hidden Mac files; skip existing files; do not convert files with the same format as conversion output; and do not convert lossy formats.
Transcoding Your Apple Lossless Files to Another Lossless Format
Export for iTunes does a great job of exporting your iTunes collection to a USB stick but it assumes either:
- that you wish to transcode your music collection to a lossy format like MP3 or AAC, or
- that your music player can play Apple Lossless format.
I did extensive testing on my BMW and Honda and found the following:
- The 2015 BMW X5 (NBT version of iDrive) can read lossy audio formats like MP3 and AAC in native and M4A/MP4 containers. BMW can see but not play Apple Lossless audio within an M4A container. BMW can play FLAC format in a native container and can see and play the same within an MKV container (but can’t read MKV metadata properly).
- The 2016 Honda Odyssey can only play lossy formats like MP3 and AAC
From this, two conclusions are drawn:
- BMW: you need to transcode Apple Lossless audio files to native FLAC format to play them.
- Honda: there is no point in trying to encode in a lossless format.
The following BASH script with the included FFMPEG settings will create a readable lossless audio file with all metadata on the BMW. The remove tag functions are optional but clean up cruft in your metadata that you may have accumulated over the years. I don’t recommend using ffmpeg’s audio filters like extrastereo because they don’t work well with the BMW’s matrix audio decoding.
#!/bin/bash
sourcedirectory="/Users/[username]/Encodes/alac/Rated Lossless"
encodedirectory="/Users/[username]/Encodes/flac/"
cd "$sourcedirectory"
for v in *
do
echo $v
filename="${v##*/}"
caffeinate -i ffmpeg -i "$v" \
-c:v png \
-c:a flac -sample_fmt s16 -ar 44100 \
"$encodedirectory/${filename%.*}.flac"
metaflac --remove-tag ITUNNORM \
--remove-tag ITUNES_CDDB_IDS \
--remove-tag album_artist \
--remove-tag GAPLESS_PLAYBACK \
--remove-tag ENCODER \
--remove-tag LYRICS \
--remove-tag COMPILATION \
--remove-tag COMPOSER \
--remove-tag disc \
--remove-tag MUSICBRAINZ_TRMID \
--remove-tag MUSICBRAINZ_TRACKID \
--remove-tag MUSICBRAINZ_ALBUMID \
--remove-tag MUSICBRAINZ_SORTNAME \
--remove-tag MUSICBRAINZ_ARTISTID \
--add-replay-gain \
"$encodedirectory/${filename%.*}.flac"
done
Transferring Your Music to a USB Thumbdrive
After transcoding all those files, I use a simple script to transfer them to a USB thumbdrive. That way, if the file transfer is interrupted, then you can simply restart the script and it will copy any remaining files. In this case, it is assumed that you named your USB thumbdrive, “Music“, which mounts on the Mac as /Volumes/MUSIC/’. I am not positive that the BMW can use replaygain tags volume normalization but it doesn’t hurt to add them.
#!/bin/bash
caffeinate -i rsync -ravtz --size-only --progress --delete '/Users/[username]/Encodes/flac/' '/Volumes/MUSIC/'
rm '/Volumes/MUSIC/input.flac'
rm '/Volumes/MUSIC/output.flac'
Updated on June 9th, 2018