LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: GLFW3 and mp4  (Read 512 times)

matan45

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
GLFW3 and mp4
« on: September 29, 2017, 17:06:51 »

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

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Online Online
  • Posts: 1907
Re: GLFW3 and mp4
« Reply #1 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.
Logged

matan45

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
Re: GLFW3 and mp4
« Reply #2 on: October 01, 2017, 07:24:45 »

maybe any other video format
Logged

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
Re: GLFW3 and mp4
« Reply #3 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.
Logged

matan45

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
Re: GLFW3 and mp4
« Reply #4 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? 
Logged

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
Re: GLFW3 and mp4
« Reply #5 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
Logged

matan45

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
Re: GLFW3 and mp4
« Reply #6 on: October 04, 2017, 05:18:49 »

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

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
Re: GLFW3 and mp4
« Reply #7 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
Logged

matan45

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
Re: GLFW3 and mp4
« Reply #8 on: October 05, 2017, 04:40:25 »

what decoder you use for mp4?
Logged

matan45

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
Re: GLFW3 and mp4
« Reply #9 on: October 26, 2017, 04:27:19 »

how can I decoder audio form mp4 file?
Logged