QT Camera example
-
Hi,
I am trying to use the qtcamera example application. It worked perfectly while i was using my USB camera. But i have another h/w connected camera which i want to use.
When i looked at the devices only usb camera was detected and hw camera was not.What changes do you think i should make to make the h/w camera work?
As of now i am using gstreamer commands,
sudo gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! glimagesink
Any help will be appreciated :)
Thanks in advance -
Hi,
What type of camera is that ?
-
I just remembered that if you use a more recent version of Qt, you can use custom gstreamer pipelines. See the corresponding Qt documentation.
-
@SGaist Hey thanks for answering.
But i think I might need little more help here.So when i was going through the code i found the part which is searching for the camera device,
ui->setupUi(this);//Camera devices: QByteArray cameraDevice; QActionGroup *videoDevicesGroup = new QActionGroup(this); videoDevicesGroup->setExclusive(true); foreach(const QByteArray &deviceName, QCamera::availableDevices()) { QString description = camera->deviceDescription(deviceName); QAction *videoDeviceAction = new QAction(description, videoDevicesGroup); videoDeviceAction->setCheckable(true); videoDeviceAction->setData(QVariant(deviceName)); if (cameraDevice.isEmpty()) { cameraDevice = deviceName; videoDeviceAction->setChecked(true); } ui->menuDevices->addAction(videoDeviceAction); } connect(videoDevicesGroup, SIGNAL(triggered(QAction*)), SLOT(updateCameraDevice(QAction*))); connect(ui->captureWidget, SIGNAL(currentChanged(int)), SLOT(updateCaptureMode()));
#ifdef HAVE_CAMERA_BUTTONS
ui->lockButton->hide();
#endifsetCamera(cameraDevice);
}
So you are saying i should replace the above code with this command " sudo gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! glimagesink " ??
Can you help me out to do this? -
No, see QMediaPlayer::setMedia.
-
As shown in the documentation I linked, you need a video sink named qtvideosink.