Unsolved 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:
http://doc.qt.io/qt-4.8/qt-multimedia-videowidget-example.htmlShould I just use it, or is there better way to do it in qt5?
Thanks in advance.
-
-
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.
So? -
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?
-
@przemek hi,friend,welcome
I also to learn
QtMultimedia
recently. and share a demonstration of a custom video widget to grab frames when play video.you can find that in
/Qt/Qt5.7.0/Examples/Qt-5.7/multimediawidgets/customvideosurface/customvideowidget
And,
QVideoProbe
return true on my Linux 16.04. -
QMediaService *QCamera::mediaService
QMediaService
Specifically the templated version of QMediaService::requestControl -
@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::setSource
can return true. -
-
@SGaist unfrotunately this code:
qobject_cast<QMediaVideoProbeControl*>(camera.service()->requestControl("org.qt-project.qt.mediavideoprobecontrol/5.0"));
returns null :(Maybe because I run it on Raspberry Pi?
-
Which version of Qt are you using on your Pi ?