unable to get high resolution from usb webcam using pygame
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Raspbian |
In Progress
|
Undecided
|
Unassigned |
Bug Description
Package: pygame, Version: 1.9.4.post1 (Location: /usr/lib/
I'm unable to take an image of an usb-camera highter than 160x120 resolution on Raspberry pi 4 with python3, my desired resolution is 640x480.
setup:
RPI4 (1gb), latest raspbian buster(2019-09-26), fully updated (rpi-update): Linux raspberrypi 4.19.88-v7l+ #1284 SMP Wed Dec 11 13:51:57 GMT 2019 armv7l GNU/Linu usb camera: Logitech, Inc. HD Webcam C525
software:
Python 3.7.3
Pygame Version: 1.9.4.post1 (Location: /usr/lib/
pip3: pip 18.1 from /usr/lib/
minimal script I use: (executed as 'sudo python3 test.py')
cam = pygame.
behaviour:
script hangs when calling cam.get_image() when I change the resolution to 160x120 (or lower) it works and generates an image of 160x120
When I put the sd card into my RPI3 the script works with my desired resolution of 640x480.
The camera itself is able to capture images of 640x480, the following command results in a picture of requested resolution:
fswebcam -r 640x480 image.jpg
fswebcam -r 1280x720 image.jpg
relevant information:
the usb camera creates 2 /dev/video devices, behaviour described here by someone else: https:/
description: | updated |
Changed in raspbian: | |
status: | New → In Progress |
By solving another problem I found out it was related and so I have a solution for the problem above:
sudo apt-get install pciutils
sudo setpci -s 01:00.0 0xD4.B=0x41
This will resolve the issue of lagg and key sticking on usb devices (when using a usb webcam).
explaination (from https:/ /linux. die.net/ man/8/setpci): ]:]<bus> ]:][<slot> ][.[<func> ]]
-s [[[[<domain>
with the tool setpci we write a byte (B) with the value '0x41' to register '0xD4'.
we write to:
domain: 01, bus: 00, slot: 0
I dont know why this value and register, I hope someone can answer that for me.
In my case it resolved the usb lagg & key sticking 100%. /www.raspberryp i.org/forums/ viewtopic. php?f=29& t=260879
there is a related update, but that didn't fix it for me: https:/