QVideoWidget vs QGraphicsVideoItem
-
Hi and welcome to devnet,
Basically, the architecture behind both are not the same.
What kind of video are you trying to play ? Why would you need a QGraphicsView for that ?
-
Hi and welcome to devnet,
Basically, the architecture behind both are not the same.
What kind of video are you trying to play ? Why would you need a QGraphicsView for that ?
wrote on 13 Jul 2017, 08:40 last edited by@SGaist
The video is a test video downloaded from youtube. For example https://www.youtube.com/watch?v=qPTfXwPf_HM converted and downloaded by http://convert2mp3.net/. Using another video formats than mp4 doesn't change anything on this fact.I am trying to create a template as a multimedia widget in what user can compose different items like video, picture, graphics or animating texts for rendering on a screen. I have just startet to evaluate QGraphicsView for this purpose.
Thanks
-
Then I'd recommend taking a look at QtQuick for that kind of stuff.
-
wrote on 14 Jul 2017, 14:47 last edited by
@SGaist
Hi,
I looked at the examples qmlvideo and qmlvideofx from qt 5.9 which are implemented with QtQuick 2 and they have apparently the same problem. QVideoWidget have the best rendering behavior also compared to the QtQuick option in my opinion. With QVideoWidget there is no pixelization and no erratic playback. I don't know what the problem here. -
What are your platform and Qt version ?
-
wrote on 15 Jul 2017, 04:10 last edited by
@SGaist
I work with Windows 7 and 10. Qt Version is 5.9. I have also installed K-lite codec 13.3.3 -
Which version of 5.9 ?
-
wrote on 16 Jul 2017, 09:43 last edited by
@SGaist
I use Qt 5.9.1 MSVC 2015, 32 bit and MinGW32 bit - Open Source (LGPLv3). -
QtMM has a lot of issues, it sucks. You can try to use libVLC, ffmpeg or to use DirectShow directly (of course, if a Windows is your main platform).
-
QtMM has a lot of issues, it sucks. You can try to use libVLC, ffmpeg or to use DirectShow directly (of course, if a Windows is your main platform).
wrote on 2 Aug 2017, 07:32 last edited by@kuzulis
Thanks for response.
I have tried libVLC with QWidget and it works very well. But is there is a possibility to use it in QGraphicsScene? -
@zahi.mashael said in QVideoWidget vs QGraphicsVideoItem:
But is there is a possibility to use it in QGraphicsScene?
I don't know.
-
The VLC-Qt project provides integration with Qt so you should be able to use QGraphicsWidgetProxy.
-
wrote on 4 Aug 2017, 12:05 last edited by zahi.mashael 8 Jun 2017, 09:36
I tried to use VLC-Qt with QGraphicsProxyWidget class, but just sound is played not the video. Another peaple have already posted a similar problem with QVideoWidget like here.
I found now a solution for me with QtAV that uses ffmpeg. QtAV contains the class GraphicsItemRenderer that is a sub class of QGraphicsObject. So objects of GraphicsItemRenderer can be added directly to QGraphicsScene. Here is some code that demonstrate this (QtAV must be firstly installed in Qt, see installation instruction):
#include <QApplication> #include <QtAVWidgets> #include <QtAV> #include <QGraphicsView> using namespace QtAV; int main(int argc, char *argv[]) { QApplication a(argc, argv); AVPlayer player; GraphicsItemRenderer *item = new GraphicsItemRenderer; item->resizeRenderer(640, 360); item->setOutAspectRatioMode(VideoRenderer::VideoAspectRatio); player.setRenderer(item); QGraphicsScene *scene = new QGraphicsScene; scene->addItem(item); QGraphicsView *view = new QGraphicsView(scene); view->show(); player.play("C:/path/to/file.mp4"); return a.exec(); }
QtAV also have a qml integration, so I have now the freedom to choose between QGraphicsView or QtQuick.
I would like to thanks all very much for the tips. It was a great help.
-
The VLC-Qt project provides integration with Qt so you should be able to use QGraphicsWidgetProxy.
wrote on 7 Aug 2017, 23:17 last edited by@SGaist said in QVideoWidget vs QGraphicsVideoItem:
The VLC-Qt project provides integration with Qt so you should be able to use QGraphicsWidgetProxy.
Unfortunatelly Qt-vlc does not support embedding into QGraphicsScene by issue
https://github.com/vlc-qt/vlc-qt/issues/129@zahi-mashael , is QtAv good solution? can you pls say about performance during playing fullHD(1920x1080x60fps) video?
I have a big troubles with QVideoWidget when it using like background video-player into QGraphicsScene, fps less than 5, it's horrible) -
@SGaist said in QVideoWidget vs QGraphicsVideoItem:
The VLC-Qt project provides integration with Qt so you should be able to use QGraphicsWidgetProxy.
Unfortunatelly Qt-vlc does not support embedding into QGraphicsScene by issue
https://github.com/vlc-qt/vlc-qt/issues/129@zahi-mashael , is QtAv good solution? can you pls say about performance during playing fullHD(1920x1080x60fps) video?
I have a big troubles with QVideoWidget when it using like background video-player into QGraphicsScene, fps less than 5, it's horrible)wrote on 10 Aug 2017, 15:09 last edited by zahi.mashael 8 Oct 2017, 19:37@goldstar2154 Yes, it seems so. I played a mp4 file in Full HD, a file about 64 MB big with 2.5 minutes length, and it worked.
-
@SGaist said in QVideoWidget vs QGraphicsVideoItem:
The VLC-Qt project provides integration with Qt so you should be able to use QGraphicsWidgetProxy.
Unfortunatelly Qt-vlc does not support embedding into QGraphicsScene by issue
https://github.com/vlc-qt/vlc-qt/issues/129@zahi-mashael , is QtAv good solution? can you pls say about performance during playing fullHD(1920x1080x60fps) video?
I have a big troubles with QVideoWidget when it using like background video-player into QGraphicsScene, fps less than 5, it's horrible)wrote on 17 Aug 2017, 15:51 last edited by@goldstar2154 OK, I compared QtAV to vlc with many videos, and vlc always plays videos even better than QtAV. QtAV plays full HD videos especially in qml or as an QGraphicsItem (GraphicsItemRenderer) choppy. In vlc playing video is perfectly smooth.
I am not an expert in ffmpeg and QtAV, and there are certainly some options that can be set to improve the performance and quality of the rendering.
I am trying now to use vlc in qtquick... -
Again, the VLC-Qt project might interest you, They provide QML components.
-
Again, the VLC-Qt project might interest you, They provide QML components.
wrote on 18 Aug 2017, 07:15 last edited by@SGaist Yes. I am now working with it.
-
@goldstar2154 OK, I compared QtAV to vlc with many videos, and vlc always plays videos even better than QtAV. QtAV plays full HD videos especially in qml or as an QGraphicsItem (GraphicsItemRenderer) choppy. In vlc playing video is perfectly smooth.
I am not an expert in ffmpeg and QtAV, and there are certainly some options that can be set to improve the performance and quality of the rendering.
I am trying now to use vlc in qtquick...wrote on 18 Aug 2017, 12:39 last edited by@zahi.mashael Qt-Av provide qml components too, if you have time can you please compare Qt-av & Qt-vlc qml components? it will be interesting.
-
@zahi.mashael Qt-Av provide qml components too, if you have time can you please compare Qt-av & Qt-vlc qml components? it will be interesting.
wrote on 19 Aug 2017, 20:06 last edited by zahi.mashael@goldstar2154 I have already compared the two components and VLC-Qt qml is in my opinion better. I tested with a video that was created in adobe (1920x1080x30fps) with some move animations and movements""stutter" more with QtAV than with VLC-Qt.