Tao.FFmpeg decoding and encoding to OpenGL
Does anybody have experience with FFmpeg video decoding?
I've got the general basics of it working, in terms of reading in frames, and I can verify that this data is correct as it saves to a series of .PPM files, however the uploading to OpenGL does nothing. i;e. no errors, but no result either (no visible change to the existing texture):
Gl.glBindTexture(Gl.GL_TEXTURE_2D, TextureID);
Gl.glTexSubImage2D(Gl.GL_TEXTURE_2D,0,0,0,CodecContext.width, CodecContext.height,Gl.GL_RGB, Gl.GL_UNSIGNED_BYTE, buffer);
"buffer" contains the converted video image in RGB24 format. The contents of this is directly dumped to PPM files to verify it's contents, which all appear as intended. the CodecContext.width and height are correctly set up.
Regarding Encoding, I have the screen capture side working, does anybody have the actual encoding part working, i.e. encoding to an AVI file and/or Streaming file?

I've since tried it with
I've since tried it with Build2Dmipmaps instead of glTexSubImage2D, which works fine.
Euan MacInnes
http://icarus.sourceforge.net
Windows, MacOSX, Linux C# project based off the Tao.Framework
That´s not a good solution,
That´s not a good solution, as the driver will have to build mipmaps for each and every frame! I think you need to call glTexImage2D at least once, before using glTexSubImage2D. That, or the driver doesn´t like some parameter - can´t see which one though.
------
OpenTK
AFAIK you'll indeed need to
AFAIK you'll indeed need to initialize the texture first with glTexImage2D. Also did you double check you're not using a mipmap filter on a non-mipmapped (video)texture? (That's what happens to me in most of these situations...)
Performance is still
Performance is still workable with the mipmaps, (live decoding the movie as well, so that the source can be streaming, like webcams etc..) but it's not ideal to have that for every frame, unless the end user is going to warp the movie in 3D or something (i.e. to simulate one of these outdoors curved screens for example), but I want a second faster option for those that are just going to stream it onto the 2D display. I'll see about having a toggle for the TexImage2D.
You're right about the texture mapping though, mipmapping is enabled, so it'll not display the topmost mipmap given how the video is playing in the demo scene without generating the mipmaps, or just disabling them.
Performance is surprisingly Ok doing the mipmaps plus ODE work, plus Audio, etc.. and it's working quite well as a fake-scaler of the image, i.e. for 720p output of a 480p signal (albeit an animated one that's not flat to the screen), so I'm tempted to leave it in there as an option.
Anyway, I figured this would have a relatively easy solution somewhere.
and now for the Encoding portion...
I have the "screenshot" capture function working. Does anyone have a C++ outline of how to get ffmpeg to encode a video file, and I can base the C# from there?
Euan MacInnes
http://icarus.sourceforge.net
Windows, MacOSX, Linux C# project based off the Tao.Framework
You are absolutely right !!!
You are absolutely right !!!