Hello,
I’ve a problem with my program. I want to display a video on a box. I use the example from the following page https://fivedots.coe.psu.ac.th/~ad/jg/ch283/index.html
The player starts the video and runs it also with sound. But only the first frame is displayed on the box. Maybe there is a problem in the simpleUpdate. I tried this:
protected void simpleUpdate(){…
image = snapper.getFrame(); // grab a frame from the video
Some people used jME with JMF before, including my own implementation:
http://www.jmonkeyengine.com/jmeforum/index.php?topic=2908.0
But for simpeler examples just search on "JMF" in the forum.
try putting this in the update method, maybe before the set texture call
ts.delete(0); // set texture
that should update the texture for you....
Thanks for your replys, but it doesn't help. Only the first frame is displayed and I can hear the sound during the whole film. And in the forum I can't find a solution.
Maybe in the last posts I didn't explain the problem very good. So I try to explain it again:
In our simple game we have a box and what we want to do is place video frames (images) onto that box surface (texture). We are able to add a texture, but what we want to do is update the texture with a new frame. I am new to jME and I am not sure whether this is the right approach. Am I right in saying that you should only add a texture to an object once and never again, or is it common that textures can be changed. I have had a look at the Renderer and maybe it is this object that I should be using to update the box's texture.
I would appreciate it if anyone could help us with this problem or guide us to some tutorials where it might explain the proper use of Textures and Renderers. This is a really fustrating problem because we know that we are getting the individual frames from the video source (i.e. we where able to save each image as a jpg on the harddrive, so we know the code at this point is working fine. It is just this last stage that is holding us up.)
Thank you in advance for your time and effort.
the codelines from simpleUpdate:
image = snapper.getFrame();
Generally you would take your image data and use glSubTexImage to replace the contents of an existing vid card texture with the new frame. I thought there was an awt Image util somewhere in jmex that facilitated that type of operation, but I'm not able to find it…
That would be ImageGraphics.
However, the link that I posted gives an example of the glSubTexImage approach.
The suggested search shows you other very simple ways to update the texture (like creating a new one each frame too, if I remember correctly).
Hi, I didn't find a solution for our version of displaying a video, so I used the JMFGrabber from your post and I got it work. I can run different types of videofiles(mp4, 3gp, avi, mpg…). But the main problem is now the low framerate (Maybe it depends on the size of the file). So… thanks for your help.