What is the best way to record and stream live video to many clients? Are there any libraries?
3 Answers
Xuggler is a nice opensource Java library that deals with streaming and modifying media on the fly.
http://www.xuggle.com/xuggler/
You can either use it with Red5 or if you want complete control, Xuggler has an IContainer class where each instance can be set up to stream media in or out. I've been able to restream media over UDP and TCP/IP.
Also, Xuggler will automatically split various streams for you to analyze/modify (video, audio, metadata) and is built using FFMPEG (tons of out of the box codecs) =).

- 664
- 3
- 6
-
3Can you show me an example to stream a video(rtsp,http) from java and xuggler, whithout use red5? thank you! – javment Oct 02 '12 at 08:24
-
@Teddy Yueh - I would also really like an example of this without the use of red5 – Grammin Oct 02 '12 at 15:12
-
1I don't have much time now, but can give you some instructions. Use IContainer with direction out. As for the stream, you can pass in a ByteArrayOutputStream and keep a handle to it. As you write packets to IContainer, your ByteArrayOutputStream will fill, so after each packet is written, flush the IContainer, then pass the bytes to a DatagramPacket if you want UDP. If you want TCP/IP, it's as simple as passing the Socket's OutputStream to IContainer. In any protocol, you just need access to the bytes. If you're using ByteArrayOutputStream, don't forget to clear it after each pull. – Teddy Yueh Oct 13 '12 at 18:19
If you feel adventurous an other possibility is my very new, shiny WebM-based live streaming server, stream.m. It's GPL licenced, full source available. You can use HTML5 capable browsers as clients.
No recording capability on the server side yet, but you can save the stream on the broadcasting side in a thousand ways.

- 20,084
- 9
- 69
- 118
Check out Amazon EC2's streaming service, CloudFront. If you're trying to distribute content to a large number of clients, the elastic cloud trumps any other implementation cost-wise, and can easily be implemented in Java.
http://aws.amazon.com/cloudfront/
They have very helpful documentation for developers, and incredibly reasonable pricing for content delivery that easily beats the cost of setting up an in-house solution.

- 1,062
- 1
- 15
- 21

- 963
- 7
- 15