Jump to content
  • Advertisement
Sign in to follow this  

OpenGL OpenGL video player with multiple displays

This topic is 2853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I am working on video player which have to play 2 video files on 2 monitors. Program is using ffmpeg for video encoding and it must work on Windows and on Linux, so I choose OpenGL for video rendering. I tried to use GLUT (FreeGLUT) to open multiple windows but with it I can't find the number and positions of multiple displays, so I continue with native platform solutions. Currently I'm working on Windows version and I managed to open two windows, each on seperate monitors and display video on both.

Now for the problem...

The framerate is slow! I have two displays (1920 x 1080 each) and video files of same resolution (HD) and I get about 30 FPS per display. The program have 2 threads, one for encoding and one for displaying, input and stuff. Video is rendered via texture (I tried to use glDrawPixels, but it is slow when it comes to 1920x1080 image size). I done the following optimizations:
- texture loading with usage of PBO extension (http://www.songho.ca/opengl/gl_pbo.html)
- texture updating with GL_RGBA/GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV method (http://forums.inside3d.com/viewtopic.php?t=2465)

Does anyone have any experience with OpenGL based video players and have any suggestions?

Oh, and of causer, my configuration:
Intel Core2Duo E7500, 4GB of RAM, GeForce 8400 GS

If more info is needed about program functionality, I will reply.

Thanks in advance.

Share this post

Link to post
Share on other sites
1) How many fps is the video? unless you are doing something else, you only need to show stuff that quickly.

2) Run a profiler on it.
HD video decoding takes a lot of time, is that the bottleneck?
Do you have VSYNC on? cause then you'd be limited to 60/30/15 fps.
The profiler should tell you if you're waiting around for the texture to upload to the video card, but that seems doubtful that it is the limiting factor.

3) You keep saying "encoding". Do you mean "decoding"? or have I missed something about your post?

Share this post

Link to post
Share on other sites
Thanks for reply.

1) My test video is 60 Hz but I will also have to prepare program for 120 Hz video files!

2) The profiler says that I am 100% time in you2rgb_c_32 function. I think that it is impossible because when I bypass YUV->RGB conversion profiler says 100% time in av_find_stream_info, and FPS is no better. Maybe something is wrong with profiler and multi thread application, I'm using Codeblocks + MinGW and Gprof plugin.
Also to mention that for YUV->RGB conversion I'm using swscale (from ffmpeg)
I done some profile manually, but it's difficult to track threads. This is what I find out for first thread
- set GL context : 9.766808 ms
- update GL texture : 6.098594 ms
- do Windows events : 0.191325 ms
- set GL context : 10.978595 ms
- update GL texture : 6.062743 ms
- do Windows events : 0.149196 ms
set GL context just calls wglMakeCurrent(win->hDC, win->hRC). Is it possible that this function is so slow?

3) Sorry, it's my mistake, I'm decoding :)

Yes, and VSYNC is off

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!