Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Having a problem trying to grab a snapshot of a movie to use as an icon
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TwoGunBerg
    wrote on last edited by
    #1

    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);
    tMediaObject->clearQueue();
    tMediaObject->enqueue(*tMediaSource);
    
    tMediaObject->seek(5000);
    tMediaObject->play();
    // or setCurrentSource5.m_MediaObject->play();
    Phonon::VideoWidget* tVideoWidget = new Phonon::VideoWidget(aParent);
    
    Phonon::createPath(tMediaObject, tVideoWidget);
    tVideoWidget->show();
    
    QPixmap image = QPixmap::grabWindow(tVideoWidget->winId());
    image.save(tThumbnailPath);
    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.

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      not sure if you solved this old problem, but this post might help: "http://developer.qt.nokia.com/forums/viewthread/2487":http://developer.qt.nokia.com/forums/viewthread/2487

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved