Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i get an streaming video from an IP Camera or DVR ?
QtWS25 Last Chance

How can i get an streaming video from an IP Camera or DVR ?

Scheduled Pinned Locked Moved General and Desktop
ip-cameracameradvrstreamingrtsp
10 Posts 2 Posters 8.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alirezatkh2
    wrote on 3 Oct 2015, 06:04 last edited by
    #1

    Hi every body,

    How can I get an streaming video from an IP camera or DVR in QT? I use widgets, QT 5.3.2 .
    I have vivotek Camera model IP7130 but I want my app to be compatible with most of Cameras! I found somethings about RTSP Protocol or Camera SDK but I didn't understand how to use them. Please help me.

    Thanks.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      LuGRU
      wrote on 3 Oct 2015, 08:42 last edited by
      #2

      Qt don't have support for RTSP, it do have multimedia module but this still won't help to achieve that.
      To connect and receive frames from camera's third party libraries like libVlc or FFmpeg could be used.
      libVlc is simple enough - You even can test this library to see if it will work with Your camera by using VLCPlayer, just connect to camera and see if this do work. If it does, then just use it with Qt. Qt will be Ui library allowing You to display received video frames (and / or sound) and libVlc to acquire data from web cam. Same for FFmpeg.

      A 1 Reply Last reply 4 Oct 2015, 10:36
      1
      • L LuGRU
        3 Oct 2015, 08:42

        Qt don't have support for RTSP, it do have multimedia module but this still won't help to achieve that.
        To connect and receive frames from camera's third party libraries like libVlc or FFmpeg could be used.
        libVlc is simple enough - You even can test this library to see if it will work with Your camera by using VLCPlayer, just connect to camera and see if this do work. If it does, then just use it with Qt. Qt will be Ui library allowing You to display received video frames (and / or sound) and libVlc to acquire data from web cam. Same for FFmpeg.

        A Offline
        A Offline
        alirezatkh2
        wrote on 4 Oct 2015, 10:36 last edited by alirezatkh2 10 Apr 2015, 10:43
        #3

        @LuGRU
        Thank you for answering.
        I checked libVLC ! I installed it and compiled simple player of github. But at running the app crashed. I don't know why! I use windows 7 32 bit and qt 5.3.2. I used libVLC of github!

        I searched a lot for the problem but most of them were for linux and a few for windows which didn't have a good solution.

        Do you have any idea?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          LuGRU
          wrote on 4 Oct 2015, 10:56 last edited by LuGRU 10 Apr 2015, 10:58
          #4

          If application crash on start then You probably forgot to place either libvlc dll's into application directory or plugin directory.
          Download fastest solution, download VLCPlayer and copy "plugins" directory and libvlc.dll + libvlccore.dll into app directory.

          BTW. google around and You will find Qt wrapper for libvlc, and second more mature project with all widget and simple API (this one uses FFmpeg), sorry forgot names of those projects.

          A 1 Reply Last reply 4 Oct 2015, 11:43
          0
          • L LuGRU
            4 Oct 2015, 10:56

            If application crash on start then You probably forgot to place either libvlc dll's into application directory or plugin directory.
            Download fastest solution, download VLCPlayer and copy "plugins" directory and libvlc.dll + libvlccore.dll into app directory.

            BTW. google around and You will find Qt wrapper for libvlc, and second more mature project with all widget and simple API (this one uses FFmpeg), sorry forgot names of those projects.

            A Offline
            A Offline
            alirezatkh2
            wrote on 4 Oct 2015, 11:43 last edited by
            #5

            @LuGRU
            I downloaded vlcplayer last version and installed it, then copied plugins folder + libvlc.DLL + libvlccore.DLL from installation folder in Program Files dir , and pasted in my app directory next to .pro file of my qt projet. Again app crashed just after building!
            Qt says :
            the program has unexpectedly finished.
            E:\.........\myprog.exe crashed

            I checked debug mode to find the line which has problem but debug is finished just after starting and says the error:
            During startup program exited with code 0xc0000135

            I checked plugins Dir of my libVLC but it didn't work too.

            Please help me if I forgot sth.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alirezatkh2
              wrote on 5 Oct 2015, 04:51 last edited by alirezatkh2 10 May 2015, 04:53
              #6

              Here is my simple Code:

              vlcplayer.pro :

              QT       += core gui
              
              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
              
              TARGET = vlcplayer
              TEMPLATE = app
              
              
              SOURCES += main.cpp\
                      mainwindow.cpp
              
              HEADERS  += mainwindow.h
              
              FORMS    += mainwindow.ui
              
              LIBS       += -lvlc-qt -lvlc-qt-widgets
              
              LIBS += -LE:\Qt\libvlc\lib
              INCLUDEPATH += E:\Qt\libvlc\include\
              

              main.cpp :

              #include "mainwindow.h"
              #include <QApplication>
              #include <vlc-qt/Common.h>
              #include <QDebug>
              
              int main(int argc, char *argv[])
              {
                  QApplication app(argc, argv);    
              
                  VlcCommon::setPluginPath(app.applicationDirPath() + "/plugins");     //if I comment this line app will start correctly.
              
                  MainWindow w;
                  w.show();
              
                  return app.exec();
              }
              

              mainwindow.h :

              #include <QMainWindow>
              
              namespace Ui {
              class MainWindow;
              }
              
              
              class MainWindow : public QMainWindow
              {
                  Q_OBJECT
              
              public:
                  explicit MainWindow(QWidget *parent = 0);
                  ~MainWindow();
              
              private:
                  Ui::MainWindow *ui;
              };
              

              mainwindow.cpp :

              #include "mainwindow.h"
              #include "ui_mainwindow.h"
              
              MainWindow::MainWindow(QWidget *parent) :
                  QMainWindow(parent),
                  ui(new Ui::MainWindow)
              {
                  ui->setupUi(this);
              }
              
              MainWindow::~MainWindow()
              {
                  delete ui;
              }
              

              mainwindow.ui :

              <?xml version="1.0" encoding="UTF-8"?>
              <ui version="4.0">
               <class>MainWindow</class>
               <widget class="QMainWindow" name="MainWindow">
                <property name="geometry">
                 <rect>
                  <x>0</x>
                  <y>0</y>
                  <width>400</width>
                  <height>300</height>
                 </rect>
                </property>
                <property name="windowTitle">
                 <string>MainWindow</string>
                </property>
                <widget class="QWidget" name="centralWidget"/>
                <widget class="QMenuBar" name="menuBar">
                 <property name="geometry">
                  <rect>
                   <x>0</x>
                   <y>0</y>
                   <width>400</width>
                   <height>21</height>
                  </rect>
                 </property>
                </widget>
                <widget class="QToolBar" name="mainToolBar">
                 <attribute name="toolBarArea">
                  <enum>TopToolBarArea</enum>
                 </attribute>
                 <attribute name="toolBarBreak">
                  <bool>false</bool>
                 </attribute>
                </widget>
                <widget class="QStatusBar" name="statusBar"/>
               </widget>
               <layoutdefault spacing="6" margin="11"/>
               <resources/>
               <connections/>
              </ui>
              

              Is there any thing wrong in my code?
              please help?

              1 Reply Last reply
              0
              • L Offline
                L Offline
                LuGRU
                wrote on 5 Oct 2015, 10:25 last edited by
                #7

                I downloaded vlcplayer last version and installed it, then copied plugins folder + libvlc.DLL + libvlccore.DLL from installation folder in Program Files dir , and pasted in my app directory next to .pro file of my qt projet.

                You need to paste those files to directory where binary is (.exe).

                A 1 Reply Last reply 6 Oct 2015, 04:53
                0
                • L LuGRU
                  5 Oct 2015, 10:25

                  I downloaded vlcplayer last version and installed it, then copied plugins folder + libvlc.DLL + libvlccore.DLL from installation folder in Program Files dir , and pasted in my app directory next to .pro file of my qt projet.

                  You need to paste those files to directory where binary is (.exe).

                  A Offline
                  A Offline
                  alirezatkh2
                  wrote on 6 Oct 2015, 04:53 last edited by alirezatkh2 10 Jun 2015, 05:36
                  #8

                  @LuGRU
                  I copied them where .exe is, but again it didn't work. it just same as before!
                  Maybe I should do sth in libVLC like build or update or cache! is it right?
                  perhaps I'm using wrong lib! could you give me a right URL for libVLC for Win7 32bit? I will check it.
                  Maybe the problem is related to cmake or qmake! I think qt use qmake as default and I don't know how to enable cmake? even I dont know what are these....
                  its hopeless that i couldn't run a simple app!

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    alirezatkh2
                    wrote on 6 Oct 2015, 06:34 last edited by
                    #9

                    the app started, I must have copied libvlc-qt.dll + libvlc-qt-widgets.dll too, where .exe is.

                    but another problem comes. when I promote a widget to VlcVideoWidget Class just before starting Microsoft Visual C++ Runtime Library comes up with a error that says: "This application has requested the Runtime to terminate it in an unusual way".

                    after pressing "OK" in error window, windows says: "myapp.exe has stpped working".

                    and qt says:
                    QWidget: Must contrust a QApplication before a QWidget
                    Invalid parameter passed to C runtime function.
                    Invalid parameter passed to C runtime function.

                    I got angry. problem after problem..... any idea?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      alirezatkh2
                      wrote on 10 Oct 2015, 05:02 last edited by
                      #10

                      Is anybody here who have worked with libVLC without any problem?

                      is it a convenience library or a lib with a lot of problem?

                      please help me?

                      1 Reply Last reply
                      0

                      10/10

                      10 Oct 2015, 05:02

                      • Login

                      • Login or register to search.
                      10 out of 10
                      • First post
                        10/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved