title: How to display stream video frames in Qt app using Gstreamer receive from UDP socket
body: <p>I would like to use Qt Multimedia to display a video stream.
  I have run</p>
  <pre><code>@server: $gst-launch-1.0 -v videotestsrc  pattern=ball ! video/x-raw,width=1280,height=720 ! jpegenc ! rtpjpegpay ! udpsink name=sink host=localhost port=34400 sync=false async=false         
  
  @client: $gst-launch-1.0 udpsrc port=34400 caps=&quot;application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)26&quot; ! rtpjpegdepay ! jpegdec ! filesink location=a.mp4
  </code></pre>
  <p>Its working fine.
  now I want to server command on one terminal and Qt app should play the part of client so it will play video.
  I have tried one app but its not working.</p>
  <p><strong>main.cpp</strong>:</p>
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QMediaPlayer&gt;
  #include &lt;QWidget&gt;
  #include &lt;QVideoWidget&gt;
  #include &lt;QBoxLayout&gt;
  #include &lt;QProcess&gt;
  #include &lt;QDebug&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
  
      QWidget *window = new QWidget;
      QVideoWidget *videoWidget = new QVideoWidget;
      QBoxLayout *layout = new QVBoxLayout;
      QMediaPlayer *player = new QMediaPlayer;
      QProcess *process = new QProcess;
  
      layout-&gt;addWidget(videoWidget);
      window-&gt;setLayout(layout);
      window-&gt;show();
      player-&gt;setVideoOutput(videoWidget);
      QString program = &quot;gst-launch-1.0&quot;;
      QStringList arguments;
      arguments &lt;&lt; &quot;udpsrc&quot; &lt;&lt; &quot;port=34400&quot; &lt;&lt; &quot;caps=application/x-rtp, media=(string)video, 
      clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)26&quot; &lt;&lt; &quot;!&quot; &lt;&lt; &quot;rtpjpegdepay&quot; 
      &lt;&lt; &quot;!&quot; &lt;&lt; &quot;jpegdec&quot; &lt;&lt; &quot;!&quot; &lt;&lt; &quot;filesink location=a.mp4&quot; ;
      
      process-&gt;setReadChannel(QProcess::StandardError);
      process-&gt;start(program, arguments);
  
      while (!process-&gt;waitForReadyRead()) {}
  
      player-&gt;setMedia(QMediaContent(), process);
      player-&gt;play();
  
      return a.exec();
  </code></pre>
  <p><strong>project.pro</strong>:</p>
  <pre><code>QT       += core gui multimedia multimediawidgets
  
  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
  
  TARGET = video_play_file
  TEMPLATE = app
  
  
  SOURCES += main.cpp\
          dialog.cpp
  
  HEADERS  += dialog.h
  
  FORMS    += dialog.ui
  </code></pre>