Mp3HTTPD ![[Leave a comment]](/gfx/comment.gif)
Mp3HTTPD is a tiny special purpose HTTP server for MP3 streaming. Technically, it is slightly modified version of NanoHTTPD that translates on the fly file references in .M3U playlist files to HTTP-URLs.
This effectively makes Winamp and other players that support .M3U files and HTTP streaming behave correctly when you click a playlist.
Use OGG Vorbis instead of MP3!
The MP3 format is proprietary and patented. Making your own MP3 files with free software is thus illegal in many countries. There's a viable free alternative, however: OGG Vorbis. It's not patented and provides better sound quality than MP3. And in case you use Windows: Winamp can play .ogg files, too. Ok, back to the original business..
Screenshot:
M3U translation example:
On the hard disk:
#EXTINF:294,Michael Jackson - Billie Jean 01 - Billie Jean.mp3 #EXTINF:297,Michael Jackson - The way you make me feel 02 - The way you make me feel.mp3 #EXTINF:255,Michael Jackson - Black or white 03 - Black or white.mp3 #EXTINF:220,Michael Jackson - Rock with you 04 - Rock with you.mp3 #EXTINF:218,Michael Jackson - She`s out of my life 05 - She`s out of my life.mp3 #EXTINF:247,Michael Jackson - Bad 06 - Bad.mp3 07 - I just can`t stop loving you.mp3 08 - Man in the mirror.mp3 09 - Thriller.mp3 10 - Beat it.mp3 11 - The girl is mine.mp3 12 - Remember the time.mp3 13 - Don't stop till you get enough.mp3 14 - Wanna be startin` somethin`.mp3 15 - Heal the world.mp3</font></pre>Seen by the player when you click the file in web browser:
#EXTM3U #EXTINF:294,Michael Jackson - Billie Jean http://192.168.0.53:80/Michael%20Jackson/History%20CD1/01%20-%20Billie%20Jean.mp3 #EXTINF:297,Michael Jackson - The way you make me feel http://192.168.0.53:80/Michael%20Jackson/History%20CD1/02%20-%20The%20way%20you%20make%20me%20feel.mp3 #EXTINF:255,Michael Jackson - Black or white http://192.168.0.53:80/Michael%20Jackson/History%20CD1/03%20-%20Black%20or%20white.mp3 #EXTINF:220,Michael Jackson - Rock with you http://192.168.0.53:80/Michael%20Jackson/History%20CD1/04%20-%20Rock%20with%20you.mp3 #EXTINF:218,Michael Jackson - She`s out of my life http://192.168.0.53:80/Michael%20Jackson/History%20CD1/05%20-%20She%60s%20out%20of%20my%20life.mp3 #EXTINF:247,Michael Jackson - Bad http://192.168.0.53:80/Michael%20Jackson/History%20CD1/06%20-%20Bad.mp3 #EXTINF:-1,07 - I just can`t stop loving you.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/07%20-%20I%20just%20can%60t%20stop%20loving%20you.mp3 #EXTINF:-1,08 - Man in the mirror.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/08%20-%20Man%20in%20the%20mirror.mp3 #EXTINF:-1,09 - Thriller.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/09%20-%20Thriller.mp3 #EXTINF:-1,10 - Beat it.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/10%20-%20Beat%20it.mp3 #EXTINF:-1,11 - The girl is mine.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/11%20-%20The%20girl%20is%20mine.mp3 #EXTINF:-1,12 - Remember the time.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/12%20-%20Remember%20the%20time.mp3 #EXTINF:-1,13 - Don't stop till you get enough.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/13%20-%20Don%27t%20stop%20till%20you%20get%20enough.mp3 #EXTINF:-1,14 - Wanna be startin` somethin`.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/14%20-%20Wanna%20be%20startin%60%20somethin%60.mp3 #EXTINF:-1,15 - Heal the world.mp3 http://192.168.0.53:80/Michael%20Jackson/History%20CD1/15%20-%20Heal%20the%20world.mp3</font></pre>
Features & limitations
- Based on NanoHTTPD, see its list first
- Servers files and directory lists from current directory
- Takes custom HTTP port as an optional parameter
- Translates local file references in .M3U files to HTTP links
- Generates #EXTINF tags in the playlist, if necessary, so that the all the names look good (since winamp doesn't decode URL encoding)
- Supports skipping (seeking bar in Winamp)
Ways to use
- Start in your music directory and enjoy streaming mp3 music
Download
- Source code
- Linux binary: run gcj -o mp3httpd Mp3HTTPD.java --main=Mp3HTTPD
- Windows binary (Doesn't have .ogg support as I don't have Windows on my computer anymore and thus cannot compile a new version. The sources now include it, though.)
License
(The Modified BSD Licence)
Copyright © 2001,2005 Jarno Elonen <elonen@iki.fi>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
![[Back to main]](/gfx/home.gif)
![[Printable version]](/gfx/print.gif)
![[Search]](/gfx/search.gif)