Video playback with Java

So… with Java we game fans can use OpenGL, Xith, Java3d, OpenAL, Jorbis, and a few more: but how about video?
Say you’d like to play back some video sequences in / before your game: is this possible with Java?

Ideally there would be something to replay licence free videos like with the Xvid/Oggvideo format(s).

http://java.sun.com/products/java-media/jmf/ isn’t what I’m looking for, is it?

[quote]http://java.sun.com/products/java-media/jmf/ isn’t what I’m looking for, is it?
[/quote]
That is exactly what you are looking for.

Except that it’s totally shit. I really mean that, too.

Cas :slight_smile:

Well, in the FAQ http://java.sun.com/products/java-media/jmf/reference/faqs/index.html#jmf2-support
is says for supported (video) formats:[quote]
video: AVI, MPEG-1, QT, H.261, H.263
[/quote]
Which would do I think for my puroposes.

However it depends on how well it outputs such videos and how easy it is do deploy JFM with your game. The JMF’s pure Java probably is more simpler to handle, compared to the native lib needing “Performance Packs”.
We’ll see. The reason I asked here is to find some potential game dev/user experiences with JFM.

P.S. My first test with the pure Java JFM version doesn’t want to show my Mpeg1 video, just sound. On
http://java.sun.com/products/java-media/jmf/2.1.1/formats.html
you can read why: the pure Java version doesn’t render Mpeg video.

What about QT4Java? Or has this project been dumped?

I ended up buying NCTVideoStudio components ($500) and writing my own JNI lib to interface to it. I can’t stress enough just how shit JMF is. Please don’t waste any more time on it.

Cas :slight_smile:

I agree JMF is currently complete crap. However I’ve been told that Sun is interested in making it not so crappy. The architecture is almost there for something cool that would work… the problem is that it is of such low quality that it is unusable. (Though some people have managed to make it do something useful for them.)

I looked at it about 2 years ago when I needed something to remotely monitor a video stream - exactly what JMF is supposed to be good at - it sucked, it simply didn’t work properly at all, audio/video sync was off by a minute or more. Video playback would be very slow until audio lagged by over a minute, then miraculously the video playback could keep up. It was such a total pain to deal with that I ended up writing my own code to stream JPEG frames and raw audio and that worked better. Sad.

I think the right way to do this, given that JMF will not be better in time for anyone to care, is to write JNI bindings to play media via whatever the platform would normally use, DirectShow on Windows, QuickTime on Mac, and whatever you can get to work on Linux (good luck) - I think the popular thing is “Video for Linux”.

Version v2.1.1 “Perfomance Pack” (ie with some MBs of native DLLs) worked for me on Windoze. Although I only did some basic tests with Mpeg1, they looked and sounded ok.
I don’t have got the time to write any JNI wrappers (let alone the knowledge) or the money to buy some decoders for my hobby game project… :slight_smile: One day, when it’s finished, maybe there will be JMF v3 or so.

http://www.alphaworks.ibm.com/tech/tk4mpeg4?open&S_PKG=&S_TACT=103AMW61&S_CMP=GR&ca=dgr-lnxwd01tk4mpeg4

seems cool, no dll needed- but if u use one its cooler… but costly :frowning:

You should check out:
http://mediaframe.org/
http://fobs.sourceforge.net/

First one is pure Java, works in 1.1 too i think =)

Thijs

All the demos of the mediaframe stuff that I tried locked up after a couple seconds or just outright crashed. Maybe a Java 6 thing?

Yeah I noticed it too, it happens in older JVM’s as well. Last time I checked them (couple of months ago) they worked fine, so maybe its something on their server side (something with the streams blocking)…

You can also download everything (including source) and run the thing local. Locally all mpeg’s I tried played fine.

I didn’t say this but… you could also look at Apple’s QuickTime for Java.

**looks over his shoulder for the Sun JCP police ****

I used QT4Java for a job a few years ago. Ran really well, but the only problem was that apple went and completely changed the programming interface with the next release. It’s crap like that that makes me give M$ technologies a wide berth. Some pratt effectively deprecating all of your work because they’ve decided they want to restructure their toy project is NOT a fun way to work.