Theora video in LWJGL

Started by OrionNebula, February 15, 2014, 04:32:12

Previous topic - Next topic

OrionNebula

After crawling the internet for hours, I wasn't able to find any solutions to playing video (for cutscenes and such) inside my LWJGL game. After 3 frustrating weeks, I've managed to come up with a PURE JAVA implementation of the Theora video codec for use with various libraries (I only included an LWJGL module, but it's easy to make one for JOGL or otherwise). Results are promising, and the system can render full 1080p video with audio (tested up to 48000 Hz) at upwards of 80 FPS. I'm currently using it in a real-world context with no issues. I've encapsulated it all in a library, which you can find here:
https://github.com/OrionNebula/JavaGL-Theora
Its 2 dependencies are licensed under LGPL, and the API itself is MIT.
I am having a bit of trouble with audio synchronization, and I figured you guys might be able to help out. openAudio() and audioThread contains the bulk of the problem, but some of it may be in playVideoInline(...). I've tried adjusting the audio line's buffer size and the fragment size, which works until the situation changes. I still can't think of any ways to permanently link the audio and video rates.

abcdef

You might find this link useful, it has a working video example using FFMEPG to provide the data. You do need to ship the FFMPEG binaries as part of this but you might also find it useful to improve your code by understanding what was being done.

http://www.java-gaming.org/topics/java-media-player/27100/view.html