Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a Ruby On Rails application running on Nginx which is serving out MP3s using JW player. I need to be able to set the start time and duration for playlist items. From what I can tell to do this I need be streaming the MP3 files. How can I setup Nginx to do this?

share|improve this question

2 Answers 2

Nginx has built in support for streaming FLV files through the HttpFlvStreamModule. You nave to specify the module when you compile / recompile Nginx.

# ./configure --with-http_flv_module ...SOME-OTHER-OPTS...

You can then configure your nginx.conf to stream FLV files like so:

...
http {
    ...
    server {
        ...
        location ~ \.flv$ {
            flv;
        }
        ...
    }
    ...
}

Now how does this help anything since the original question was about streaming MP3 files? Well you can use FFMPEG to convert the MP3s to FLV files like this:

ffmpeg -y -i /home/song.mp3 -f flv -acodec mp3 -ab 64 -ac 1 /home/song.flv
share|improve this answer
    
I guess that's cool if you like to use a video player to play music. I've used this before: flash-mp3-player.net There are quite a few other flash audio players as well. –  d-_-b Feb 10 '11 at 1:48

AFAIK, Nginx is an HTTP server. To stream audio, you will need the likes of Icecast: http://www.icecast.org/

The technical differences between streaming and downloading are mainly with the client and server. To the end user, streaming means that they probably will not be able to save media on their machine. Download and the end user may not be able to begin watching it right away. Though in practice, most data can be viewed as soon as the first bits arrive at the client.

That being said, are you sure you need a streaming server to use JWplayer? Can't you just point it to a URL and let JW fetch it? In this case, Nginx would serve the audio just fine.

In fact, I'm pretty sure I've done this before with Apache. The video started playing after a bit of buffering - like it does with Youtube.

share|improve this answer
    
According to the JW player you need to be using streaming vs flat file served by a web-server in order to specify the "start" parameter. Shown in their documentation –  bwizzy Feb 9 '11 at 11:43
    
JWplayer supports stream for video. "Support for streaming video protocols RTMP and HTTP pseudo-streaming" longtailvideo.com/support/jw-player/jw-player-for-flash-v5/… I see no mention of support for streaming audio. What is you use case and why do you want to use a streaming protocol with MP3? –  d-_-b Feb 10 '11 at 1:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.