26

Are there any good libraries for streaming live video using Java? Ideally both ends of the pipe should be written in Java but I am mostly concerned about the video player. What software would you recommend?

UPDATE: It seems that VLC introduces a 1-2 second delay. I need video streaming that is truly live. The record-to-playback delay must be under 300ms.

Esteban Küber
  • 36,388
  • 15
  • 79
  • 97
Gili
  • 86,244
  • 97
  • 390
  • 689
  • 3
    I think you can adjust the buffer sizes in VLC to reduce the delay. Not exactly sure how to do that, and probably unlikely you will get below 300mS, but you maybe able to improve it. – simon Sep 04 '09 at 21:15
  • @StevenGlick, I doubt that. When I checked in 2009, the delay was so bad (1-2 seconds) that I could visually measure the latency. I recorded a countdown timer on one computer, played it back on a second computer, and compared the difference visually with the monitors side by side. For you to measure a value of 1ms you must be measuring programmatically, which is not trivial to implement. You're going to have to provide a detailed explanation of what exactly you measured and how. – Gili Jan 29 '14 at 23:17
  • 1
    Oops, I had misunderstood the comment above mine what I meant is that you can set the buffer size to 1ms. I am also unable to get the delay below about 1 sec. – Steve Glick Jan 30 '14 at 15:00

6 Answers6

8

The best video playback/encoding library I have ever seen is ffmpeg. It plays everything you throw at it. (It is used by MPlayer.) It is written in C but I found some Java wrappers.

  • FFMPEG-Java: A Java wrapper around ffmpeg using JNA.
  • jffmpeg: This one integrates to JMF.
stribika
  • 3,146
  • 2
  • 23
  • 21
  • 2
    I ended up using VideoLAN (aka VLC Media Player) because it is a superset of ffmpeg. Thank you for the head's up :) – Gili Aug 11 '09 at 19:02
  • Ugh. VLC 1.01 isn't suitable for live video streaming. It introduces a 1-2 second delay, even when streaming to the local computer. – Gili Aug 12 '09 at 19:20
  • I ended up using VideoLAN (VLC Media Player) in the end in spite of the 1-2 second delay. It seems to be the only game in town right now. – Gili Jul 13 '10 at 02:59
  • @Gili You used its GUI or you made a program to do so? – praxmon Jan 31 '14 at 07:39
  • @PrakharMohanSrivastava I embedded the VLC web plugin using the [DJ Project](http://djproject.sourceforge.net/ns/) – Gili Jan 31 '14 at 16:31
6

You can do this today in Java with the Red5 media server from Flash. If you want to also decode and encode video in Java, you can use the Xuggler project.

Nomesh DeSilva
  • 1,649
  • 4
  • 25
  • 43
Art Clarke
  • 2,495
  • 18
  • 15
3

You could always check out JMF (Java Media Framework). It is pretty old and abandoned, but it works and I've used it for apps before. Looks like it handles what you're asking for.

thedude19
  • 2,643
  • 5
  • 34
  • 43
3

Yes if you want to stream live video you can use RTSP protoco this will allow you to create a video file, which can be play while creating, both operation will work simultaneously. RTSP-Client-Server

Dev Sabby
  • 1,367
  • 1
  • 11
  • 17
2

JMF was abandoned. VLC is more up to date and it reads everything. https://stackoverflow.com/a/5160010

I think vlc beats every other software out there yet, or at least the ones that I know...

Community
  • 1
  • 1
1

Hi not an expert in streaming but my understanding is that it is included in th Java Media Framework JMF http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/support-rtsp.html

4NDR01D3
  • 155
  • 2
  • 10