1

I am wondering how to go about this one, I could use ffmpeg to transform the mp4 to RGBA (I still haven't been able to do so) and then input into my program but I would like to decode it in my C++ main directly, after that I guess is arbitrary to get it into a texture with something like:

glBindTexture( GL_TEXTURE_2D, textureID );

glTexImage2D( GL_TEXTURE_2D, 0, RGBA, width, height, 0, format, GL_UNSIGNED_BYTE, &data.front() );

Thanks for the help!

Felipe Gutierrez
  • 675
  • 6
  • 17
  • 1
    What, exactly, is your question? Once you have decoded the mp4 (ffpmeg is as good a solution as any) and have the uncompressed RGBA for a frame, you can load it into a texture just as you have shown in your code snippet. You can't put the whole thing in one texture (unless it's a very short and very small video), but this works for a frame. – 3Dave Nov 27 '18 at 14:19
  • See also https://stackoverflow.com/questions/6495523/ffmpeg-video-to-opengl-texture – 3Dave Nov 27 '18 at 14:19
  • One more tutorial link http://nehe.gamedev.net/tutorial/playing_avi_files_in_opengl/23001/ – Victor Gubin Nov 27 '18 at 14:22
  • Thank you guys! But how would I transform mp4 to RGBA directly in my app without the use of ffmpeg? – Felipe Gutierrez Nov 27 '18 at 14:41
  • Another question! Suppose I have a slow mo video, I will loose the frame rate once I get RGB from mp4 won't I? – Felipe Gutierrez Nov 27 '18 at 14:43
  • Mp4 is an encoding format. It doesn't store each frame (of 25 fps), but one every many, say 14. The other 13 are big/low modifications from the base frame, and only these modifications are stored. That's how compression is achieved. Decoding is what ffmeg does, restoring every of those 14 frames to an uncompressed format (RGB) that you can use to build a texture. – Ripi2 Nov 27 '18 at 18:53
  • Thanks @Ripi2 and everyone else, I'll post an answer when I have something working and refer to all of your informative responses. – Felipe Gutierrez Nov 28 '18 at 01:03

0 Answers0