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 to show video frame by frame in Qt?
Forum Updated to NodeBB v4.3 + New Features

How to show video frame by frame in Qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 5.4k Views 2 Watching
  • 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
    #2

    Hi,

    You neve close mBuffer hence the error message.

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

    1 Reply Last reply
    1
    • T Offline
      T Offline
      Tejas Virpariya
      wrote on last edited by
      #3

      Thanks @SGaist, but this is not a big issue, problem is I cannot show frame on my player using mBuffer, and ya when I store this buffer to any file and when I play this file it run successfully. How can i set media in a player? so I can show live stream.

      -Thanks
      Tejas Patel

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        You're using an infinite loop that never gives control back to the main event loop so the video widget can't be refreshed.

        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
        • T Offline
          T Offline
          Tejas Virpariya
          wrote on last edited by
          #5

          Thanks @SGaist : thats the point, now my question is where I have to put player->setmedia and player->play option?

          While loop give new data to buffer every time and I want to set this buffer into player, so please give right sequence.

          Thanks again..... :)

          -Thanks
          Tejas Patel

          1 Reply Last reply
          0
          • SGaistS SGaist

            You're using an infinite loop that never gives control back to the main event loop so the video widget can't be refreshed.

            T Offline
            T Offline
            Tejas Virpariya
            wrote on last edited by
            #6

            @SGaist Please tell me how can I handle buffer and player using thread in qt? means in a main thread buffer get data in while loop and in a thread player try to play that data.
            1.

            while(1){
                buffer->write();
            }
            

            2.

            player->setdata(....);
            player->play();
            

            I want to handle both task simultaneously.. Please guide me for this task.
            Thanks for your great interest in every question...

            -Thanks
            Tejas Patel

            1 Reply Last reply
            0
            • jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #7

              It should be other way around: player is in the main thread (because all UI related stuff must be in the main thread) and filling buffer is done in another thread. The second thread emits signal each time there is a new frame available and in main thread you connect to this signal and pass the frame to the player.
              Regarding multi-threading in Qt read this: http://doc.qt.io/qt-5/thread-basics.html

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

              1 Reply Last reply
              1
              • L Offline
                L Offline
                Lineaxe
                wrote on last edited by
                #8

                Yes that sounds like the right way to handle it when using mulithreading . You can use this overall concept for handling many other types of multithreaded projects as well as In other languages such as XNA , C# and so on ...

                1 Reply Last reply
                1
                • T Offline
                  T Offline
                  Tejas Virpariya
                  wrote on last edited by
                  #9

                  Thanks @jsulm and @Lineaxe : may you give sample code for thread? just give some lines of code how to use thread in my code for player and buffer... Thanks again...

                  -Thanks
                  Tejas Patel

                  jsulmJ 1 Reply Last reply
                  0
                  • T Tejas Virpariya

                    Thanks @jsulm and @Lineaxe : may you give sample code for thread? just give some lines of code how to use thread in my code for player and buffer... Thanks again...

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @Tejas-Virpariya Please read the documentation (I posted the link before). It is a complex topic and you should understand what you are doing, giving you some lines of code will not really help.

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

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      Tejas Virpariya
                      wrote on last edited by
                      #11

                      OK, I will try, actually I tried before to understand thread in Qt, it was difficult for me to understand. Thanks again @jsulm.

                      -Thanks
                      Tejas Patel

                      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