How to show video frame by frame in Qt?
-
Hi,
You neve close mBuffer hence the error message.
-
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.
-
You're using an infinite loop that never gives control back to the main event loop so the video widget can't be refreshed.
-
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..... :)
-
You're using an infinite loop that never gives control back to the main event loop so the video widget can't be refreshed.
@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... -
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 -
@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.
-
OK, I will try, actually I tried before to understand thread in Qt, it was difficult for me to understand. Thanks again @jsulm.