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. Resize video
Qt 6.11 is out! See what's new in the release blog

Resize video

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 3.6k 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.
  • Jonathan LevanonJ Offline
    Jonathan LevanonJ Offline
    Jonathan Levanon
    wrote on last edited by
    #1

    Hi, I'm using a QVideoWidget to play some videos. However, the videos come in all kinds of size and I want my application to scale them to a given size. Is this possible? It there anything similar to QImage::scale for videos? This is what I have done so far, it displays the video in their original size. Thanks

    player = new QMediaPlayer;
    playlist = new QMediaPlaylist(player);
    videoWidget = new QVideoWidget(this);
    updatePlayList("path/to/videos");
    player->setMedia(playlist);
    QDir recoredDir(dir);
    

    loading - updatePlayList method

    QStringList filesToDisp = recoredDir.entryList(QDir::NoDotAndDotDot
                                                       | QDir::Files);
    for (int i = 0; i < filesToDisp.size(); ++i) {
            QString fileName = filesToDisp[i];
            if (isSupported(fileName)) {
                QMediaContent c(QUrl::fromLocalFile(dir + "/" +fileName));
                playlist->addMedia(c);
            }
        }
    

    Init the widget and playing

    videoDisplay* V = new videoDisplay(nullptr);
    V->show();
    V->play();
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can fix the size of your video player if you don't want it to change.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Jonathan LevanonJ Offline
        Jonathan LevanonJ Offline
        Jonathan Levanon
        wrote on last edited by
        #3

        I tried to change the size of the qvideowidget, but it doesn't help. The videos are still displayed with different sizes. You mean changing the size of the player itself? How?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How did you do that ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Jonathan LevanonJ Offline
            Jonathan LevanonJ Offline
            Jonathan Levanon
            wrote on last edited by
            #5

            I had a stupid typo, thanks for the help!

            1 Reply Last reply
            1

            • Login

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