Streaming Subsonic in higher quality at lower bitrates on Vortexbox

My primary music library is in lossless FLAC format, which Subsonic, by default, transcodes to mp3 for streaming to PC’s and mobile devices.

I’ve always used a two-step transcode for this as FFmpeg doesn’t always handle FLAC files as well as other formats, which can result in streaming problems.

You can use FLAC in step 1 to decode the initial stream and pipe it to stdout: –

flac --silent --decode --stdout %s

This can be followed by lame to read from stdin and transcode to mp3: –

lame --silent -h -b %b -

I recently discovered the Fraunhofer FDK-AAC codec that Google have open sourced as part of Android.

Here’s what FFmpeg say about the fdk-aac codec: –


The Fraunhofer FDK AAC codec library. This is currently the highest-quality AAC encoder available with ffmpeg. Requires ffmpeg to be configured with --enable-libfdk-aac (and additionally --enable-nonfree if you’re also using --enable-gpl). But beware, it defaults to a low-pass filter of around 14kHz ( details). If you want to preserve higher frequencies, use -cutoff 18000. Adjust the number to the upper frequency limit you prefer, keeping in mind that a higher limit may audibly reduce the overall quality.


This codec can be enabled in FFmpeg, but usually requires re-compiling from source, I found a simple script on github that made that dead easy on Fedora (the distro used by Vortexbox): –

Once this script has finished you will have a new version of FFmpeg compiled and located in /usr/local/bin

Subsonic does not use the system FFmpeg, it has its own stored in /var/subsonic/transcode

From this path, move or delete the existing FFmpeg binary and symlink to the newly compiled version: –

cd /var/subsonic/transcode

ln -s /usr/local/bin/ffmpeg .

ls -al

[root@vortexbox transcode]# ls -al
total 376
drwxr-xr-x 2 subsonic root   4096 Aug 28 08:57 .
drwxr-x--- 8 subsonic root   4096 Aug 27 19:04 ..
lrwxrwxrwx 1 root     root     21 Aug 27 19:38 ffmpeg -> /usr/local/bin/ffmpeg
lrwxrwxrwx 1 root     root     13 Aug 28 08:57 flac -> /usr/bin/flac
-rwxr-xr-x 1 subsonic root 372787 Apr 30 13:04 lame

All that remains to do now is to set up subsonic to transcode to aac, instead of mp3: –

Name: aac audio

Convert from: flac

Convert to: m4a

Step 1: flac --silent --decode --stdout %s

Step 2: ffmpeg -i pipe:0 -vn -map 0:0 -c:a libfdk_aac -b:a %bk -cutoff 16000 -f adts -



Save the settings and you should be ready to go, you will notice that mobile devices will now show flac > m4a as the transcoding settings: –


You can experiment with settings and bitrate, but overall aac should allow you to use lower bitrates for the same perceived quality, improving streaming efficiency and reducing bandwidth use. Bitrate can be adjusted on a per-user basis within Subsonic’s settings.

You may also wish to experiment with the low-pass filter option too (-cutoff), by default there’s a 14kHz filter, reducing high frequency content, to allow more bits for the lower frequency sounds, but depending upon your ears and your music content this can be adjusted using FFmpeg’s -cutoff switch: –

-cutoff 16000 (filter sounds above 16kHz)

-cutoff 18000 (filter sounds above 18kHz)

Have fun, let me know what settings you settle on, I’m still experimenting here.

This entry was posted in Android, Google, Linux, Music, Streaming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *