Unsolved However I set the pixelformta of camera but I didn't receive that pixelfomat from qabstractvideosurface
-
Look at the following codes however I set the camera pixel format but received formats does not follow the settings also the startTime and endTime both returns -1
I'm using android which everybody said that this OS support NV_21 pixelformat
main.cpp
QAbstractVideoSurface * surfacer = new VideoSurfacer; QCamera cam ( QCameraInfo::availableCameras ( ).at ( 0 ) ); cam.setCaptureMode ( QCamera::CaptureMode::CaptureViewfinder ); cam.setViewfinder ( surfacer ); QCameraViewfinderSettings settings = cam.viewfinderSettings ( ); settings.setMaximumFrameRate ( 5 ); settings.setMinimumFrameRate ( 1 ); settings.setPixelAspectRatio ( 4, 3 ); settings.setPixelFormat ( QVideoFrame::Format_NV21 ); settings.setResolution ( 800, 600 ); cam.setViewfinderSettings ( settings ); cam.start ( ); qDebug ( ) << cam.viewfinderSettings ( ).pixelFormat ( ) << endl; // Format NV_21
videosurfacer.cpp
bool VideoSurfacer::present ( const QVideoFrame & f ) { QVideoFrame frame ( f ); if ( frame.isValid ( ) && frame.map ( QAbstractVideoBuffer::MapMode::ReadOnly ) ) { qDebug ( ) << frame.pixelFormat ( ) << endl; //Format_ABGR32 frame.unmap ( ); } return true; }
-
Hi,
Did you check the values returned by QCamera::supportedViewfinderPixelFormats ?
-
Yes returns a list with size of 0
-
How did you called ?
-
qDebug ( ) << cam.supportedViewfinderSettings ( ).size ( ) << endl; // output is : 0
-
@SGaist also
qDebug ( ) << cam.supportedViewfinderPixelFormats ( settings ).size ( ) << endl;
didn't show anything other than 0
-
@SGaist I use an example of QML which works (only a camera with a videooutput) how can I get the pixelformat of this project video frames?
-
IIRC, QtQuick video's output supports a larger range of formats without conversions or rather, the conversion is done in the last shader of the rendering pipeline,