PDA

View Full Version : understanding LAME



Dpfels
2007-10-24, 06:48
Hi,
I have had a squeezebox for a while, but I am clearly not taking advantage of all of its features. I am hoping for some pointers on how to do things a bit better.
Currently, I have Slimserver running on an Olive Musica (HiFidelio). This is a Linux box that rips and stores my CDs, mostly in FLAC format. At the same time, I have an MP3 library stored in iTunes on a separate PC running WinXP SP2.

Over time, I have neglected the iTunes library, since I do most of my listening on the Musica, or on the linked Squeezebox. However, there is also music in the iTunes library in MP3 that I do not have on the Musica. In short, there are files on each server that are not represented on the other.

Ideally, I would like to have both libraries served up in a format that can be recognized by either iTunes or Squeezebox. I gather that LAME should permit me to transcode the FLAC files on the fly, turning them into MP3s that iTunes can recognize (even if they can't be loaded onto an iPod). However, when I look at the LAME settings, there seems to be a choice of either FLAC->FLAC or FLAC->MP3.

This leaves me with a couple of questions:
1. Is it possible to set up LAME so that FLAC files are presented as MP3 only for iTunes (while serving FLAC as FLAC to the Slimserver?)

2. Is there software that will run on either the Linux box that will copy/transcode my FLAC library into the iTunes library? If it can keep these two libraries in sync, that would be even better.

Thanks!
Dan

Mark Lanctot
2007-10-24, 06:59
The LAME transcoding in SlimServer is done in real-time, i.e. while streaming. The files always remain as FLAC - iTunes will never see them.

In order for iTunes to see them, you need to convert the files and store MP3 copies. LAME can do this but only one at a time. Look for batch tools like flac2mp3, which also syncs.

Dpfels
2007-10-24, 07:58
Thanks.
From what I gather-by streaming you mean a music stream that is controled by the Slimserver software and which can be played by logging into the appropriate port of the Slimserver?
My understanding is that there is no way to directly access the FLAC files from iTunes but have them played as MP3?

Finally, does LAME only control streamed music? Will my Squeezebox still access the FLAC files, or will they be transcoded as well?
Thanks,
Dan

Dpfels
2007-10-24, 08:04
Also, as a side issue, when I activate the FLAC->MP3 conversion under "File Types", I get the following error:

Required binary was not found: [flac] -dcs --skip=$START$ --until=$END$ -- $FILE$ | [lame] --resample 44100 --silent -q $QUALITY$ --abr $BITRATE$ - -

Am I missing something?
Thanks.

Mark Lanctot
2007-10-24, 08:09
Thanks.
From what I gather-by streaming you mean a music stream that is controled by the Slimserver software and which can be played by logging into the appropriate port of the Slimserver?

Yes.


My understanding is that there is no way to directly access the FLAC files from iTunes but have them played as MP3?

Not sure what you mean here. iTunes cannot access FLAC files. The FLAC files can be played as MP3 with SlimServer, but only while you are playing them. It's a real-time process, no MP3 file is created that iTunes will be able to see. SlimServer uses LAME to construct an MP3 stream on-the-fly as opposed to actually creating a file.


Finally, does LAME only control streamed music?

Again, not quite sure what you mean. LAME is an MP3 encoder. It takes WAV files and makes MP3 files out of them. It can do this by constructing files (which is what you want) or it can do this real-time, on-the-fly, making a stream (this is what SlimServer does, this is NOT what you want).


Will my Squeezebox still access the FLAC files, or will they be transcoded as well?

You have me thoroughly confused. The FLAC files are never altered. SlimServer will always be able to access them. It can, however, stream (rather than convert) the files to MP3.

If you are referring to the flac2mp3 script I mentioned, yes, the original FLAC files are retained.

Mark Lanctot
2007-10-24, 08:12
Also, as a side issue, when I activate the FLAC->MP3 conversion under "File Types", I get the following error:

Required binary was not found: [flac] -dcs --skip=$START$ --until=$END$ -- $FILE$ | [lame] --resample 44100 --silent -q $QUALITY$ --abr $BITRATE$ - -

Am I missing something?
Thanks.

Looks like you don't have LAME installed in a location SlimServer can see it. Go to Player Settings - Audio - Bitrate Limiting. Does it mention that LAME is properly installed?

Mine's in /usr/bin.

Dpfels
2007-10-24, 08:31
Let me see if I can explain myself a bit better.
I understand that music can be served up from the Slimserver in two ways:
1. A Squeezebox can log in and pull music over.
2. The Slimserver can be controlled directly to allow it to "push" music.

As far as I can tell the "pushed" music can be directed at a particular Squeezebox or it can be read as a stream by any device that can recognize it (including iTunes on a Mac or PC).

Assuming that 1 and 2 are distinct processes (pushing vs pulling files), then am I correct in my understanding that the Squeezebox will be "pulling" FLAC files and decoding them locally?

Additionally, if I stream music, will that automatically be converted to MP3?

My main concern is that the Squeezebox will also receive MP3 files, which I do not want. What I like about the Squeezebox is its ability to decode FLAC locally, allowing me to play uncompressed files that have not lost any information.

If I am still not making sense, please let me know.
I appreciate your help.
Best,
Dan

Dpfels
2007-10-24, 08:44
I had a look. I clearly don't have LAME installed.
For a novice, can I ask: is there way to get a copy of LAME that is already compiled? I will need it for a Mac and a Linux machine.
I found one older version for Mac (3.9.1). The problem is that I don't know where to install it to make it available for Slimserver.
/usr/bin is not the same on the Mac, I think.

Thanks,
Dan

Mark Lanctot
2007-10-24, 08:58
Let me see if I can explain myself a bit better.
I understand that music can be served up from the Slimserver in two ways:
1. A Squeezebox can log in and pull music over.
2. The Slimserver can be controlled directly to allow it to "push" music.

As far as I can tell the "pushed" music can be directed at a particular Squeezebox or it can be read as a stream by any device that can recognize it (including iTunes on a Mac or PC).

Actually it's really all one process. SlimServer does everything. The SB is merely sending along commands to SlimServer, SlimServer does all the work. The SB doesn't even really have the smarts to "log in", it can be considered a dumb terminal for SlimServer.

SlimServer can be controlled from the web interface, yes, but the same process is going on.


Assuming that 1 and 2 are distinct processes (pushing vs pulling files), then am I correct in my understanding that the Squeezebox will be "pulling" FLAC files and decoding them locally?

Again, it's the same process, and it's more like "pushing". The Squeezebox isn't doing much of anything, SlimServer is breaking the FLAC file up into networking packets and sending it to the SB, the SB merely stores the packets in its buffer and plays them out at the appropriate speed.


Additionally, if I stream music, will that automatically be converted to MP3?

Only if you tell it to by the Bitrate Limiting setting I mentioned above. If you keep Server Settings - File Types - FLAC - FLAC (built-in) checked it won't transcode unless you also have FLAC - MP3 checked and activate Bitrate Limiting or if you uncheck FLAC - FLAC (built-in).

Note Bitrate Limiting is set per-player, so you can have each player behave differently. Software players using stream.mp3 automatically use bitrate limiting, SlimServer-specific software players like SoftSqueeze and squeezeslave behave just like the hardware players.


My main concern is that the Squeezebox will also receive MP3 files, which I do not want. What I like about the Squeezebox is its ability to decode FLAC locally, allowing me to play uncompressed files that have not lost any information.

Yes, provided the player settings are OK, you can have the SB play FLAC files as FLAC files and send FLAC transcoded to MP3 to other players.

Just keep in mind it's a transcoded stream. No MP3 file is created that iTunes can use, although iTunes can tune into the MP3 stream by pointing it to http://<SlimServer IP>:9000/stream.mp3

Mark Lanctot
2007-10-24, 09:00
I had a look. I clearly don't have LAME installed.
For a novice, can I ask: is there way to get a copy of LAME that is already compiled? I will need it for a Mac and a Linux machine.
I found one older version for Mac (3.9.1). The problem is that I don't know where to install it to make it available for Slimserver.
/usr/bin is not the same on the Mac, I think.

Don't know too much about Macs. My copy of LAME came with my Linux distro (Ubuntu 7.04) and can be installed from the Ubuntu repository too.

You can get precompiled LAME for Mac here: http://www.rarewares.org/mp3-lame-bundle.php

For Linux, it usually comes preinstalled. You could get it from the distro resources (repositories, precompiled .deb or RPM files).

Dpfels
2007-10-24, 09:27
Thanks for the replies. They were a big help. I suspected that Slimserver was essentially pushing packets to what ever target requested them.
It is also a big help to know that the MP3 streaming will behave as an independent client from the SB, allowing me to set bitrates and conversion independently.

I will try it and see how it goes.

As for converting files to MP3 (rather than streaming), I just received a new Qnap TS-109, which I plan to set up with both my MP3s and FLAC files.
Now I just need to work out a way to keep the files organized that allows me to handle the higher bandwidth version of each file when serving via Slimserver but deliver MP3s to iTunes for the sake of transferring to an iPod.

It's a nice challenge.

Thanks again!
Dan

pfarrell
2007-10-24, 09:41
Dpfels wrote:
> Now I just need to work out a way to keep the files organized that
> allows me to handle the higher bandwidth version of each file when
> serving via Slimserver but deliver MP3s to iTunes for the sake of
> transferring to an iPod.

With a little bit of spare disk space, you could just use flac2mp3
periodically to make MP3 copies of all your tunes, and get them direct.


--
Pat Farrell
http://www.pfarrell.com/

Dpfels
2007-10-25, 08:24
That is probably the way I will go, but I was hoping for something a bit more transparent,that does not require my ongoing attention.
I am the major user of the FLAC files, but the rest of my family relies on MP3s served up via iTunes.

Also, I have some tracks that are MP3 only, which I want available to both systems. I am thinking about trying to implement something using MP3FS:
http://mp3fs.sourceforge.net/

The idea would be to have my FLAC files appear as MP3's which I could then sync directly into the iTunes library.

Has anyone tried this? As has been suggested elsewhere (perhaps not on this forum-I can't remember), the Qnap TS-109pro might not have the power to run MP3FS.

Dan

Mark Lanctot
2007-10-25, 08:30
mp3fs sounds very cool, and it would seem that iTunes could use it because mp3fs would "present" FLAC files to iTunes as MP3s.

But it will require a fair amount of processor power.

Dpfels
2007-10-25, 08:41
Processing speed may be a problem. However, I need this for only one application, which is the transferring of MP3's to the iPod. For everything else, I can use LAME to stream the files to iTunes.

Even if this slows down the loading of the MP3s into a player by a bit as they are converted, that would be OK.

The problems come up if someone else is logged in and listening to FLAC files via Slimserver at the same time.

Dan