Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Hi,I'm viewing 2 camera video simultanesly and recording them on linux system, but both camera lags(slow) after 3sec and I tried to put recording in Qtconcurrent::run(). but also both camera lags(slow)

Hi,I'm viewing 2 camera video simultanesly and recording them on linux system, but both camera lags(slow) after 3sec and I tried to put recording in Qtconcurrent::run(). but also both camera lags(slow)

Scheduled Pinned Locked Moved Unsolved C++ Gurus
14 Posts 4 Posters 3.1k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #5

    No you can't. You are trying to modify GUI objects from another thread than the GUI thread which is wrong and forbidden.

    You might also be trying to write twice in the same file and from the looks of it, you'd might even be deleting your camera objects while setting them up.

    Also, recording an mp4 file is a pretty heavy task, did you benchmark your computer to be sure you can support recording two streams at once ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    T 1 Reply Last reply
    1
    • SGaistS SGaist

      No you can't. You are trying to modify GUI objects from another thread than the GUI thread which is wrong and forbidden.

      You might also be trying to write twice in the same file and from the looks of it, you'd might even be deleting your camera objects while setting them up.

      Also, recording an mp4 file is a pretty heavy task, did you benchmark your computer to be sure you can support recording two streams at once ?

      T Offline
      T Offline
      thippu
      wrote on last edited by
      #6

      @SGaist I did take bench mark and I'm using highend system lenovo carbon x1.
      May I know the best and light recording file otherthan mp4 format?

      jsulmJ 1 Reply Last reply
      0
      • T thippu

        @SGaist I did take bench mark and I'm using highend system lenovo carbon x1.
        May I know the best and light recording file otherthan mp4 format?

        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #7

        @thippu What about fixing these issues first mentioned by @SGaist :
        "You are trying to modify GUI objects from another thread than the GUI thread which is wrong and forbidden.

        You might also be trying to write twice in the same file and from the looks of it, you'd might even be deleting your camera objects while setting them up."
        ?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        T 1 Reply Last reply
        0
        • jsulmJ jsulm

          @thippu What about fixing these issues first mentioned by @SGaist :
          "You are trying to modify GUI objects from another thread than the GUI thread which is wrong and forbidden.

          You might also be trying to write twice in the same file and from the looks of it, you'd might even be deleting your camera objects while setting them up."
          ?

          T Offline
          T Offline
          thippu
          wrote on last edited by
          #8

          @jsulm You might also be trying to write twice in the same file and from the looks of it, you'd might even be deleting your camera objects while setting them up."
          ? ans: No twice write rec2() function got diffrent file name so,that is not a problem for me.
          "You are trying to modify GUI objects from another thread than the GUI thread which is wrong and forbidden. ans: I want there should no lag in cameras view thats y went to do in diffrent thread but I dono how to avoid lags
          plz help me

          jsulmJ 1 Reply Last reply
          0
          • T thippu

            @jsulm You might also be trying to write twice in the same file and from the looks of it, you'd might even be deleting your camera objects while setting them up."
            ? ans: No twice write rec2() function got diffrent file name so,that is not a problem for me.
            "You are trying to modify GUI objects from another thread than the GUI thread which is wrong and forbidden. ans: I want there should no lag in cameras view thats y went to do in diffrent thread but I dono how to avoid lags
            plz help me

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #9

            @thippu Never modify any GUI related classes from other thread than GUI thread. From other threads you should emit signals if something needs to be changed in the GUI.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            T 1 Reply Last reply
            0
            • mrdebugM Offline
              mrdebugM Offline
              mrdebug
              wrote on last edited by mrdebug
              #10

              Are you using a embedded device?
              With a Raspberry Pi I can watch only one camera without to have problem.

              I'm watching 4 videocameras with a Pentium 4 and more than 8 with a Intel Core 2 duo, with motion detection ...

              To do this I'm using the FFMpeg libs for the rtsp cameras and OpenCV for the /dev/video* cameras.

              I suggest you to use a dedicated object (thread) for each camera and, if you want to watch and not only to store, to emit an event for each frame.

              Please considered that if you are resizing the frames that it is very cpu expensive activity.

              Need programmers to hire?
              www.labcsp.com
              www.denisgottardello.it
              GMT+1
              Skype: mrdebug

              T 1 Reply Last reply
              1
              • mrdebugM mrdebug

                Are you using a embedded device?
                With a Raspberry Pi I can watch only one camera without to have problem.

                I'm watching 4 videocameras with a Pentium 4 and more than 8 with a Intel Core 2 duo, with motion detection ...

                To do this I'm using the FFMpeg libs for the rtsp cameras and OpenCV for the /dev/video* cameras.

                I suggest you to use a dedicated object (thread) for each camera and, if you want to watch and not only to store, to emit an event for each frame.

                Please considered that if you are resizing the frames that it is very cpu expensive activity.

                T Offline
                T Offline
                thippu
                wrote on last edited by
                #11

                @mrdebug Thnx for the replay and suggestions
                please send me example code or code which u have developed to my email : thippeswamydcts@gmail.com
                for this : "I suggest you to use a dedicated object (thread) for each camera and, if you want to watch and not only to store, to emit an event for each frame."

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @thippu Never modify any GUI related classes from other thread than GUI thread. From other threads you should emit signals if something needs to be changed in the GUI.

                  T Offline
                  T Offline
                  thippu
                  wrote on last edited by
                  #12

                  @jsulm hey is there any source, i can get to understand the gui thread like how to those gui threads are there and what we shouldnot do.

                  jsulmJ 1 Reply Last reply
                  0
                  • T thippu

                    @jsulm hey is there any source, i can get to understand the gui thread like how to those gui threads are there and what we shouldnot do.

                    jsulmJ Online
                    jsulmJ Online
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    @thippu http://doc.qt.io/qt-5/threads-technologies.html
                    https://doc.qt.io/qt-5.10/thread-basics.html
                    https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    T 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @thippu http://doc.qt.io/qt-5/threads-technologies.html
                      https://doc.qt.io/qt-5.10/thread-basics.html
                      https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/

                      T Offline
                      T Offline
                      thippu
                      wrote on last edited by
                      #14

                      @jsulm Thank u so much

                      1 Reply Last reply
                      0

                      • Login

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