Important: Please read the Qt Code of Conduct -

Having a problem trying to grab a snapshot of a movie to use as an icon

  • Hi All;
    I've been looking on the web for a way to programatically open a video/movie file and grab a snapshot so i can use it for a thumbnail of the file in my app. I have found a few ways to do it on the web but none of them seem to work for me. I have tried using:
    @ QPixmap image = QPixmap::grabWindow(tVideoWidget->winId());@
    All i get is a black image. I have tried:
    @QImage image = tVideoWidget->snapshot();@
    With this i just get a null value for the image. Here is the method i have using to try to grab the frame:

    @QString Utilities::GrabSnapShot(QString aMoviePath, QWidget* aParent)
    QString tPath = Utilities::AddThumbnailToPath(aMoviePath);
    QString tThumbnailPath = RemoveExtension(tPath).append(THUMBNAIL_EXT);

    //get metadata information from the media file.
    Phonon::MediaObject* tMediaObject = new Phonon::MediaObject(aParent);
    Phonon::MediaSource* tMediaSource = new Phonon::MediaSource(aMoviePath);
    // or setCurrentSource5.m_MediaObject->play();
    Phonon::VideoWidget* tVideoWidget = new Phonon::VideoWidget(aParent);
    Phonon::createPath(tMediaObject, tVideoWidget);
    QPixmap image = QPixmap::grabWindow(tVideoWidget->winId());;
    delete tVideoWidget;
    delete tMediaSource;
    delete tMediaObject;
    return tThumbnailPath;


    From some of the posts i have seen it appears that these might be bugs. Is there another way of being able to grab the image/frame? thanks for any help.

  • not sure if you solved this old problem, but this post might help: "":

Log in to reply