Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.2.1
-
None
-
-
ed857e84f3c0ab90ac6dfff1aecce460f56e1a9a (qt/qtmultimedia/dev) b4b6942a5a7dc4313dafd6a0d1f70d70ce8dfb16 (qt/qtmultimedia/6.2)
Description
QVideoWidget is used as a viewfinder for QCamera with help of QImageCapture.setVideoOutput(). It works with Qt 6.2.0 and shows live image from camera but doesn't work (it is black) with Qt 6.2.1.
Below is python code to reproduce the problem - it works with 6.2.0 and doesn't work with 6.2.1 (commented part was added to store captured image - it works with 6.2.1 and image is stored on disk. The problem is only with viewfinder).
The same problem was reported here for official camera example
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QPushButton from PySide6.QtMultimedia import QCamera, QMediaCaptureSession, QImageCapture from PySide6.QtMultimediaWidgets import QVideoWidget from PySide6.QtGui import QImage class CameraWnd(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.layout = QVBoxLayout() self.viewfinder = QVideoWidget(self) self.layout.addWidget(self.viewfinder) self.viewfinder.setMinimumSize(720, 405) self.button = QPushButton(self) self.button.setText("Capture") self.layout.addWidget(self.button) self.wnd = QWidget(self) self.wnd.setLayout(self.layout) self.setCentralWidget(self.wnd) self.camera = QCamera() self.captureSession = QMediaCaptureSession() self.img_capture = QImageCapture(self.camera) self.captureSession.setCamera(self.camera) self.captureSession.setVideoOutput(self.viewfinder) self.captureSession.setImageCapture(self.img_capture) self.button.clicked.connect(self.on_button) self.img_capture.errorOccurred.connect(self.on_error) self.camera.errorOccurred.connect(self.on_cam_error) # self.img_capture.imageCaptured.connect(self.captured) self.camera.start() def on_button(self): if self.img_capture.isReadyForCapture(): print("READY") # self.img_capture.capture() else: print("NOT READY") def on_error(self, _id, _error, error_str): print(f"Error: {error_str}") def on_cam_error(self, _error, error_str): print(f"Error: {error_str}") # def captured(self, id: int, img: QImage): # print(id) # img.save('/home/user/test.png') def main(): app = QApplication() camera = CameraWnd() camera.show() return app.exec() if __name__ == '__main__': main()
Attachments
For Gerrit Dashboard: QTBUG-97911 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
379709,2 | GStreamer: Fix black preview window on capturesessions | dev | qt/qtmultimedia | Status: MERGED | +2 | 0 |
379750,2 | GStreamer: Fix black preview window on capturesessions | 6.2 | qt/qtmultimedia | Status: MERGED | +2 | 0 |