Hi,
I am having problem in recording video using QMediaRecorder and QCamera classes.
My application crashes with segmentation fault when trying to start camera ("camera->start" in code).
Below is code, i have written. Please guide me out here, if have i am missing something. Thanks in advance.
/**********************************************************************/
QMediaRecorder *recorder;
QCamera *camera;
QCameraViewfinder *viewfinder;
QCameraInfo cameraInfo(camera);
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
foreach (cameraInfo, cameras)
qDebug() << cameraInfo.deviceName();
camera = new QCamera(cameraInfo);
viewfinder = new QCameraViewfinder();
camera->setViewfinder(viewfinder);
setCentralWidget(viewfinder);
viewfinder->show();
if(true == isCaptureModeSupported(QCamera::CaptureVideo)
{
camera->setCaptureMode(QCamera::CaptureVideo);
}
recorder = new QMediaRecorder(camera);
camera->start();
recorder
->setOutputLocation
(QUrl::fromLocalFile("record.mp4"));
recorder->record();
/**********************************************************************/
/**********************************************************************/
QMediaRecorder *recorder;
QCamera *camera;
QCameraViewfinder *viewfinder;
QCameraInfo cameraInfo(camera);
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
foreach (cameraInfo, cameras)
qDebug() << cameraInfo.deviceName();
camera = new QCamera(cameraInfo);
viewfinder = new QCameraViewfinder();
camera->setViewfinder(viewfinder);
setCentralWidget(viewfinder);
viewfinder->show();
if(true == isCaptureModeSupported(QCamera::CaptureVideo)
{
camera->setCaptureMode(QCamera::CaptureVideo);
}
recorder = new QMediaRecorder(camera);
camera->start();
recorder->setOutputLocation(QUrl::fromLocalFile("record.mp4"));
recorder->record();
/**********************************************************************/
To copy to clipboard, switch view to plain text mode
Bookmarks