Gstreamer with Qtwidgets
-
Hi Team,
I am trying to achieve rendering of video on qtwidget using gstreamer pipeline. After searching I came across qt5videosink gstreamer plugin.
Below is the pipeline I am using.
gst-launch-1.0 videotestsrc ! qt5videosink
Pipeline is running but no out widget is opening.
Logs:
User-2:~$ gst-launch-1.0 -v videotestsrc ! qt5videosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)BGRA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive /GstPipeline:pipeline0/GstQtVideoSink_qt5:qtvideosink_qt5-0.GstPad:sink: caps = video/x-raw, format=(string)BGRA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive Pipeline is PREROLLED ... Setting pipeline to PLAYING ... Redistribute latency... New clock: GstSystemClock ^Chandling interrupt. Interrupt: Stopping pipeline ... Execution ended after 0:00:05.508780834 Setting pipeline to NULL ... Freeing pipeline ...
Could you please help me here. How to actually use qt5videosink plugin in gstreamer pipeline?
Thanks,
-
Hi and welcome to devnet,
AFAIK, this plugin is to be used within a Qt application through a custom pipeline. It won't create a widget out of nothing on the command line.
-
@SGaist ,
Qt Version
QMake version 3.1 Using Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu
Below is the example I have used using Qt Application. Still it opens up two windows.
I am running this application on my ubuntu machine.
I have took reference from QVideoWidget.
Below is the code:
#include <QApplication> #include <QMainWindow> #include <QVideoWidget> #include <QMediaPlayer> #include <QMediaPlaylist> int main(int argc, char * argv[]) { QApplication testApp(argc, argv); QMainWindow w; QVideoWidget videoWidget(&w); w.setCentralWidget(&videoWidget); QMediaPlayer *player = new QMediaPlayer(&w); player->setMedia(QUrl("gst-pipeline: videotestsrc ! xvimagesink name=\"qtvideosink\"")); player->setVideoOutput(&videoWidget); w.show(); player->play(); return testApp.exec(); }
O/P Screen Shot
As you can see in the below screenshot it is opening two windows.
Below is the error in console while I run the application
** (application:168481): CRITICAL **: 14:30:01.955: gst_vaapi_window_x11_new_with_xid: assertion 'xid != None' failed
Appreciate your help here!
Thanks
-
What happens if you use
qtvideosink
directly ?