Resize video
Solved
General and Desktop
-
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();
-
Hi,
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?
-
How did you do that ?
-
I had a stupid typo, thanks for the help!