Showing video from camera and capture frames in the same time
I would like to be able to show what camera records, but also in the same time grab frames from it to perform some processing.
Right now I have two options, either:
- Implement QAbstractVideoSurface to get the frames or
- Use VideoWidget to show what is being recorded
How can I achieve to have both? I would like to avoid duplicating quite some complicated code from VideoWidget. I would like my QAbstractVideoSurface to draw the frames in the same efficient way as VideoWidget does. Before I just used QLabel with setting a QPixmap and the difference is noticeable.
I am aware of QVideoProbe but it doesn't work on Linux.
Maybe is there a way to pass my VideoSurface to the internals of VideoWidget, so that I can just signal the incoming frame?
I am also aware of this example:
Should I just use it, or is there better way to do it in qt5?
Thanks in advance.
Hi and welcome to devnet,
QVideoProbe comes to mind for that.
Hope it helps
Yeah.... but it doesn't work. What I found is that VideoProbe and Camera only works on Android.
setSource on QVideoProbe with QCamera returns false.
What platform are you targeting ?
@SGaist Linux, Ubuntu 16.04
Anyone can help me here?
What processing do you have in mind ?
I just need the frames from the video. I am using 3rd party library to recognize faces.
After a quick check in the sources, it seems that the gstreamer backend provides a QMediaVideoProbeControl through the camera service, did you try to retrieve it ?
No. Can you guide me a little how to receive that from camera service?
I also to learn
QtMultimediarecently. and share a demonstration of a custom video widget to grab frames when play video.
you can find that in
QVideoProbereturn true on my Linux 16.04.
@joeQ But does it return true when you previously called setSource to QCamera? I learned somewhere that it returns true for a video source, but for QCamera only on android.
in my Ubuntu Kylin 16.04 LTS and Qt 5.8.0
I used QVideoPlayer to play video file. it
QVideoProbe::setSourcecan return true.
@SGaist unfrotunately this code:
returns null :(
Maybe because I run it on Raspberry Pi?
Which version of Qt are you using on your Pi ?