Sep 05

Serve your FLAC and OGG files to iTunes with Firefly

The Firefly Media Server is a killer app for serving your music collection to DAAP-compatible music clients (including iTunes for Mac/Windows and Rhythmbox for Linux). One of it's features that might go unnoticed is its ability to transcode OGG and FLAC compressed files to raw uncompressed sound, bypassing iTunes's incompatibility with those formats.

Getting Started

The current stable Firefly release, version 0.2.4.2, does not scan FLAC metadata, so the resulting database contains "Unknown" for all the artist and song columns. For this reason, we will compile an unstable build, SVN revision 1586. I initially had problems setting up the nightly builds on Ubuntu 9.04, so until a newer version is released that fixes these problems, we will use Ubuntu 8.04. I am using an Ubuntu 8.04 virtual machine that runs under an Ubuntu 9.04 host. My music collection is mounted in the virtual machine using SSHFS.

Mounting your Music Collection

If you are using a virtual machine as I am, you will need to mount your music collection from the host operating system. There are a few options (SSHFS, NFS, Samba...) but we will use SSHFS. To install, run:

sudo aptitude install sshfs

and you will be able to mount your music using a command such as:

sshfs hostos:/media/storage/music /mnt/music

Installing Build Dependencies

Firefly needs a number of packages to compile from source. This should cover all of them:

sudo aptitude install g++ libsqlite3-dev libid3tag0-dev libvorbis-dev libflac-dev flac

Downloading and Compiling Firefly

Nightly Subversion builds can be obtained here.

We will fetch the svn-1586 release and untar it:

wget http://nightlies.fireflymediaserver.org/nightlies/svn-1586/mt-daapd-svn-1586.tar.gz
tar -xvzf mt-daapd-svn-1586.tar.gz

Enter the mt-daapd directory and compile:

cd mt-daapd-svn-1586/
./configure --enable-flac --enable-ogg --enable-sqlite3
make
sudo make install

If you get hung up in the configure step, you are most likely missing a dependency. Please let me know so I can update this article if this happens.

Configuration

After everything is compiled and installed, you will need to configure Firefly. There is an example configuration file in the contrib directory of the mt-daapd tarball. Copy this to /usr/local/etc/:

sudo cp ./contrib/mt-daapd.conf /usr/local/etc/

Edit the file to prepare mt-daapd for first run. For mine, I changed db_type to sqlite3, mp3_dir to my root music directory (such as /mnt/music), servername to whatever you want, and I added the .flac and .ogg extensions to the extentions list. You might also need to change the "runas" configuration. The most important thing to watch here is that the user has read access to the music directory.

After you've modified the configuration file, you can try running Firefly. We will run in foreground mode (with -f) to watch for error messages:

sudo mt-daapd -f

If everything went well, you can now load the web interface, located at http://localhost:3689/. The username is "admin" and the default password is "mt-daapd" (unless changed in the configuration file). Click "Start Scan" and it will begin indexing your music files. This can take awhile depending on the size of your music collection. Once it's finished, start up iTunes or Rhythmbox on any computer on the network and you should see your full music collection, ready to play.