LWJGL Forum

Programming => OpenGL => Topic started by: matan45 on September 29, 2017, 17:06:51

Title: GLFW3 and mp4
Post by: matan45 on September 29, 2017, 17:06:51
there is any way to play mp4 video file in glfw window?
any example anything?
Title: Re: GLFW3 and mp4
Post by: spasi on September 29, 2017, 19:19:07
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.
Title: Re: GLFW3 and mp4
Post by: matan45 on October 01, 2017, 07:24:45
maybe any other video format
Title: Re: GLFW3 and mp4
Post by: darkyellow on October 02, 2017, 13:03:38
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.
Title: Re: GLFW3 and mp4
Post by: matan45 on October 03, 2017, 04:26:01
ant how do you synchronized the frame rate and the audio?
can you show me example when you done? 
Title: Re: GLFW3 and mp4
Post by: darkyellow on October 03, 2017, 11:59:31
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
Title: Re: GLFW3 and mp4
Post by: matan45 on October 04, 2017, 05:18:49
this is liby is too old not working whit glfw3 and lwjgl3
Title: Re: GLFW3 and mp4
Post by: darkyellow on October 04, 2017, 12:48:46
You are correct but it shows you a way to do it, you can build something similar yourself
Title: Re: GLFW3 and mp4
Post by: matan45 on October 05, 2017, 04:40:25
what decoder you use for mp4?
Title: Re: GLFW3 and mp4
Post by: matan45 on October 26, 2017, 04:27:19
how can I decoder audio form mp4 file?