Although I'm pretty sure that mp3.com just keeps around two sets of files, one high and one low, I believe I've encountered something recently that might do what you're wanting it to do.
My friend has a server that he keeps a dumpload of MP3s on, but he's all into friggin' huge (320kbps) bitrates, and I want 'em smaller so I can fit more onto one CD for my Rio Volt. We've been talking about making a nice MP3 serving system, and in searching for MP3-based modules, I found Apache::MP3::Resample by Lincoln Stein (author of the famous CGI module). I've included the description of the module here for your convenience.
Apache::MP3::Resample subclasses Apache::MP3::Playlist to allow the user to downsample MP3 files before streaming them. This allows users on slower connections to stream songs. When this module is installed, a menu of bitrates is presented in the upper left-hand corner of the screen. The user can choose from one of the bitrates, or select a mode that performs no resampling. The selected bitrate is maintained in a persistent cookie so that resampling is performed whenever the user returns to the site.
This module requires a command-line MP3 encoder to resample and reencode the MP3 sound data. If not otherwise specified, Apache::MP3::Resample will try to use the Open Source Lame MP3 encoder. This utility is available at http://www.sulaco.org/mp3. Version 3.87 was used during the development of this module. Your results with other versions may vary.
When you install Lame (or the encoder of your choice), be sure to place it in a directory located in Apache's PATH so that the module can find them at run time. You may need to set the PATH environment variable during Apache's launch, or by explicitly adding a SetEnv directive to the Apache configuration file.
You should be aware that the decoding/reencoding process is CPU-intensive, and server performance may degrade as the number of simultaneous users increases.
If my friend and I get this working, we'll letcha know. =)
~Brian | [reply] |
Cool Brian, Good luck also : )
| [reply] |
The two links would just link to separate files wouldn't they? One hi-fi, one lo-fi? Check the page source and see.
As a side note, changing the status bar with javascript is evil.
| [reply] |
Yeah I think your right (although its calling a cgi script)- but Im looking for a different solution. I what to store a high quality mp3 (or whatever works best) and allow the client to select the sample rate at which they download it, for real time listening...is that possible??
| [reply] |
It is (you'd want to store the original in a non-lossy format--WAV or something like that) but re-encoding on the fly's a rather CPU-intensive thing. Try, for chuckles, ripping a track off a CD to a WAV file. Encode it as an MP3 and note both how long it takes and how much CPU power it takes.
If you've only a few different bitrates that you're going to provide the track at, you may find it better to pre-encode the music. If you're not going to do that, you'd be well-served to cache the various bitrate formats of the MP3s, so you only need to encode them once, disk space generally being much cheaper than CPU time.
| [reply] |