Main Menu

GLFW3 and mp4

Started by matan45, September 29, 2017, 17:06:51

Previous topic - Next topic

matan45

there is any way to play mp4 video file in glfw window?
any example anything?

spasi

LWJGL doesn't have bindings to ffmpeg or libvlc, but there are third party bindings available. I haven't tried them, so not sure how well maintained they are or how easily they can be integrated with GLFW/OpenGL.

matan45

maybe any other video format

darkyellow

The way to do it with out bindings is to call the ffmpeg executable from java with the command line arguments of choice then use the input stream to generate byte buffer texture data that you can then use to update an FBO regularly.

I have done this but I also have a theora decoder I am working on which is written is pure java which skips the ffmpeg stage and just generates byte buffer data textures. The decoder is about 90% done, the spec isn't that good and I haven't worked out where my issues are so I have given up for the moment. It plays videos but there are issues with the movement vectors.

matan45

ant how do you synchronized the frame rate and the audio?
can you show me example when you done? 

darkyellow

Its probably easier to show you this which does things in a similar way I think (my code is too integrated in to the engine I have to easily see what it is doing)

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

Audio Sync : I use openal and it does the syncing for you, you just need to feed it data at a faster rate than it can consume
Video sync : you know the frame rate so you time each draw cycle to decide if you need to skip a frame or if you need to wait a bit longer

matan45

this is liby is too old not working whit glfw3 and lwjgl3

darkyellow

You are correct but it shows you a way to do it, you can build something similar yourself

matan45

what decoder you use for mp4?

matan45

how can I decoder audio form mp4 file?