QCamera record video, but fps is very low.
-
Dear Qt
I'm trying to use the QCamera record video with QMediaRecorder, but the video frame rate recorded by QMediaRecorder is very low.
Below is my core code.
void Camera_Dev::initCamera(QCamera::CaptureModes mode)
{
const QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
for (const QCameraInfo &cameraInfo : cameras) {
qDebug() << "camera name: " << cameraInfo.deviceName() << Qt::endl;
if (cameraInfo.deviceName() == "/dev/video0") {
m_camera = new QCamera(cameraInfo);
connect(m_camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(onCamera_State_Changed(QCamera::State)));
m_viewFinder = new QCameraViewfinder();
QCameraViewfinderSettings set;
if (cameraInfo.description() == "UC40A Audio: UC40A Video") {
qDebug() << "High Quality Camera starts!";
QCameraViewfinderSettings set;
set.setPixelFormat(QVideoFrame::PixelFormat::Format_YUV420P);
set.setMaximumFrameRate(30);
set.setMinimumFrameRate(30);
set.setResolution(1920,1080);
set.setPixelAspectRatio(1, 1);
m_camera->setViewfinderSettings(set);
}
m_camera->setViewfinderSettings(set);
m_imageCapture = new QCameraImageCapture(m_camera);
m_viewFinder->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
m_camera->setViewfinder(m_viewFinder);m_recorder = new QMediaRecorder(m_camera); m_recorder->setMuted(true); QVideoEncoderSettings settings = m_recorder->videoSettings(); settings.setResolution(1920,1080); settings.setCodec("video/mpeg, mpegversion=(int)4, systemstream=(boolean)false"); settings.setQuality(QMultimedia::NormalQuality); settings.setEncodingMode(QMultimedia::ConstantBitRateEncoding); settings.setFrameRate(30); m_recorder->setVideoSettings(settings); m_camera->setCaptureMode(mode); m_viewFinder->show(); m_camera->start();}
-----------------------V4L2 camera infos --------------------------
$sudo v4l2-ctl --all --list-formats-ext
Driver Info (not using libv4l2):
Driver name : uvcvideo
Card type : UC40A Audio: UC40A Video
Bus info : usb-0000:00:14.0-5
Driver version: 4.15.18
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 3840/2160
Pixel Format : 'YUYV'
Field : None
Bytes per Line : 7680
Size Image : 16588800
Colorspace : sRGB
Transfer Function : Default
YCbCr Encoding : Default
Quantization : Default
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 3840, Height 2160
Default : Left 0, Top 0, Width 3840, Height 2160
Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 3840, Height 2160
Selection: crop_bounds, Left 0, Top 0, Width 3840, Height 2160
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 1.000 (1/1)
Read buffers : 0
brightness (int) : min=0 max=255 step=1 default=60 value=60
contrast (int) : min=0 max=255 step=1 default=32 value=32
saturation (int) : min=0 max=255 step=1 default=45 value=45
hue (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto (bool) : default=1 value=1
gamma (int) : min=100 max=300 step=1 default=120 value=120
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : Motion-JPEG
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 3840x2160
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 2592x1944
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 2688x1512
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 2048x1536
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 1600x1200
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 1280x960
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 960x540
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)Index : 1 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2 Size: Discrete 640x480 Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 3840x2160 Interval: Discrete 1.000s (1.000 fps) Size: Discrete 2592x1944 Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 2688x1512 Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 2048x1536 Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 1920x1080 Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 1600x1200 Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 1280x960 Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 1280x720 Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 960x540 Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 800x600 Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps) Interval: Discrete 1.000s (1.000 fps) Size: Discrete 640x360 Interval: Discrete 0.040s (25.000 fps) Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) Interval: Discrete 0.333s (3.000 fps) Interval: Discrete 0.500s (2.000 fps)The frame rate is OK through the viewfinder, but falls down after run the record() method.
Debug information about recorder QVideoEncoderSettings:
Recorder frameRate: 30
Recorder resolution: QSize(1920, 1080)
Recorder codec: "video/mpeg, mpegversion=(int)4, systemstream=(boolean)false"
Recorder encodingMode: 1
Recorder bitRate: -1
Recorder quality: 0 -
Hi and welcome to devnet,
Since you are on Linux, what happens if you use GStreamer directly to do the recording with the same parameters ?
-
Hi and welcome to devnet,
Since you are on Linux, what happens if you use GStreamer directly to do the recording with the same parameters ?
@SGaist Thanks for reply.
I tested with the GStramer tool as below:-
gst-launch-1.0 -v v4l2src num-buffers=1500 ! video/x-raw,width=1920,height=1080 ! queue ! progressreport ! theoraenc ! oggmux ! filesink location=videotestsrc.ogg
-- This video codec(theora) and container(ogg) is same as the QCamera recorded, and lost most of frame, too. -
gst-launch-1.0 -e v4l2src ! 'video/x-raw,width=1920,height=1080,framerate=30/1' ! queue ! x264enc tune=zerolatency ! mux. alsasrc ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=test.mp4 sync=false
-- This video codec is H264 and container is quicktime, it doesn't lose any frame and is very smooth. I tried to config the same codec and container in Qt program, but the recorder will freeze and can not genera worked video.
How can the Qt record a smooth video with the Qcamera API? Thanks.
-
-
I don't think you can be as detailed in your pipeline setup using QCamera. Maybe a custom pipeline using QMediaPlayer might be an option.
-
I don't think you can be as detailed in your pipeline setup using QCamera. Maybe a custom pipeline using QMediaPlayer might be an option.
@SGaist said in QCamera record video, but fps is very low.:
QMediaPlayer
Use the QMediaPlayer to record camera video? The QMediaPlayer seems can not control the camera device.
Do you mean QMediaRecorder? I've been using it when write this issue.Generally, how to record video from webcam by Qt?
Now , I use the QMediaPlayer to record, but lost too much frame causes the video can not be played smoothly.should be QMediaRecorder
Thanks very much.
-
I don't think you can be as detailed in your pipeline setup using QCamera. Maybe a custom pipeline using QMediaPlayer might be an option.
I found that if I set the QVideoFrame::PixelFormat to Format_YUYV, the vieweFinder will lost frame as well.
Cause this camera can only support 1 FPS with YUYV Pixel format.Index : 1
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUYV 4:2:2
Size: Discrete 640x480
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
Interval: Discrete 0.333s (3.000 fps)
Interval: Discrete 0.500s (2.000 fps)
Interval: Discrete 1.000s (1.000 fps)
Size: Discrete 3840x2160
Interval: Discrete 1.000s (1.000 fps)I know the viewFinder can set the pixel with QCameraViewfinderSettings::setPixelFormat() function.
But how to set the video recorder or frame pixel to 'MJPG'?By the way, video can be record nice and smoothly by "cheese" app.
Thanks very much.
-
Did you check the values returned by the various supportedXXX methods of QMediaRecorder ?
-
@SGaist Yes, as below.
recorder->supportedResolutions len = 12
Recorder Resolutions size = QSize(640, 360)
Recorder Resolutions size = QSize(640, 480)
Recorder Resolutions size = QSize(800, 600)
Recorder Resolutions size = QSize(960, 540)
Recorder Resolutions size = QSize(1280, 720)
Recorder Resolutions size = QSize(1280, 960)
Recorder Resolutions size = QSize(1600, 1200)
Recorder Resolutions size = QSize(1920, 1080)
Recorder Resolutions size = QSize(2048, 1536)
Recorder Resolutions size = QSize(2688, 1512)
Recorder Resolutions size = QSize(2592, 1944)
Recorder Resolutions size = QSize(3840, 2160)
Recorder container = "video/quicktime, variant=(string)3gpp"
Recorder container = "audio/x-aiff"
Recorder container = "video/x-ms-asf"
Recorder container = "video/x-msvideo"
Recorder container = "video/x-flv"
Recorder container = "video/quicktime, variant=(string)iso-fragmented"
Recorder container = "video/x-matroska"
Recorder container = "video/x-matroska-3d"
Recorder container = "audio/x-matroska"
Recorder container = "video/mj2"
Recorder container = "video/quicktime, variant=(string)iso"
Recorder container = "video/mpeg, mpegversion=(int)2, systemstream=(boolean)true"
Recorder container = "video/mpegts, systemstream=(boolean)true"
Recorder container = "application/mxf"
Recorder container = "application/ogg"
Recorder container = "audio/ogg"
Recorder container = "video/ogg"
Recorder container = "video/quicktime, variant=(string)apple"
Recorder container = "video/quicktime"
Recorder container = "audio/x-wav"
Recorder container = "audio/x-rf64"
Recorder container = "video/webm"
Recorder container = "audio/webm"
Recorder container = "video/quicktime, variant=(string)3g2"
Recorder container = "application/x-gst-av-a64"
Recorder container = "application/x-gst-av-adx"
Recorder container = "audio/x-amr-nb-sh"
Recorder container = "application/x-gst-av-apng"
Recorder container = "application/x-gst-av-ast"
Recorder container = "audio/x-au"
Recorder container = "application/x-gst-av-avm2"
Recorder container = "application/x-gst-av-bit"
Recorder container = "application/x-gst-av-caf"
Recorder container = "application/x-gst-av-dash"
Recorder container = "application/x-gst-av-daud"
Recorder container = "video/x-dv, systemstream=(boolean)true"
Recorder container = "application/x-gst-av-dvd"
Recorder container = "application/x-gst-av-f4v"
Recorder container = "application/x-gst-av-ffm"
Recorder container = "application/x-gst-av-filmstrip"
Recorder container = "application/gxf"
Recorder container = "application/x-gst-av-hds"
Recorder container = "application/x-gst-av-hls"
Recorder container = "application/x-gst-av-ico"
Recorder container = "application/x-gst-av-ilbc"
Recorder container = "video/quicktime, variant=(string)ipod"
Recorder container = "application/x-gst-av-ircam"
Recorder container = "application/x-gst-av-ismv"
Recorder container = "application/x-gst-av-ivf"
Recorder container = "application/x-gst-av-latm"
Recorder container = "application/x-gst-av-md5"
Recorder container = "application/x-gst-av-mkvtimestamp_v2"
Recorder container = "application/x-gst-av-mmf"
Recorder container = "video/mpeg, systemstream=(boolean)true"
Recorder container = "application/x-gst-av-mxf_opatom"
Recorder container = "application/x-gst-av-nut"
Recorder container = "application/x-gst-av-oga"
Recorder container = "application/x-gst-av-oma"
Recorder container = "application/x-gst-av-opus"
Recorder container = "video/quicktime, variant=(string)psp"
Recorder container = "application/x-pn-realmedia, systemstream=(boolean)true"
Recorder container = "application/x-gst-av-rso"
Recorder container = "application/x-gst-av-rtsp"
Recorder container = "application/x-gst-av-sap"
Recorder container = "application/x-gst-av-singlejpeg"
Recorder container = "application/x-gst-av-smjpeg"
Recorder container = "application/x-gst-av-smoothstreaming"
Recorder container = "application/x-gst-av-sox"
Recorder container = "application/x-gst-av-spdif"
Recorder container = "application/x-gst-av-spx"
Recorder container = "application/x-gst-av-svcd"
Recorder container = "application/x-shockwave-flash"
Recorder container = "application/x-gst-av-uncodedframecrc"
Recorder container = "application/x-gst-av-vc1test"
Recorder container = "application/x-gst-av-vcd"
Recorder container = "application/x-gst-av-vob"
Recorder container = "audio/x-voc"
Recorder container = "application/x-gst-av-w64"
Recorder container = "application/x-gst-av-webp"
Recorder container = "application/x-gst-av-wtv"
Recorder container = "audio/mpeg, mpegversion=(int)1"
Recorder rec_FrameRate = 1
Recorder rec_FrameRate = 2
Recorder rec_FrameRate = 3
Recorder rec_FrameRate = 5
Recorder rec_FrameRate = 7.5
Recorder rec_FrameRate = 10
Recorder rec_FrameRate = 15
Recorder rec_FrameRate = 20
Recorder rec_FrameRate = 25
Recorder rec_FrameRate = 30
Recorder VideoCodec = "image/jpeg"
Recorder VideoCodec = "image/x-j2c"
Recorder VideoCodec = "image/x-jpc"
Recorder VideoCodec = "image/jp2"
Recorder VideoCodec = "image/png"
Recorder VideoCodec = "image/x-portable-bitmap"
Recorder VideoCodec = "image/x-portable-graymap"
Recorder VideoCodec = "image/x-portable-pixmap"
Recorder VideoCodec = "image/x-portable-anymap"
Recorder VideoCodec = "video/x-dirac"
Recorder VideoCodec = "video/x-qt-part"
Recorder VideoCodec = "video/x-mp4-part"
Recorder VideoCodec = "video/x-theora"
Recorder VideoCodec = "video/x-vp8"
Recorder VideoCodec = "video/x-vp9"
Recorder VideoCodec = "image/webp"
Recorder VideoCodec = "video/x-h264"
Recorder VideoCodec = "video/x-h265"
Recorder VideoCodec = "application/x-yuv4mpeg"
Recorder VideoCodec = "video/x-amv"
Recorder VideoCodec = "video/x-asus"
Recorder VideoCodec = "image/bmp"
Recorder VideoCodec = "video/x-cinepak"
Recorder VideoCodec = "video/x-cirrus-logic-accupak"
Recorder VideoCodec = "video/x-dnxhd"
Recorder VideoCodec = "video/x-dv, systemstream=(boolean)false"
Recorder VideoCodec = "video/x-ffv"
Recorder VideoCodec = "video/x-gst-av-ffvhuff"
Recorder VideoCodec = "video/x-flash-screen"
Recorder VideoCodec = "video/x-flash-video"
Recorder VideoCodec = "video/x-h261"
Recorder VideoCodec = "video/x-h263, variant=(string)itu"
Recorder VideoCodec = "video/x-huffyuv"
Recorder VideoCodec = "video/mpeg, mpegversion=(int)1, systemstream=(boolean)false"
Recorder VideoCodec = "video/mpeg, mpegversion=(int)2, systemstream=(boolean)false"
Recorder VideoCodec = "video/mpeg, mpegversion=(int)4, systemstream=(boolean)false"
Recorder VideoCodec = "video/x-divx"
Recorder VideoCodec = "video/x-msmpeg"
Recorder VideoCodec = "video/x-msvideocodec"
Recorder VideoCodec = "image/pbm"
Recorder VideoCodec = "image/x-pcx"
Recorder VideoCodec = "video/x-gst-av-pgmyuv"
Recorder VideoCodec = "image/ppm"
Recorder VideoCodec = "video/x-prores"
Recorder VideoCodec = "video/x-rle, layout=(string)quicktime"
Recorder VideoCodec = "video/x-gst-av-roqvideo"
Recorder VideoCodec = "video/x-pn-realvideo"
Recorder VideoCodec = "image/x-sgi"
Recorder VideoCodec = "image/x-sun-raster"
Recorder VideoCodec = "video/x-svq"
Recorder VideoCodec = "image/x-tga"
Recorder VideoCodec = "image/tiff"
Recorder VideoCodec = "video/x-wmv, wmvversion=(int)1"
Recorder VideoCodec = "video/x-wmv, wmvversion=(int)2"
Recorder VideoCodec = "video/x-zmbv"
Recorder VideoCodec = "video/mpeg, systemstream=(boolean)false" -
@SGaist
Why Qt can only set Pixel Format for QCameraViewfinder by setPixelFormat() function?
but can't find the setPixelFormat() API function for QMediaRecorder.I think it is the root cause that Qt QMediaRecorder always record the video by "YUYV" pixel format as default, but the camera device can only support the low FPS with "YUYV". If need record the 30 FPS video, should set the pixel format to "MJPG" for QMediaRecorder.
We can see the Format Video Capture diff between Qt and cheese camera app as below:
----------------------- Qt open the camera and pixel format --------------------
sudo v4l2-ctl --all --list-formats-ext
......
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 960/540
Pixel Format : 'YUYV'
Field : None
Bytes per Line : 1920
Size Image : 1036800
Colorspace : sRGB
Transfer Function : Default
YCbCr Encoding : Default
Quantization : Default
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 960, Height 540
Default : Left 0, Top 0, Width 960, Height 540
Selection: crop_default, Left 0, Top 0, Width 960, Height 540
Selection: crop_bounds, Left 0, Top 0, Width 960, Height 540
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 20.000 (20/1)
Read buffers : 0
brightness (int) : min=0 max=255 step=1 default=60 value=60
contrast (int) : min=0 max=255 step=1 default=32 value=32
saturation (int) : min=0 max=255 step=1 default=45 value=45
hue (int) : min=0 max=255 step=1 default=128 value=128----------------------- cheese open the camera and pixel format --------------------
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : 'MJPG'
Field : None
Bytes per Line : 0
Size Image : 4147200
Colorspace : sRGB
Transfer Function : Default
YCbCr Encoding : Default
Quantization : Default
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 1920, Height 1080
Default : Left 0, Top 0, Width 1920, Height 1080
Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1080
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
brightness (int) : min=0 max=255 step=1 default=60 value=60
contrast (int) : min=0 max=255 step=1 default=32 value=32
saturation (int) : min=0 max=255 step=1 default=45 value=45
hue (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto (bool) : default=1 value=1
gamma (int) : min=100 max=300 step=1 default=120 value=120Could you show me how to set the pix format for the QMediaRecorder?
Thanks very much.