HD 720-1080p ofVideoPlayer performance

Hi guys!

I’m new with OpenFrameWorks. I created a project which loads and plays a 720p or 1080p (Quicktime) movie.

The problem is, when I display these HD movies in OpenGL, video stutters when complicated scenes are displayed. So I get like 10fps on complicated scenes with ofVideoPlayer on these HD movies.

Of course, also looking at my system specs, the file plays fine in Quicktime or Media Player Classic at full fps.

Are there any solutions to this problem? I already looked on the forum, but no simple solutions. At the bottom you will find a bit of sample code I use,

System specs:
Intel core i5 CPU @ 2.40GHz
4.00 GB ram
NVIDIA Geforce GT 330M 1GB
128 GB SSD
Windows 7 64-bit


Sample code (partly):

mov.loadMovie(“Bla720.mov”);
mov.play();

mov.getTextureReference().bind();

drawTexture(0,0,0,0);

void testApp::drawTexture(float x, float y, float w, float h, float tx, float ty, float tw, float th) {

GLfloat verts[] = { x,y, x+w,y, x+w,y+h, x,y+h };
GLfloat tex_coords[] = { tx,ty, tx+tw,ty, tx+tw,ty+th, tx,ty+th };

glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer(2, GL_FLOAT, 0, tex_coords );
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, verts );
glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );

}

Hi Coolie,

if you’re working in windows, you might consider trying Gstreamer as your playback mechanism. see this thread: http://forum.openframeworks.cc/t/gstreamer-playback-under-windows/3610/0
If all you need to do is straightforward playback, you might see a major speed difference. I was able to get full-speed playback of my 1080p clips from my dslr. Mind you if you need to some heavier processing, like working on a pixel array, expect your playback speed to crawl right back down again.

[quote author=“drosen”]Hi Coolie,

if you’re working in windows, you might consider trying Gstreamer as your playback mechanism. see this thread: http://forum.openframeworks.cc/t/gstreamer-playback-under-windows/3610/0
If all you need to do is straightforward playback, you might see a major speed difference. I was able to get full-speed playback of my 1080p clips from my dslr. Mind you if you need to some heavier processing, like working on a pixel array, expect your playback speed to crawl right back down again.[/quote]

Hi Drosen,

I’m doing some small manipulations on the video image. I create a surface in OpenGL like in the above example. Then I draw only a part of the video texture depending on the mouse position.

So i’m creating kind of a video mask.

Will this decrease the performance when using Gstreamer a lot??

Thanks!

probably not, if it’s all opengl. I just meant that even if you have the ability to play a video file smoothly, you may end introducing slowdown during your image processing. This is no different in Gstreamer vs quicktime or anything else. And you may find that certain effects which seemed practical to do on a smaller rez video, may slow things down quite a bit as you increase resolution.

Hi Drosen, I’m trying to play a video using CodeBlocks/GStreamer/OpenGL. The video is playing, however, it is not showing on screen. Is there something wrong with the following code, or is it just not possible to use Gstreamer with OpenGL???

  
bLoaded = fingerMovie.loadMovie("movies/test.mov");  
fingerMovie.play();  
  
fingerMovie.getTextureReference().bind();  
drawTexture(0,0,ofGetWidth(),ofGetHeight(), 0,0,ofGetWidth(),ofGetHeight());  
  
void testApp::drawTexture(float x, float y, float w, float h, float tx, float ty, float tw, float th) {  
  
    GLfloat verts[] = { x,y,  x+w,y,  x+w,y+h,  x,y+h   };  
    GLfloat tex_coords[] = { tx,ty,  tx+tw,ty,  tx+tw,ty+th,  tx,ty+th  };  
  
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );  
        glTexCoordPointer(2, GL_FLOAT, 0, tex_coords );  
        glEnableClientState(GL_VERTEX_ARRAY);  
        glVertexPointer(2, GL_FLOAT, 0, verts );  
        glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );  
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );  
  
}  

hrmmm, I can replicate your problem easily enough, but I don’t see where the issue is arising from. If I were you, I might re-post this in the Gstreamer on Windows thread, and see if anyone there had some insight. I think Grimus would be the best person to ask.

there was a problem on how the texture was created for the gstreamer version, instead of ARB it was being created as 2D, just replace this in ofVideoPlayer.cpp line 448 (could be different line number in 0061):

  
tex.allocate(gstUtils.getWidth(),gstUtils.getHeight(),GL_RGB,false);  

with

  
tex.allocate(gstUtils.getWidth(),gstUtils.getHeight(),GL_RGB);  

[quote author=“arturo”]there was a problem on how the texture was created for the gstreamer version, instead of ARB it was being created as 2D, just replace this in ofVideoPlayer.cpp line 448 (could be different line number in 0061):

  
tex.allocate(gstUtils.getWidth(),gstUtils.getHeight(),GL_RGB,false);  

with

  
tex.allocate(gstUtils.getWidth(),gstUtils.getHeight(),GL_RGB);  

[/quote]

Arturo, you rock the boat!!!

It works!!! WoOoOoHoOoOo!

so, now that the bug is fixed, does this actually give you the performance you need to work with HD video?

Hi Drosen, yes! :slight_smile: Always 60fps and higher… (I think there is a lock @ 60fps from the screen, it looks like it wants to go higher to 100-200 fps).