QT's QMediaRecorder not working - Unable to record from camera
-
I'm trying to record a video from two different camera. I am able to show the flux of the camera but the problem is recording, I can save the file but I can't open it.
can youu help me pleaseviewfinderAvant= new QCameraViewfinder(); //le flux if (QCameraInfo::availableCameras().count()>0) { cameraAvant = new QCamera("/dev/video4",this); layoutAvant = new QVBoxLayout(); cameraAvant->setViewfinder(viewfinderAvant); layoutAvant->addWidget(viewfinderAvant); QCameraViewfinderSettings viewfinderSettings; viewfinderSettings.setResolution(800,600); cameraAvant->setViewfinderSettings(viewfinderSettings); recorder = new QMediaRecorder(cameraAvant,this); recorder->setMuted(true); QVideoEncoderSettings settings = recorder->videoSettings(); settings.setCodec("video/mpeg, mpegversion=(int)4, systemstream=(boolean)false"); settings.setQuality(QMultimedia::NormalQuality); settings.setEncodingMode(QMultimedia::ConstantBitRateEncoding); recorder->setVideoSettings(settings); cameraAvant->start();
void Rover::on_recording_start_clicked()
{
QString fileRecording=QDateTime::currentDateTime().toString(QString("'%1/RecordingVideo_'dd-MM-yyyy'_'hh:mm:ss'").arg(dossier));
recorder->setOutputLocation(QUrl::fromLocalFile(filerecord));
cameraAvant->setCaptureMode(QCamera::CaptureVideo);
recorder->record();}
void Rover::on_recording_stop_clicked()
{
recorder->stop();
} -
Hi,
Did you check that "filerecord" points to a valid location ?
Did you connect any of the error signals to know if something wrong happened ? -
@SGaist thank you for your reply, yes i can find the file
but i can't open it
the error :
AL lib: (EE) ALCcaptureAlsa_open: Could not open capture device 'default': Aucun fichier ou dossier de ce type
QMediaRecorder::RecordingState
QMediaRecorder::RecordingStatus
QMediaRecorder::NoError
CameraBin error: "Could not open device."
CameraBin error: "Internal data stream error." -
Did you check that you have access to the device(s) you are trying to use for recording ?
-
what does that mean please ?
GStreamer-CRITICAL **: 12:40:27.463:
Trying to dispose element camera_source, but it is in PAUSED instead of the NULL state.
You need to explicitly set elements to the NULL state before
dropping the final reference, to allow them to clean up.
This problem may also be caused by a refcounting bug in the
application or some element.
i m new with the qt :( -
Are you able to use that device from GStreamer directly ?
Are there other applications trying to access it ? -
@jack1998 said in QT's QMediaRecorder not working - Unable to record from camera:
AL lib: (EE) ALCcaptureAlsa_open: Could not open capture device 'default': no such file or folder
Is this coming when you try to access the device directly using GStreamer?