Important: Please read the Qt Code of Conduct -

Resize video

  • 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);
    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));

    Init the widget and playing

    videoDisplay* V = new videoDisplay(nullptr);

  • Lifetime Qt Champion


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

  • 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?

  • Lifetime Qt Champion

    How did you do that ?

  • I had a stupid typo, thanks for the help!

Log in to reply