Nominate our 2022 Qt Champions!

Directshow frames rendering in a QLabel

  • Hello everyone!,
    Im testing directshow in qt for videoplayback. I know I can use phonon to play video files in a widget but I need to get each frame from the video file for further processing(opencv processing, or for a opengl texture....), but phonon doesnt allow me to do that (although theres snapshot function but its not working or not yet implemented).

    So I decided to go with directshow in windows platform and get each frame from there. I succesfully copy the framebuffer that directshow gives me when theres a frame available and displayed it on a QLabel in a MainWindow.
    This first Qlabel im talking about was ceated with the qtdesigner(I just grab a qlabel from the designer and put it in the .ui) ,but when I make a QLabel attribute in my class and then pass each frame to the qlabel........ :( , I get very slow performance and my program almost crash! and doesnt even respond sometimes.
    Ive make several copies from the frame buffer and display them in several qlabels created in the designer (ive been testing up to 10 ) and i get video playback with no frame drops or any weird performance at all :D but no succes with an attribute with qlabel type....

    I would appreciate any help you guys can give me to know weres my mistake .........


  • :D I found my error ..... dumb error lol..... The directshow code was perfect the problem was when scaling the frame i get from directshow. I was setting up the qpixmap of the qlabel first and then scaling it :$ dont know why that slows down the rendering..... Im not a c++ or directshow expert but if someone need help in this area Illl be happy to share what I know about the subject.

  • Hey,
    I know this is quite old, but I'd be interested in how you implemented this.
    I even dare to kindly ask if you could provide me with the code you used to import a video file with directshow until before processing the individual frames.


Log in to reply