How to implement HTTP Live Streaming server on Unix?

The easiest way to stream HLS is using something like Wowza or FMIS (neither of which come cheap). Wowza will take input (either live stream or stored VOD content and do the segmentation on the fly.


If you want to stream live content from your webcam : FMLE ( flash media live encoder )

If you want to stream static content (movie) : ffmpeg & xuggle

red5:

You media server could be red5 ( open-source and free) or FMS or wowza. But i used only red5, i don't know about the others. You can find red5 here.

You server can be anywhere but you will need to open some port (1935 for rtmp at least ) , 5080 for "admin panel", you could see 9999 in the list. ( Check the doc ) Red5 is a media server in java, so you will need java jdk >= 1.6.

Red5 1.0 RC can be found here. You can find a version for windows, osx or linux. I used the tarball version. Extract it and run "red5.sh". You should be able to access the admin at http://localhost:5080/ and you should also see a video being display. If not, something wrong and you can't go further until this is working.

Stream with ffmpeg:

You can find xuggle here and you can find more information about this here

ffmpeg -i your_file.flv -re -acodec copy -vcodec copy -f flv rtmp://localhost_or_yourred5serverip/live/livestream

Keep in mind that if you want to stream it on the web only flv and mp4 can be playing in flash player ( i think ). Once it's streaming you should be able to see it in the "admin panel" here. Connect to your server (rtmp://localhost/live/) and go to the view tab and put "livestream". You could use mplayer rtmp://localhost/live/livestream to see your video too.

stream in a flash player:

You can use flowplayer (with the rtmp plugin) or jwplayer.


There are several competing technologies, but today if you want whatever files to be compatible for streaming on Apple devices (iPhones, iPads, etc) then HLS is the way to go. Incidentally it is also supported by most browsers and Android so not a bad place to start. Note however it is not suitable for streaming live content despite the name.

Unless you want live video, you really DON'T need red5 or wowza or fms or anything like that. HLS is basically a set of short video segments (e.g. 5 minutes each) encoded at different bitrates and an m3u playlist you give to your flash or HTML5 based player in the browser. It is kind of up to you to decide the segment length or how you encode it.

This is the best article I've seen about how to pick resolutions, bitrates, segment sizes, etc: http://www.streamingmedia.com/Articles/Editorial/Featured-Articles/Adaptive-Streaming-in-the-Field-73017.aspx

From there you just for example create a directory structure, e.g.

/data/video/video_id/original.mp4
/data/video/video_id/quality1/chunk1.mp4
/data/video/video_id/quality1/chunk2.mp4
/data/video/video_id/quality2/chunk1.mp4
etc..

Then you need to generate an m3u playlist for all the chunks and qualities and it's up to the player itself to implement the switching between qualities and playing the next file (which most modern players already have).

I also highly recommend checking out: https://developer.apple.com/streaming/ - Apple provide a bunch of free tools to prepare the videos and playlists for HTTP Live Streaming.