[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: Issue with QCamera in PyQt6
From: RedHuli <redhuli.comments () gmail ! com>
Date: 2021-11-12 3:54:12
Message-ID: CACDNW2UR4x2JMwEYQOeFVqNATWC_fojh5FFHb5e7v40xs+OL2A () mail ! gmail ! com
[Download RAW message or body]
Hi Phil,
Thanks so much for taking a moment to look at this.
I realized that the problem I was having was with the zsh shell on macOS. I
reverted back to the bash shell, ran the short script and had no
issues with the code.
Thanks,
Joshua Willman
On Tue, Nov 9, 2021 at 6:28 AM Phil Thompson <phil@riverbankcomputing.com>
wrote:
> On 08/11/2021 08:14, RedHuli wrote:
> > Hello,
> >
> > I was wondering if someone could help me with my issue. I want to
> > update my
> > code from PyQt5 to PyQt6. I need to use QCamera, but every time I do I
> > get
> > the following error:
> >
> > zsh: segmentation fault
> > /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
> > test_camera.py
> >
> >
> > No matter what I do, I still get an error. I've played around with
> > QMediaPlayer and QVideoWidget. I am not sure which new classes to use
> > in
> > PyQt6 to get the camera to play. Below is the minimum code (I believe)
> > should get the camera working:
> >
> >
> > # Import necessary modules
> > import sys
> > from PyQt6.QtWidgets import QApplication
> > from PyQt6.QtMultimedia import (QCamera, QMediaCaptureSession,
> > QMediaDevices
> > )
> > from PyQt6.QtMultimediaWidgets import QVideoWidget
> >
> > app = QApplication(sys.argv)
> >
> > video_widget = QVideoWidget()
> > video_widget.resize(640, 480)
> > video_widget.show()
> >
> > camera = QCamera(QMediaDevices.defaultVideoInput())
> > camera.start()
> >
> > mediaCaptureSession = QMediaCaptureSession()
> > mediaCaptureSession.setCamera(camera)
> > mediaCaptureSession.setVideoOutput(video_widget)
> >
> > sys.exit(app.exec())
> >
> >
> > Thanks for your help!
> >
> >
> > Joshua Willman
>
> It worked fine for me on macOS.
>
> Phil
>
[Attachment #3 (text/html)]
<div dir="ltr">Hi Phil,<div><br></div><div>Thanks so much for taking a moment to look \
at this. </div><div><br></div><div>I realized that the problem I was having was with \
the zsh shell on macOS. I reverted back to the bash shell, ran the short script and \
had no issues with the code. </div><div><br></div><div>Thanks,</div><div>Joshua \
Willman</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On \
Tue, Nov 9, 2021 at 6:28 AM Phil Thompson <<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On \
08/11/2021 08:14, RedHuli wrote:<br> > Hello,<br>
> <br>
> I was wondering if someone could help me with my issue. I want to <br>
> update my<br>
> code from PyQt5 to PyQt6. I need to use QCamera, but every time I do I <br>
> get<br>
> the following error:<br>
> <br>
> zsh: segmentation fault<br>
> /Library/Frameworks/Python.framework/Versions/3.9/bin/python3<br>
> test_camera.py<br>
> <br>
> <br>
> No matter what I do, I still get an error. I've played around with<br>
> QMediaPlayer and QVideoWidget. I am not sure which new classes to use <br>
> in<br>
> PyQt6 to get the camera to play. Below is the minimum code (I believe)<br>
> should get the camera working:<br>
> <br>
> <br>
> # Import necessary modules<br>
> import sys<br>
> from PyQt6.QtWidgets import QApplication<br>
> from PyQt6.QtMultimedia import (QCamera, QMediaCaptureSession, <br>
> QMediaDevices<br>
> )<br>
> from PyQt6.QtMultimediaWidgets import QVideoWidget<br>
> <br>
> app = QApplication(sys.argv)<br>
> <br>
> video_widget = QVideoWidget()<br>
> video_widget.resize(640, 480)<br>
> video_widget.show()<br>
> <br>
> camera = QCamera(QMediaDevices.defaultVideoInput())<br>
> camera.start()<br>
> <br>
> mediaCaptureSession = QMediaCaptureSession()<br>
> mediaCaptureSession.setCamera(camera)<br>
> mediaCaptureSession.setVideoOutput(video_widget)<br>
> <br>
> sys.exit(app.exec())<br>
> <br>
> <br>
> Thanks for your help!<br>
> <br>
> <br>
> Joshua Willman<br>
<br>
It worked fine for me on macOS.<br>
<br>
Phil<br>
</blockquote></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic