<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

Apple Lossless Unix

From SqueezeboxWiki

Revision as of 15:19, 30 June 2010 by Soulkeeper (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SlimServer requires installation of an external codec to play Apple Lossless files on Unix machines.

Contents

Step 1 - Install the codec

There are two choices: install the standalone ALAC binary or install mplayer which will handle Apple Lossless, AAC, and provide decoding support for many streaming radio formats including Real and the BBC.

Standalone ALAC

You'll need to compile alac and place it in /usr/local/slimserver/server/Bin/i386-linux (or replace /usr/local/slimserver with where ever SlimServer is installed. As well as i386-linux with whatever arch you are on.)

You can download the source for alac here: http://craz.net/programs/itunes/alac.html

Compiling it is (very) easy, just type make and you have a binary.

mplayer

mplayer includes the ALAC decoder, a customized FAAD2 library, as well as additional capabilities. http://www.mplayerhq.hu hosts source tarballs as well as .rpms for both the main player and separately installed codecs. Debian packages are available via a third-party maintainer. Mplayer can be compiled for the PPC architecture as well. The most recent release is 1.0RC1. Many repositories will have earlier versions which also work.

ffmpeg

ffmpeg in its free version contains everything needed to decode ALAC. It can be found in every good distribution packages system.

In particular, http://packages.debian.org/ffmpeg packages (from main section) are OK.

Step 2 - Configure SlimServer to use new codec for ALAC.

SlimServer reads convert.conf to determine how to handle various file formats for decoding/transcoding/streaming to the Squeezebox. Create a new custom-convert.conf file to add support for new formats/transports. Convert.conf is usually found in /usr/local/slimserver/server – unless you installed SlimServer elsewhere).

Recommendations for ALAC decoder:

There are probably only 3 conversion sets you would want to change:

(comment out the originals with #s like below, and add the uncommented lines):

#mov mp3 * *#       [mov123] $FILE$ | [lame] --resample 44100 --silent -q $QUALITY$ -b $BITRATE$ -r - -mov mp3 * *        [alac] -r $FILE$ | [lame] --resample 44100 --silent -q $QUALITY$ -b $BITRATE$ -r -x - -#mov flc * *#       [mov123] $FILE$ | [flac] -cs --totally-silent --compression-level-0 --endian big --sign signed --channels 2 --bps 16 --sample-rate 44100 -mov flc * *        [alac] -r $FILE$ | [flac] -cs --totally-silent --compression-level-0 --endian big --sign signed --channels 2 --bps 16 --sample-rate 44100 -#mov aif * *#       [mov123] $FILE$mov wav * *        [alac] -r $FILE$

Note that with a Squeezebox2 I had to remove the '-r' flag from the "mov flc" entry otherwise I just got white noise. The revised entry is shown below:

mov flc * *        [alac] $FILE$ | [flac] -cs --totally-silent --compression-level-0 --endian big --sign signed --channels 2 --bps 16 --sample-rate 44100 -

This is probably related to native flac support on the Squeezebox2+.

Recommendations for mplayer

alc wav * *       [mplayer] -novideo -ao pcm:file=/dev/fd/4 $FILE$ 4>&1 1>/dev/null

Similar commands can be used to transcode alac to mp3 if LAME is installed.

NOTE: if using mplayer for AAC and ALAC decoding, you will need the command above and

mov wav * *      [mplayer] -novideo -ao pcm:file=/dev/fd/4 $FILE$ 4>&1 1>/dev/null

NOTE: If you hear a clicking noise when playback starts use the following mplayer options:

[mplayer] -novideo -ao pcm:nowaveheader:file=/dev/fd/4 $FILE$ 4>&1 1>/dev/null

Search forums for more on mplayer settings.

Note about Slimserver 6.3

Slimserver 6.3 and earlier were unable to differentiate between ALAC and AAC files. In these cases, use mplayer with only the single mov wav line for play both ALAC and AAC files.

ffmpeg

These are the possibilities you have:

  • conversion to WAV (uncompressed audio, thus needs high bandwidth)
# Conversion to WAV
alc wav * *       [ffmpeg] -i $FILE$ -f wav -mov wav * *       [ffmpeg] -i $FILE$ -f wav -
  • conversion to FLAC (lossless too. Needs CPU time decompressing m4a and compressing back to FLAC, but allows native decoding on the Squeezebox)
# Conversion to FLAC
alc flc * *       [ffmpeg] -i $FILE$ -f flac -mov flc * *       [ffmpeg] -i $FILE$ -f flac -
# Conversion to MP3
alc mp3 * *       [ffmpeg] -i $FILE$ -ab $BITRATE$ -f mp3 -mov mp3 * *       [ffmpeg] -i $FILE$ -ab $BITRATE$ -f mp3 -