You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Sunday, April 29th 2012, 6:23pm

How to achieve completely smooth HD video rendering in Qt?

Ok here is my problem, I cannot get completely smooth HD video playback in Qt when trying to play a video in 30 FPS.
I don't want to use Phenon player so instead I'm playing the videoframe in a QGLWidget by rendering a quad with a texture of the video frame on it.

Here comes the strange part, when I play the video without and an fps lock (created with a highperformance timer for Windows (QueryPerformanceTimer)) the video runs at around 60 fps and the video looks reallysmooth most of the time.
As soon as I turn on the FPS lock the video starts to look a little bit choppy, not much but its annoying. If I update the glWidget 2 times each update the video looks a bit smoother.
When playting the video with windows media player or VLC player it is completely smooth, so it should be possible to achieve.
I've also tried setting different priorities of the threads and processed and also tried turning on vsync but nothing helped.
It seems like Qt is a bit inconsistent when updating the glWidget. I've also tried QGraphicalView with opengl support but with the same result.
Its also worth to mention that the video is also captured in a separate thread.

If I run the video at 60 FPS but displaying the same image 2 times it actually looks smooth but its a really ugly hack.

It feels like I've tried everything but obviously there must be something I've missed because obviously it's smooth on VLC player which is created in Qt.

Any good ideas?
It must be other than me that have faced the same problem, help appreciated!