Search code examples
javaffmpegvideo-streamingred5wowza

Java, serve HLS live video streams


I know the topic is not an easy one, but I am looking for a Java class to send an HLS stream from the server to the client.

I have files being generated greater and greater:

out.m3u8
out0.ts
out1.ts
out2.ts
out3.ts
out4.ts
out5.ts
out6.ts

This is generated using ffmpeg from an original source:

ffmpeg -i http://sourceurl.com:9981/stream/channel/1232131 out.m3u8

I can play it using VLC.

Somehow, I need to stream this live to the clients.

At this point, I do not really care about different bit rates, i just want live streaming to work, in mobile browsers and on desktop browsers.

I found this class:

https://github.com/Red5/red5-hls-plugin/blob/master/plugin/src/main/java/org/red5/stream/http/servlet/PlayList.java

Which might be doing something like that.

I have pulled in hls.js into my application in hopes of using it for desktops.

HLS should however work IOS devices without hls.js right now.

How should one serve HLS content from the server? It's very difficult to find any good and simple example to do that.

Anyone knows of the steps needed to do that ?

I've looked into Wowza and Red5 just a little bit, but unsure what they can provide for me at this stage and seems to be overly complicated to setup just to serve some files. But please explain to me why that's not the case.


Solution

  • The H in HLS stands for HTTP. The point of streaming tech such as HLS DASH HDS smooth streaming, etc is that no special server is necessary. Just plain HTTP. you can use something like nginx, or any HTTP server class/library available for Java or any other language.