2
\$\begingroup\$

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?

\$\endgroup\$
3
  • 2
    \$\begingroup\$ 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 \$\endgroup\$ Commented Jun 21, 2013 at 2:05
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 21, 2013 at 5:13
  • \$\begingroup\$ I am currently looking into xuggler. Seems pretty powerful. Thanks for the tip \$\endgroup\$ Commented Jun 24, 2013 at 0:23

1 Answer 1

2
\$\begingroup\$

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

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, this seems to be the 'correct' way to do it. Good stuff! \$\endgroup\$ Commented Jun 24, 2013 at 0:22

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.