Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to play a movie file into an OpenGL texture in a Java application. I am using JOGL and have a basic OpenGL scene, but I have no idea how to play a movie into a texture.

The only thing I could find was this:

http://paulo.ragonha.me/blog/2008/08/java-movie-playback-jogl-fobs4jmf.html

It is quite old and uses JOGL 1.1 and Fobs4JMF, which is no longer maintained. I managed to get it to build in eclipse but it wasn't able to read my movie clip. I could probably convert the movie clip to an older codec to see if that works, but I would rather have a modern solution.

I am a professional game developer, so the OpenGL part is no problem, but I am new to Java (coming from a C++ background).

Is there any modern library that wraps this functionality in an easy to use package?

share|improve this question
2  
You can use xuggler to decode vid files but it doesn't provide anything to integrate with JOGL so you'll have to code decoded vid->texture part yourself. xuggle.com/xuggler –  XiaoChuan Yu Jun 21 '13 at 2:05
1  
I have done the opposite, encode a H.264 video from OpenGL rendering with Java, and I can highly recommend xuggler. It took around 4 hours to glue everything together and have a working solution. By transferring the data with Pixel Buffer Objects and encoding in a separate thread the performance hit was unnoticeable. –  msell Jun 21 '13 at 5:13
    
I am currently looking into xuggler. Seems pretty powerful. Thanks for the tip –  DaleyPaley Jun 24 '13 at 0:23

1 Answer 1

up vote 1 down vote accepted

You may use the JogAmp JOGL GLMediaPlayer class http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/av/GLMediaPlayer.html

GLMediaPlayer will use the operating system installed codecs to decode the movie, on Android it uses the Android media framework and on desktop systems such as Linux, Windows and Mac it dynamically links to and uses installed libav/libffmpeg libraries. GLMediaPlayer itself only expose a platform neutral API and renders to a texture.

Example code are found to playback a movie on all six sides of a cube and on a rotating rectangle inside the jogamp jogl test codebase:

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java

share|improve this answer
    
Thanks, this seems to be the 'correct' way to do it. Good stuff! –  DaleyPaley Jun 24 '13 at 0:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.