You seem to be able to get a ByteBuffer from Memory, so why not directly send that to OpenGL using glTexImage2D or something?How do you get VLCJ working? Video playback is something I've tried getting to work for a long time too, but I never really got anywhere. Does it require you to install VLC? Any native files?

You seem to be able to get a ByteBuffer from Memory, so why not directly send that to OpenGL using glTexImage2D or something?How do you get VLCJ working? Video playback is something I've tried getting to work for a long time too, but I never really got anywhere. Does it require you to install VLC? Any native files?

VLCJ has been used with JMonkeyEngine 3 and the LWJGL renderer as you can see in the screenshots. I hope this helps...

I got VLCJ to work by setting the jna library path -> System.setProperty("jna.library.path", "vlib");in vlib I have the vlc dlls and a plugin folder which holds the codecs, and some other commands to specifically look there

and so on. Works on Windows and LinuxProblems are here: cannot use in OpenGL; as is the problem with ALL video solutionsand well... codec shipping legal issuesIf you only ship the theora codec it should be fine. However out of every codec in vlc's beautiful codec collection, that one is not stable: http://forum.videolan.org/viewtopic.php?f=14&t=78720&p=313041#p313041

Either I get one of these working,or program a kind of cutscene system in which I can at least show images and do effects, kinda like a visual novelor I gotta go to XNA

It's so crazy that there is no easy way in java. Every game has videos normally. Start up, nvidia logo, company logo, intro fmv, then main menu.And it's just... well it's hard doing in-game cutscenes for everything.It's like Final Fantasy VII, sure there are in-game scenes with stuff happening, but sometimes you need scenes of WEAPON attacking Junon, or whatever

You seem to be able to get a ByteBuffer from Memory, so why not directly send that to OpenGL using glTexImage2D or something?

That would seem about the way to do it. Don't use the RenderCallbackAdaptor, as you don't want to copy the data into Java unnecessarily. Just beware that the ByteBuffer returned from JNA's Pointer class is not a copy, and therefore is the same memory that VLC is going to keep writing into - don't do anything daft with it!

Also, speaking of legal issues, I assume you're aware that VLC and VLCJ are GPL? If you need a more liberal solution it might be worth looking at the GStreamer-Java bindings - they're LGPL. You could also look at the code in the GSVideo library for Processing which uses GStreamer-Java and ships with the precompiled native libs for Windows and Mac, and also has some code somewhere to directly update an OpenGL texture from the video stream.

So because VLCJ is GPL, I'd have to release my entire game under GPL too?This GStreamer binding (no idea what GStreamer is), can you also get access to frame memory like in VLCJ? Avoiding copying millions of pixels 24 times per second is pretty important...

looking at the GStreamer-Java bindings - they're LGPL. You could also look at the code in the GSVideo library for Processing which uses GStreamer-Java and ships with the precompiled native libs for Windows and Mac, and also has some code somewhere to directly update an OpenGL texture from the video stream.

GStreamer is the only I haven't looked into as thoroughly yet. As it seems to be similar to VLC.And yeah I know there is a processing thing - running on 3 OS'... getting the code from that just seems like a nightmare, crawling through processing source code...

As far as I'm aware, both GStreamer-Java and VLCJ started off rendering into whatever the native video component provided by the library is. After that, direct pixel access was provided through JNA pointers which has allowed rendering into Swing / AWT / BufferedImage or whatever. You can do what you want with that pixel data, though.

btw - this is all interesting timing as I'm working on the OpenGL renderer for Praxis, and that already uses GStreamer-Java for video playback, so I'm currently looking into the best ways of getting the data directly into OpenGL.

GStreamer is the only I haven't looked into as thoroughly yet. As it seems to be similar to VLC.And yeah I know there is a processing thing - running on 3 OS'... getting the code from that just seems like a nightmare, crawling through processing source code...

You don't need to look through all the Processing code!!! GSVideo just has a few classes that deal with loading the native GStreamer libs on various platform that might be useful.

You don't need to look through all the Processing code!!! GSVideo just has a few classes that deal with loading the native GStreamer libs on various platform that might be useful.

Libs written for Processing import and use Processing classes like PImage, so its not portable to non-processing without effort.

Yes, sorry, should have been clearer. There's stuff that may be useful, but you'll have to hack it out! See how you get on with GStreamer-Java by itself first - the GSVideo stuff is only really useful if you want to ship the native libs yourself, and that's doable without it.

I've used this binding quite a lot, so I can try and answer any questions you have about it. Maybe post them in a "GStreamer-Java in OpenGL / LWJGL" thread!

almost there. Maybe I'm doing something incredibly stupid here with the buffers. But I'm not an OpenGL programmer =D

Getting:

Quote

Exception in thread "main" java.lang.IllegalArgumentException: Number of remaining buffer elements is 2785280, must be at least 6291456. Because at most 6291456 elements can be returned, a buffer with at least 6291456 elements is required, regardless of actual returned element count

To bottom line this: Once it works, video playback works.You can ship VLC, just like a private JRE, including all natives for windows, linux and mac, just like with the lwjgl dlls.

Then there is only license problems, with java library and codecs.To solve them: only include theora & vorbis codecMake your code GPL, or at least that part that uses/communicates with VLCJ, still have to know which one

The problem is that you shove a 1280x554 raster into a texture with the dimensions 2048x1024. It won't fit.

You either have to pad a lot of pixels, or use non-POT textures. I think the latter will be the best option.

Quote

To bottom line this: Once it works, video playback works.

I don't think you're as near as you think you are. The 'buf' variable is never really filled with data, so you'd be rendering a black screen, although even that wouldn't work, as you never actually create a texture, you simply call GL11.glBindTexture(GL11.GL_TEXTURE_2D, 1); where '1' should be the handle that glGenTextures provided. This will result in a crash.

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

I updated my previous post. You're not really connecting any parts in the code you provided: you create a buffer and never fill it, pushing it into the texture every frame and expecting a video will play when you draw it. You have misconceptions about OpenGL and I advice you to work on that first. Try to load your own (non-POT) texture, then you'll see that glGenTextures() is not optional, and how there are many more calls to OpenGL required to set this up properly.

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

Hm, okay, how are the buffer blits synced? You never request a new frame, and without any request, it must be running on another thread, which will cause lots of tearing as the buffer can be modified during upload.

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

Hm, okay, how are the buffer blits synced? You never request a new frame, and without any request, it must be running on another thread, which will cause lots of tearing as the buffer can be modified during upload.

Yeah no idea. Looking at the JME example it says "Synchronisation might be required..."I assumed frames were requested by time automatically, because there aren't any calls in the JME example for this.But yeah tearing and sync... well first I need it to display anything.

Ugh... can't seem to get this on my MacOSX. Keeps giving me "[0x100150020] main libvlc error: No plugins found! Check your VLC installation." even though I am using the proper VLC_PLUGIN_PATH variable for my VLC version...

Ugh... can't seem to get this on my MacOSX. Keeps giving me "[0x100150020] main libvlc error: No plugins found! Check your VLC installation." even though I am using the proper VLC_PLUGIN_PATH variable for my VLC version...

Just read. I told you, only windows.Adding the Linux .so files would be best I could doNo access to a mac anyway

Nah, I've been trying to get it working using the JARs from the VLCJ/JNA website -- not your eclipse package. After some tweaking I got it to link with my VLC libraries (vlclib/vlccore) but I've hit a roadblock with the plugins problem.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org