title: Qt Stream IP Camera Video
body: <p>I am trying to stream the video from an IP camera using Qt multimedia (Qt 5).
  A similar question could be found here: <a href="https://stackoverflow.com/questions/21448027/play-a-live-video-stream-using-qt">Play a Live video Stream using Qt</a> but I try to avoid using an other library such as LibVLC.
  I manage to display the video from a locally stored file but not to display the stream from the IP camera.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QMediaPlayer&gt;
  #include &lt;qvideowidget.h&gt;
  #include &lt;QVideoWidget&gt;
  
  #include &lt;QDebug&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      this-&gt; resize(1000,1000);
      QMediaPlayer *mp = new QMediaPlayer(0,0);
      QMediaContent *mc = new QMediaContent(QUrl("http://96.10.1.168/mjpg/video.mjpg"));
      //QMediaContent *mc = new QMediaContent(QUrl::fromLocalFile("/Users/userName/Desktop/marsUni.mp4"));
      mp-&gt;setMedia(*mc);
     QVideoWidget *vw = new QVideoWidget(this);
     vw-&gt;setMaximumSize(704, 576);
     vw-&gt;setMinimumSize(704, 576);
  
     mp-&gt;setVideoOutput(vw);
     this-&gt;setCentralWidget(vw);
     vw-&gt;show();
     mp-&gt;play();
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  </code></pre>
  
  <p>If I uncomment the line containing QUrl::fromLocalFile, I can display the local file. If I open a network connection in VLC pointing to <a href="http://96.10.1.168/mjpg/video.mjpg" rel="nofollow">http://96.10.1.168/mjpg/video.mjpg</a>, I can display the camera stream.
  I am on Mac OS 10.9.</p>
  
  <p>Why cant I stream the video from the IP camera?
  Any comments or debugging suggestion would be appreciated.</p>