View Full Version : unable to stream flac from flac source

2010-10-17, 05:47

How can SqueezeCenter be persuaded to stream flac source as flac? It insists on streaming it as wav. (Details below.)



If I comment out the
flc wav * *
section in /opt/share/squeezecenter/convert.conf,
or disable flac-to-wav conversion in SqueezeCenter->Settings->Advanced->File Types,
it says it "couldn't create command line for flc playback"
in /home/slimserver/squeezecenter.log, and won't play
(while flac-to-flac is enabled as "Native".)

The source file:

Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:39:19.29 = 104044836 samples = 176947 CDDA sectors
Sample Encoding: 16-bit FLAC

When flac-to-wav conversion is enabled, the command that's executed during streaming is
/opt/bin/flac -dcs --force-raw-format --endian=little--sign=signed --skip=25:04.57 --until=35:19.16 -- /shares/Public/Shared Music/my.flac
which means it does indeed convert it to wav.


SqueezeCenter Status
Version: 7.3.3 - 27044 @ Mon Jun 15 15:04:06 PDT 2009
Hostname: raid1
Server IP Address:
Server HTTP Port Number: 9001
Operating system: Linux - EN - iso-8859-1
Platform Architecture: arm-none-linux-gnueabi
Perl Version: 5.10.0 - arm-none-linux-gnueabi
MySQL Version: 4.1.22
Total Players Recognized: 1

Player Model: receiver
Firmware: 62

2010-10-18, 15:28
Apparently, convert.conf is only read in once, when squeezecenter is started. After a restart, squeezecenter can now stream flac as flac; however, it still transcodes it as for some reason it picks

flc flc transcode *
# FT:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=-r %d}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 $RESAMPLE$ -

instead of

flc flc * *

from convert.conf.

This means that flac is converted to wav, which in turn is converted back to flac. I would've thought squeezebox could play 16-bit 44100 Hz flac files straight...

Anyway, the two processes take ~15% of the CPU (flac 5%, sox 10%) on my Western Digital My Book WE II NAS. It's not a lot if they're really necessary, but probably they're not.

BTW, I've also tried to stream mp3 by converting flac-->wav-->mp3 on the fly (with flac|lame). While mp3 takes much less bandwidth to stream, 'lame' is a veritable CPU hog. However slim slimserver may be, it does get squeezed out of the box by lame's 80-90% CPU usage, and as a result the player keeps rebuffering.

2010-10-18, 19:29
39 minute track, or is that an entire album? Flac files that are multiple tracks broken up by CUE sheets have to be transcoded at the server so that the individual track can be lifted from the larger file using the start and end points. FLAC files that are single tracks don't have to be transcoded.

You shouldn't need to touch convert.conf. By default Flac will be streamed as Flac to any player that can play Flac (all but the SliMP3 and the original Squeezebox). The place where you would normally switch it to stream as WAV (actually PCM) is in Settings > Advanced > File Types, by switching the FLAC->FLAC setting from 'Native' to 'Disabled'. No need to restart the server after making changes here.

2010-10-18, 20:29
If you _are_ using albums encoded as single files with CUE sheets, but don't think you'll ever need resampling, you can avoid SOX. You can even use Flac's ability to transcode Flac files directly to Flac, so you would have only one Flac process running.

If you want to make changes to the file conversion settings the best thing to do is leave convert.conf in its original form and change anything you need by creating a custom-convert.conf file. Custom-convert.conf lets you add to or override any settings in convert.conf.

I just tested each of the following and they both work.

This will launch two Flac processes:

flc flc transcode *
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] --decode --stdout --totally-silent $START$ $END$ -- $FILE$ | [flac] --stdout --totally-silent --compression-level-0 -

This transcodes on the fly, so it uses just one Flac process:

flc flc transcode *
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] --stdout --totally-silent $START$ $END$ -- $FILE$