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();
} -
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();
} -
@jack1998 said in QT's QMediaRecorder not working - Unable to record from camera:
QFile file(fileRecording);How is anything attached to/writes to this local variable? That line does nothing.
-
@JonB ok thank you for your reply but have you please any idea about the recording please ?
-
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 ? -
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." -
@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." -
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 ? -
Did you check that you have access to the device(s) you are trying to use for recording ?
-
-
@jsulm hello thank you for your replay, i find this result with the terminal in raspberry: crw-rw----+ 1 root video 81, 17 mai 4 12:01 /dev/video4
-
@jack1998 So, only root user and users which are member of the "video" group have access to /dev/video4
Is your user member of that group (enter this command in terminal to check: groups). -
@jsulm thank you for your reply, i check it and i have access
it is not a problem with the code please?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 ? -
Are you able to use that device from GStreamer directly ?
Are there other applications trying to access it ? -
@SGaist AL lib: (EE) ALCcaptureAlsa_open: Could not open capture device 'default': no such file or folder
@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?
-
@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?