Audio formats
Convert FLAC to AIFF for older CDJs without losing tags or artwork
Convert FLAC to AIFF for older CDJs with no loss in quality: when you need to, exact ffmpeg and XLD steps, and how to keep BPM, key and cover art.
10 min read
In short
- Convert FLAC to AIFF only when a player can't read FLAC, such as the original CDJ-2000, CDJ-2000nexus or CDJ-900, or when a hi-res file is above the player's sample-rate limit.
- FLAC to AIFF is lossless to lossless: decoded, the two files hold exactly the same samples, so you lose nothing as long as you keep the bit depth and sample rate.
- In ffmpeg, add
-write_id3v2 1or the AIFF has no tags at all, and-c:v copyor the JPEG cover is re-encoded as PNG. - ffmpeg writes FLAC's
BPMandINITIALKEYas custom frames, not theTBPMandTKEYframes DJ software reads, so map them across yourself (the script below does). - Keep your FLACs as the masters and treat the AIFFs as a copy for the stick, so you never convert twice or lose track of which file is current.
On this page10 sections
The short answer
FLAC and AIFF both store lossless audio. FLAC compresses it, the way a zip file does, and AIFF stores it uncompressed. Converting one to the other changes the container and the file size, not the sound: decode both and you get the same samples, bit for bit. So the conversion itself is safe. What goes wrong is everything around the audio: the tags, the cover art, and occasionally a sample rate the target player can't handle.
For most people the right tool is ffmpeg (free, on macOS, Windows and Linux) with four options that most online examples leave out. On a Mac, XLD is a free point-and-click alternative. Both are covered below, followed by a way to check the result before you take it to a gig.
When you actually need to convert
Every current Pioneer DJ / AlphaTheta and Denon DJ player reads FLAC, and so do rekordbox, Serato DJ Pro, Traktor Pro, VirtualDJ and Engine DJ. If your gear is from the last decade, you probably don't need AIFF at all. The full support table is in FLAC vs 320 MP3 vs WAV/AIFF for DJing. There are three cases where conversion is the fix:
| Situation | What happens | What to convert to |
|---|---|---|
| Original CDJ-2000, CDJ-2000nexus, CDJ-900 or CDJ-900nexus | FLAC doesn't appear or won't load; FLAC support arrived with the CDJ-2000NXS2 generation | AIFF at the same bit depth, 44.1 or 48 kHz |
| Hi-res FLAC (88.2 kHz or more) on a player limited to 48 kHz, such as the XDJ-RX3 | The track refuses to load | AIFF or FLAC at 44.1 or 48 kHz |
| A club whose players you don't know | Your FLAC-only stick may meet an older install | AIFF copies of the tracks you can't do without |
The manuals for the original CDJ-2000 and CDJ-900 list AIFF at 16 or 24 bits and 44.1 or 48 kHz. That makes 24-bit AIFF at 44.1 or 48 kHz the safest uncompressed format for older Pioneer players, which is why AIFF rather than WAV is the usual target: same audio, but tags that DJ software and players read reliably. If your player isn't listed here, look up its playable formats in its manual before converting anything.
What lossless to lossless means in practice
- Quality: identical. Converting FLAC to AIFF and back again any number of times never changes the audio, unlike converting between lossy formats.
- Size: larger. A 16-bit, 44.1 kHz AIFF is about 10 MB per minute of stereo audio, roughly one and a half to two times the FLAC, depending on the music. A 24-bit file is half as big again.
- Bit depth: keep it. A 24-bit FLAC should become a 24-bit AIFF. Reducing it to 16 bits is a real change to the audio, small but avoidable, and older Pioneer players accept 24-bit AIFF anyway.
- Sample rate: keep it unless the player can't take it. Resampling 96 kHz to 48 kHz is not lossless in the strict sense, but done with a good resampler it makes no audible difference on a club system.
- Tags: this is where conversions fail. FLAC stores tags as Vorbis comments; AIFF stores an ID3v2 tag in a chunk inside the file. A converter has to translate one into the other, field by field.
The field names differ between the two systems, which is the root of most lost BPM and key values. FLAC uses BPM and INITIALKEY; AIFF, like MP3, uses the ID3 frames TBPM and TKEY. ID3 tags for DJs covers the full mapping, including comments and grouping.
Converting with ffmpeg, step by step
Install ffmpeg first: on a Mac with Homebrew run brew install ffmpeg, on Linux use your package manager, and on Windows download a build linked from the ffmpeg download page. Then try it on one file:
One 24-bit file, tags and artwork keptffmpeg -i "track.flac" -map 0 -c:a pcm_s24be -c:v copy -write_id3v2 1 -id3v2_version 3 "track.aiff"What each option does, and why it is there:
-map 0includes every stream in the source, including the embedded cover image, which ffmpeg treats as a one-frame video stream.-c:a pcm_s24bewrites 24-bit big-endian PCM, the AIFF sample format. Usepcm_s16befor a 16-bit source. If you leave it out, ffmpeg writes 16-bit, which reduces a 24-bit file without telling you.-c:v copycopies the cover JPEG as it is. Without it, ffmpeg re-encodes the artwork as PNG, which players show less reliably.-write_id3v2 1turns on the ID3 tag. The AIFF muxer has it off by default, so without this option the file has audio and no tags at all.-id3v2_version 3writes ID3v2.3 rather than ffmpeg's default of v2.4. Version 2.3 is what DJ software and hardware read most consistently.
The details of the AIFF options are in the ffmpeg formats documentation. One thing the command above doesn't fix: ffmpeg copies BPM and INITIALKEY into custom TXXX frames named BPM and INITIALKEY, not into TBPM and TKEY. Some software reads those custom frames and most hardware doesn't, so set the standard frames explicitly.
A whole folder, with BPM and key mapped
This loop runs in Terminal on a Mac, in a Linux shell, or in WSL or Git Bash on Windows. Run it inside the folder of FLACs; it writes an AIFF beside each one, picks 16 or 24 bits to match the source, and skips any AIFF that already exists.
Batch convert, bashfor f in *.flac; do
bpm=$(ffprobe -v error -show_entries format_tags=BPM -of default=nw=1:nk=1 "$f")
key=$(ffprobe -v error -show_entries format_tags=INITIALKEY -of default=nw=1:nk=1 "$f")
bits=$(ffprobe -v error -select_streams a:0 -show_entries stream=bits_per_raw_sample -of default=nw=1:nk=1 "$f")
[ "$bits" = 16 ] && codec=pcm_s16be || codec=pcm_s24be
ffmpeg -n -i "$f" -map 0 -c:a "$codec" -c:v copy -write_id3v2 1 -id3v2_version 3 -metadata TBPM="$bpm" -metadata TKEY="$key" -metadata BPM= -metadata INITIALKEY= "${f%.flac}.aiff"
doneSetting BPM= and INITIALKEY= to nothing removes the duplicate custom frames, so each value exists once, in the frame players read. Tracks without a BPM or key simply come out without one.
Hi-res files for 48 kHz players
For a player with a 48 kHz ceiling, add a resample to the command. Go to 48 kHz from 96 or 192 kHz sources, and to 44.1 kHz from 88.2 or 176.4 kHz ones, so the ratio stays simple. The SoX resampler included in most ffmpeg builds is a good choice:
96 kHz FLAC to 48 kHz, 24-bit AIFFffmpeg -i "track.flac" -map 0 -af aresample=resampler=soxr -ar 48000 -c:a pcm_s24be -c:v copy -write_id3v2 1 -id3v2_version 3 "track.aiff"If your ffmpeg reports that soxr isn't available, drop the -af part and keep -ar 48000; the built-in resampler is fine for this job. In the batch loop, add the same options after -map 0.
Converting with XLD on a Mac
XLD (X Lossless Decoder) is a free macOS converter that reads FLAC and writes AIFF, with tags. It suits anyone who would rather not use Terminal.
- Open XLD's Preferences, and on the General tab set the output format to AIFF.
- Choose the output folder on the same tab. A separate folder, not the one holding your FLACs, keeps masters and copies apart.
- On the Metadata tab, tick the option to embed cover art images into files. If it is off, the AIFFs come out without artwork.
- Drag your FLAC files or a folder onto the XLD icon in the Dock, or use File → Open. XLD converts them with the settings above.
- Open a few results in a tag editor and check BPM, key and artwork before converting the rest (see below).
Menu names shift a little between XLD versions, so look for the equivalent options if yours differs. XLD keeps the source's bit depth and sample rate unless you set otherwise, which is what you want for a straight conversion.
Check the result before the gig
A conversion is only done when you have checked that the audio is intact and the tags arrived. Both checks take a minute.
- Audio: decode both files to the same format and compare checksums. If the two lines match, the audio is bit-identical.
- Tags: open a few AIFFs in a tag editor such as Kid3 or Mp3tag, or run
ffprobe -v error -show_entries format_tags "track.aiff", and confirm title, artist,TBPM,TKEYand genre are present. - Artwork: look at the cover in your DJ software after import. If it's missing, the cover stream wasn't copied.
- On the player: load one converted track on the oldest player you expect to meet, or on the same model, before you convert the whole library.
Compare the decoded audioffmpeg -v error -i "track.flac" -map 0:a -c:a pcm_s32le -f md5 -
ffmpeg -v error -i "track.aiff" -map 0:a -c:a pcm_s32le -f md5 -The checksum comparison doesn't apply to resampled files, which are different samples by design; for those, listen to the start and end of a few tracks and check the duration matches.
Common problems and fixes
- The AIFF has no tags at all. ffmpeg was run without
-write_id3v2 1. Convert again with it. - Title and artist are there, BPM and key aren't. The values went into custom
TXXXframes. Use the batch loop above, or copy the fields intoTBPMandTKEYin a tag editor. - The cover art is missing or shows in some apps only. Add
-map 0 -c:v copy, or tick XLD's embed cover art option. If artwork still shows inconsistently, resave the tags as ID3v2.3. - A 24-bit source became 16-bit. ffmpeg defaults to 16-bit PCM for AIFF. Set
-c:a pcm_s24be. - The player still won't load the file. Check the sample rate: anything above 48 kHz fails on older players. Also check the stick's file system and the export itself, covered in CDJ not reading your USB stick?.
- Your DJ software shows duplicates. The FLAC and the AIFF of the same track are both in its collection. Keep the AIFFs in a separate folder that only the stick-building workflow uses.
- Comments didn't carry over. Converters differ in how they map FLAC's
COMMENTfield. Check it in a tag editor and copy it into the ID3 comment field if it matters to you.
Keeping FLAC masters and AIFF copies
Don't replace your library with AIFFs. Keep the FLACs as masters, because they are smaller and verify their own integrity, and generate AIFF copies only for the sticks and the players that need them. When you retag a master or fix its BPM, regenerate the copy rather than editing both. The folder layout that makes this easy is in How to organise a DJ music library that still works in five years.
Scratch Storage fits the same pattern. It accepts FLAC and AIFF uploads, never transcodes them, and writes its BPM, key and genre analysis into the files as tags, so you can analyse the FLAC masters, convert them, and upload the AIFF copies for a stick built for older players. Its USB export then writes a rekordbox.xml for the CDJ workflow or plain folders those players can browse.
A practical recommendation
If your players are from the CDJ-2000NXS2 generation or newer, play FLAC and skip conversion. If you play older Pioneer gear, keep FLAC masters, convert a gig set to 24-bit AIFF at 44.1 or 48 kHz with the ffmpeg loop or XLD, check one file's checksum and tags, and test a track on the player before you trust the stick. Do the conversion once per track and keep the result, rather than converting again before every gig.
Questions, answered
- Does converting FLAC to AIFF lose quality?
- No, provided you keep the bit depth and sample rate. Both formats are lossless, so the decoded audio is bit-identical, which you can confirm with the checksum comparison above.
- Why is the AIFF so much bigger than the FLAC?
- AIFF stores audio uncompressed and FLAC compresses it without loss. Expect the AIFF to be roughly one and a half to two times the size, about 10 MB per minute for 16-bit, 44.1 kHz stereo.
- Can an original CDJ-2000 play FLAC?
- No. FLAC support arrived with the CDJ-2000NXS2. The original CDJ-2000 and the CDJ-2000nexus play MP3, AAC, WAV and AIFF, so convert FLAC to AIFF for them.
- Should I convert to AIFF or WAV?
- AIFF. The audio is the same, but AIFF's ID3 tags are read reliably by DJ software and players, while WAV tag support is inconsistent and some 24-bit WAVs won't load on CDJs.
- Should I convert 24-bit FLAC to 16-bit AIFF for older players?
- Usually not. Older Pioneer players such as the CDJ-2000 and CDJ-900 list 24-bit AIFF as supported, so keep 24 bits and only lower the sample rate if it is above 48 kHz.
- Why did my BPM and key disappear after converting with ffmpeg?
- ffmpeg copied them into custom TXXX frames rather than the TBPM and TKEY frames players read. Map them with
-metadata TBPM=and-metadata TKEY=, as the batch loop in this guide does.