Media player libraries in Java

Ok, I've spent the last month playing with several options and these are the results:

  1. VLC. This was my first thought, as everybody keeps saying that it "plays everything". I have used both the VLCj Java bindings, and the built-in remote interface (-I rc). I found this to work pretty well in general, but had some issues. I kept seeing ocassional crashes under heavy load (not VLCj's fault as it also happens when using the binary directly). Also I've found memory consumption to be relatively high when compared to other options.

  2. MPlayer. This actually performs better than VLC in my experience, no crashes, and memory consumption is lower. No Java bindings, although the slave mode works very well.

  3. GStreamer. Very powerful, very flexible, while still easy to get started with. Tried both the Java bindings and running the gst-launch binary from Java. Both approaches work remarkably well.

  4. Xuggler looked good, however it seems to have issues with RTP (as stated in the FAQ). Since both GStreamer and MPlayer worked so well, I did not get past the initial research.

I found GStreamer to be the best solution given the requirements, with MPlayer being the second option.


have you looked at gstreamer?


I've also spent a while researching my options, and I've actually come to the conclusion that VLCJ is the best option - however here's the clincher, you need to run it out of process (especially with multiple players) for it to give you 100% reliable operation. That's the approach I'm taking and I've yet to see it crash. With it rock solid in this way it also has other advantages:

  • It can play pretty much anything. Yes it's a bit of a cliche, but this includes DVDs, Youtube videos, pretty much any video file...
  • Should support Linux / Mac / Windows, though I've yet to verify Mac working.
  • Actively maintained, and if you ask a good (as in well thought out) question on the discussion group the owner often replies in minute in my experience!
  • Open source, and the Google group activity at the time of writing is high.
  • Uses all the graphics acceleration VLC does
  • Able to play to any heavyweight Canvas component (and if you use the direct player, you get the BufferedImage to display anywhere you like, even in JOGL 3D land if you're that crazy!

I haven't found it that heavy on the resources front either, though I haven't done any thorough testing (but 3 players work fine in tandem as well as my relatively power-hungry application on my 4 year old basic laptop!)

Disadvantages? There's no official framework for out of process players, so you have to build one yourself (see here for how I did it). And you do sometimes have to do some fiddling to get it working. But as far as I can see, it's working well for me so far!