soyersoyer / cameractrls Goto Github PK
View Code? Open in Web Editor NEWCamera controls for Linux
License: GNU General Public License v3.0
Camera controls for Linux
License: GNU General Public License v3.0
Here I collect feature requests that cannot be done with standard webcams.
But it can made by processing the camera stream and feeding it to a virtual camera.
This is out of scope yet.
If you have a Logitech BRIO, if you want FoV and HDR controls for Linux, you can help! Please install a Wireshark for a windows and record the USB communication, while you enable/disable the HDR, and change the FoV in the Logitech program.
Add [Green/Magenta] Tint slider under White Balance to Color
The FOV setting is absent in my Ankerconf C200 camera
The PathExists behaviour has changed in newer systemds. The systemd Path keeps trying to restart the control restore service, but it hits a limit after a while and fails. So restoring the control values only works once.
I couldn't find a way to fix this in the systemd path configuration. I should definitely write a cameractrlsd service.
I had issues with 2 cameras:
one with the Razer Kiyo ultra pro, there are combinations of settings that can after you set it up in the all and you use it with a standard UVC client (like chrome) put the camera is a crashed/frozen state (light stay on, you cannot connect to it anymore etc.) I could recover by installing windows, going into windows, installing the razer driver, override parameters and go back to linux.
by mistake I actually used cameratrls on my laptop camera (on the Framework Laptop) and now it is permanently dark whatever setting I twiddle, I haven't found a solution yet to recover from it.
I believe you need to be sure in this software you can recover good, known comprehensive settings.
The Insta 360 Link webcam, works as expected with gimbal, brightness, contrast, saturation and sharpness controls, but is missing the controls related to exposure, the official application for windows systems support manual and automatic exposure, so I would like to add these controls with cameractrls.
Is there any developer guide, or starting point to find the exposure controls, not available using the v4l2-ctl, or some way to search these parameters, and adding manually to cameractrls?
lsusb output
Bus 001 Device 010: ID 2e1a:4c01 Insta360 Insta360 Link
v4l2-ctl output
v4l2-ctl --device=/dev/v4l/by-id/usb-Insta360_Insta360_Link-video-index0 -L
User Controls
brightness 0x00980900 (int) : min=0 max=100 step=1 default=50 value=50
contrast 0x00980901 (int) : min=0 max=100 step=1 default=50 value=50
saturation 0x00980902 (int) : min=0 max=100 step=1 default=50 value=50
hue 0x00980903 (int) : min=-15 max=15 step=1 default=0 value=0
white_balance_automatic 0x0098090c (bool) : default=1 value=1
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=3 value=2 (60 Hz)
0: Disabled
1: 50 Hz
2: 60 Hz
white_balance_temperature 0x0098091a (int) : min=2000 max=10000 step=1 default=6400 value=5500 flags=inactive
sharpness 0x0098091b (int) : min=0 max=100 step=1 default=50 value=50
Camera Controls
pan_absolute 0x009a0908 (int) : min=-522000 max=522000 step=3600 default=0 value=-4320
tilt_absolute 0x009a0909 (int) : min=-324000 max=360000 step=3600 default=0 value=-277920
focus_absolute 0x009a090a (int) : min=0 max=100 step=1 default=50 value=0 flags=inactive
focus_automatic_continuous 0x009a090c (bool) : default=0 value=1
zoom_absolute 0x009a090d (int) : min=100 max=400 step=1 default=100 value=100
Is it possible to use control for multiple cameras?
I've got two USD webcams attached, but it's only showing controls for one of them, the one at /dev/video0
Some Logitech webcams have a firmware switch to enable/disable Microphone. (ex C920c, C290e, C925e), Cameras can be shipped with Microphone disabled. This can be accessed through a XU control.
This is a SET_CUR,
Unit: 11 ( Logitech peripheral GUID ffe52d21-8030-4e2c-82d9-f587d00540bd )
Interface: 0
Selector = 0x10
Value: 0 or 1
Code to do that with a USB ctrl_transfer
https://github.com/MavChtz/C920e/blob/master/C920e.py
Not sure what all USB ids support this, but at least
0x08b6: "Logi Webcam C920e",
0x08b7: "Logi Webcam C920c",
0x085b: "Logi Webcam C925e",
Hi,
could you please provide to add po for translations?
Thanks.
Regards.
A.
I stumbled upon this while doing a few tests while running into similar issues to #44 , but since that was related to the gtk3 version I thought I would make a new issue. I can make cameractrls follow the dark mode if I manually set GTK_THEME, but it doesn't follow system settings as the rest of my gtk4 apps do. The gtk3 version still works fine, though. This is using 0.5.15, but I don't see any changes in 0.6,0 that would affect this. (Edit: just confirmed that 0.6.0 also behaves this way)
Hi there. Love the ease of use. Can you please add a dark mode feature? In the "gnome-software" I see (very blurry) screenshots where the application is dark, but once after installment it doesn't go dark, nor can I find an option. I'm on Fedora 39, Gnome 45. Thanks in advance.
Hi!
First of all, thanks a lot for writing this tool. I was using guvcview
before, and I like to have your tool available as an alternative ๐๐ป
I'm experiencing weird quality issues on a brand new Razer Kiyo Pro (specifically: even on 60fps the video feels choppy; it looks like maybe the exposure time is too high, no matter what settings I use). That's how I found your tool, with the proprietary Razer controls.
With cameractrls, I can change the FOV of my Razer Kiyo Pro (using the Narrow/Medium/Wide toggles) however when I toggle HDR on or off I don't see any difference. Same if I change HDR to bright or dark.
I wonder if that's normal; i.e. do you typically see a change when you toggle HDR, or maybe it's only visible in some conditions? Or maybe I need to restart the capture each time I change it? Or it works only in some resolutions/modes? (I tried a few combinations but nothing showed a change so far!)
Thank you!
When the service has been saved and is supposed to start i get this
systemctl --user status --now cameractrls-*
ร cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.path - Watch /dev/v4l/by-id/usb-046d_HD_Webcam_C525_EC065210-video-index0 and restore controls
Loaded: loaded (/home/DYbvRBDO/.config/systemd/user/cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.path; enabled; preset: enabled)
Active: failed (Result: unit-start-limit-hit) since Sun 2023-10-15 07:55:53 CEST; 9min ago
Duration: 5.708s
Triggers: โ cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service
Oct 15 07:55:48 RPI3-DCA6 systemd[1265]: Started cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.path - Watch /dev/v4l/by-id/usb-046d_HD_Webcam_C525_EC065210-video-index0 and restore controls.
Oct 15 07:55:53 RPI3-DCA6 systemd[1265]: cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.path: Failed with result 'unit-start-limit-hit'.
ร cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service - Restore usb-046d_HD_Webcam_C525_EC065210-video-index0 controls
Loaded: loaded (/home/DYbvRBDO/.config/systemd/user/cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service; enabled; preset: enabled)
Active: failed (Result: start-limit-hit) since Sun 2023-10-15 07:55:53 CEST; 9min ago
TriggeredBy: ร cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.path
Process: 1589 ExecStart=/home/DYbvRBDO/Source/cameractrls/cameractrls.py -d /dev/v4l/by-id/usb-046d_HD_Webcam_C525_EC065210-video-index0 -c exposure_dynamic_framerate=1,pixelformat=MJPG,card=HD Webcam C525,driver=uvcvideo,path=/dev/v4l/by-id/usb-046d_HD_Webcam_C525_EC0>
Main PID: 1589 (code=exited, status=0/SUCCESS)
CPU: 759ms
Oct 15 07:55:52 RPI3-DCA6 systemd[1265]: Starting cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service - Restore usb-046d_HD_Webcam_C525_EC065210-video-index0 controls...
Oct 15 07:55:53 RPI3-DCA6 cameractrls.py[1589]: WARNING:root:V4L2FmtCtrls: info type card couldn't be set
Oct 15 07:55:53 RPI3-DCA6 systemd[1265]: Finished cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service - Restore usb-046d_HD_Webcam_C525_EC065210-video-index0 controls.
Oct 15 07:55:53 RPI3-DCA6 systemd[1265]: cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service: Start request repeated too quickly.
Oct 15 07:55:53 RPI3-DCA6 systemd[1265]: cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service: Failed with result 'start-limit-hit'.
Oct 15 07:55:53 RPI3-DCA6 systemd[1265]: Failed to start cameractrls-usb-046d_HD_Webcam_C525_EC065210-video-index0.service - Restore usb-046d_HD_Webcam_C525_EC065210-video-index0 controls.
Now if i run the command manually i get something like this as the only error
cameractrls.py -d /dev/v4l/by-id/usb-046d_HD_Webcam_C525_EC065210-video-index0 -c exposure_dynamic_framerate=1,pixelformat=MJPG,card=HD Webcam C525,driver=uvcvideo,path=/dev/v4l/by-id/usb-046d_HD_Webcam_C525_EC065210-video-index0,real_path=/dev/video0,resolution=1920x1080,fps=5,logitech_led1_mode=auto,logitech_led1_frequency=0
WARNING:root:V4L2FmtCtrls: info type card couldn't be set
I have spend the better of 4 hours trying to understand this error.
But there doent seem to be any info on it on the net.
Is this something that can be resolved?
Best regards,
Darkyere
The camera keeps forgetting the settings very often, most importantly the resolution. This utility is a great help, as I can set them using an alias, but is there a way for the settings to be persisted on the camera?
Hello there,
Thank you for the amazing application.
I am using UGREEN camera 2K on Debian 12. When I open Cameractrls and change the resolution to like 1920x1080 I can preview that without an issue, even with 2592x1520.
The problem is that, when I want to make it in real use, for example if I open jitis or google meet, once I open the camera there, the resolution drops to 1024x768, even I open Cameractrls at the same time and change the resolution, but it drops immediately.
What do you think might cause this?
Thank you.
If you use dash-to-panel, or some other launcher, or other desktop environments than a vanilla GNOME, the icon's colors will prove problematic, as only the small red dot remains visible:
Generally speaking, pure black does not exist in nature, so it might look more natural if the icon uses some shade of gray, white, subtle gradients or textures.
Hello
I would like to write a simple app which setup a few parameters of the camera, capture one image and close the camera. From what I understand:
devices = get_devices(v4ldirs)
mycam = devices[0]
with open(mycam.path, "w") as fd:
camctl = CameraCtrls(mycam.path, fd)
print(camctl.print_ctrls())
This prints a list of controls and values ... but how do I use this camctl object to set actual controls ? The function setup_ctrls expect a dict, I tried like
camctl.setup_ctrls({'Color / Balance': 'white_balance_automic=0'}, "My message")
but it does not work. Could you please show how to use the interface directly ?
TIA
Pascal
The Razer Kiyo Pro Ultra is the new 'best webcam'. It would be cool to support its special features.
If you have one, please capture USB communication with Wireshark while changing special settings in windows with synapse.
Zoom would be cool.
Hey folks!
It would be nice if this app could also be, whether through different backends implemented or a whole fork, supported by macOS. I use mostly mac for work with a Kiyo Pro camera and I wanted HDR so badly.
I wonder if AVFoundation has the capabilities that v4l2 has so we can enable HDR and FOV.
Hi, just got my new Razer Kiyo Pro and cameractrls seems to support most features well, except H264 and HDR.
The controls show up:
./cameractrls.py -d /dev/video0 -l | grep -i hdr
kiyo_pro_hdr = None ( values: off, on )
kiyo_pro_hdr_mode = None ( values: bright, dark )
but they are always staying at "None", no matter what I set them to.
Changing them seems to have no effect at all, neither visually nor from the controls:
$ ./cameractrls.py -d /dev/video0 -c pixelformat=MJPG
$ ./cameractrls.py -d /dev/video0 -c fps=30
$ ./cameractrls.py -d /dev/video0 -c kiyo_pro_hdr=on
$ ./cameractrls.py -d /dev/video0 -c kiyo_pro_hdr_mode=bright
$ ./cameractrls.py -d /dev/video0 -l | egrep -i "pixelformat|hdr|fps"
kiyo_pro_hdr = None ( values: off, on )
kiyo_pro_hdr_mode = None ( values: bright, dark )
pixelformat = MJPG ( values: YUYV, MJPG, H264, NV12 )
fps = 30 ( values: 60, 30, 24, 20, 15, 10, 5 )
It doesn't seem to matter which pixelformat I choose either.
Hey! I wanted to change the FOV of this webcam.
But when I start cameractrls, the "basic" section just isn't there.
Is it possible to get the "basic" section of cameractrls for Lenovo 300 FHD Webcam ?
Here's the product I'm talking about: https://www.lenovo.com/in/en/accessories-and-monitors/webcams-and-video/webcams/NET-BO-300-FHD-Webcam/p/GXC1B34793
Here's my Cameractrls for Lenovo 300 FHD webcam which doesn't have the "basic" section.
Have to constantly resave the settings everytime I open up a new video stream.
Issue: The controls appear to be in the way while the options appear minimal.
Solution: Integrate the Camera controls into the Capture window using Intelligent Auto-hide.
This would allow the user to:
Having the camera preview only available as a big standalone floating window on top of the app, which you have to manage separately etc. and mess with the window manager to resize and move "out of the way" to be able to continue playing with the settings, is a bit a pain in the butt.
Wouldn't it be nicer if clicking the camera preview button could embed the preview within the main window, on the side? To do so, it should calculate the camera's aspect ratio, clamp the height to match the existing window's measured height (so there are no awkward empty spaces), and calculate the width accordingly.
If not enough horizontal space is available on the screen, it could clamp the sink to the window's width (instead of height) and place the preview sink above or below instead of on the side..
A button could be added to "pop out" that widget from the window if some users really still want a standalone preview window, but I'm not sure why anyone would want that, it's mostly a temporary thing to set up your camera before a videoconferencing (or recording) session, not something you keep open previewing at all times (because then it would lock access to the camera and prevent the actual videoconferencing from working properly)...
Hello!
I'm getting the following error from cameractrls.cameractrlsgtk when trying to click on Save (save settings to systemd):
Traceback (most recent call last):
File "/snap/cameractrls/31/usr/bin/cameractrlsgtk.py", line 340, in <lambda>
b.connect('clicked', lambda e, c=c, m=m: self.update_ctrl(c, m.text_id))
File "/snap/cameractrls/31/usr/bin/cameractrlsgtk.py", line 429, in update_ctrl
self.camera.setup_ctrls({ctrl.text_id: value}, errs)
File "/snap/cameractrls/31/usr/bin/cameractrls.py", line 2244, in setup_ctrls
c.setup_ctrls(params, errs)
File "/snap/cameractrls/31/usr/bin/cameractrls.py", line 2131, in setup_ctrls
self.create_systemd_service_and_path()
File "/snap/cameractrls/31/usr/bin/cameractrls.py", line 2155, in create_systemd_service_and_path
subprocess.run(["systemctl", "--user", "enable", "--now", service_file])
File "/usr/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'systemctl'
Ubuntu 22.04
Version: 0.5.11-0
Installed from Ubuntu Software with snap
Creating this as a separate issue, coming from the conversation at #7.
Here are some first attempts, in two different directions and with slightly different styles.
I have used simple shapes, no reflections, no gradients, but some drop shadows.
This variation ended up looking more like an action camera, but I'm including it anyway.
Here I tried a slightly more detailed style, with some gradients and reflections.
What do you think? Feel free to tell me you want something entirely different, I'm having fun exploring anyway ๐
Hello, would it be possible to add check boxes for flipping the camera output vertically or horizontally? Thank you!
Hey!
Great app, thank you!
Sorry to bother you, but I'm wondering what the trick is to activate the Systemd "Save" button.
I'm on Fedora 37 and using the Flatpak installation method. I have Flatseal and tried opening up file access, but no luck.
Can you help?
Cheers
Ben
Would be nice, if you could add an option to select the resolution and FPS of the webcam as well.
Installed from Snap, looked at the Capture page and my camera view went black. Now it is always black.
By the reviews on the KDE software center, I'm not the only one who has experienced this.
As far as I can tell, the camera still works, but no apps display anything but a black screen. Previously this camera was working fine right out of the box.
What does this app do when we first land on the Capture page?
And how can one fully reset anything this app may have changed?
Uninstalling Camerctrls didn't reset things, neither did unplug/replug, nor full shutdown reboot. So there seems to be something this app is leaving behind even after uninstall. That bit might be on the packager in this case but not laying blame here, just want to know everything this app can change and where to find any files it writes so I can hunt down what happened.
Hi,
Looks like there are no ways to set highest supported resolution and fps for Logitech BRIO 4K camera (4K 30fps, 2k 60fps) on Fedora 38.
Camera is connected to USB 3 port and I use my own cable but not original (too long).
./cameractrls.py -l
...
Capture / Capture
pixelformat = MJPG ( values: YUYV, MJPG )
resolution = 1920x1080 ( values: 1920x1080, 1600x896, 1280x720, 1024x576, 960x540, 848x480, 800x600, 800x448, 640x480, 640x360, 480x270, 424x240, 352x288, 320x240, 320x180, 176x144, 160x120 )
fps = 30 ( values: 30, 24, 20, 15, 10, 7.5, 5 )
Could it be a driver problem ?
Can I force camera to try to use my values but not provided from the list?
Does that ring a bell for you? I can set it fine in the gtk
but using cli I get that error:
$ python3 ~/cameractrls/cameractrls.py -d "/dev/v4l/by-id/usb-Alpha_Imaging_Tech._Corp._Razer_Kiyo-video-index0" -c white_balance_temperature=3000
WARNING:root:V4L2Ctrls: Can't set white_balance_temperature to 3000 ([Errno 84] Invalid or incomplete multibyte or wide character)
I'm on Pop!_OS 22.04 LTS and starting a couple weeks ago? Cameractrls is v0.5.10.
My cameractrls settings do not save. By default my webcam is incredibly dark, so I'll switch from Aperture Priority Mode to Manual Mode in Exposure and this fixes the brightness. Once I turn the camera off and on again though the settings have been reset. I should say they are not reset from the perspective of Cameractrls program state. It still thinks I'm already in Manual Mode, so I have to switch back and forth.
So yeah, I have to do this on every Slack huddle, Google Meet, Zoom meeting etc and whenever I turn my camera off
[Feature request] - Expand menu for resolution selection or sort by decreasing resolution. I thought cameractrls didn't support some higher resolutions on my webcam until I realized it didn't show all the resolutions and I can scroll down (pictured is without scrolling down yet for 1280x720 resolution option): https://0x0.st/XibV.jpg
Not sure what information you need for this.
Running flatpak of cameractrls version 0.4.11 on Ubuntu 18.04. Webcam is a Dynex 1.3 MP.
Clicking on the preview button shows a black screen. (But the Cheese application shows the video with no problem, so the camera does work.)
After opening the preview window (which, as I wrote above, is simply a black screen), I can't close it, I need to do a "force quit" because I get the message that cameractrls is not responding.
I tried running flatpak run hu.irl.cameractrls in the terminal with the hope that I would see some messages, but no messages were displayed at all.
I recently installed the app on Linux Mint on an old imac 27, but the gamma got stuck between 100 and 120 (at the start it was 200) now the camera has bad quality, too dark, how can I change it back? Also uninstalling doesn't change anything, and with other apps I cannot access the gamma? Could you recommend a solution?
Hi, it would be great to be able to load a LUT (Look-Up Table) file.
I'd love to use this app, but my work computer is Endless OS and my personal is Fedora Silverblue. As such, apps are typically just installed via Flatpak. Packaging cameractrls as a Flatpak (and ideally distributing via Flathub) would widen its reach to anyone using a modern Linux-based distro, including the image-based ones like Endless OS, Fedora Silverblue, and even Steam OS.
Hi,
I have a tiny USB type-c thermal camera, with no wire, sits on the usb slot and unfortunately the camera preview is on a 90ยฐ angle from the screen.
Would it be possible to add option/feature to rotate the preview by 0ยฐ, 90ยฐ, 180ยฐ and 270ยฐ ?
And while at it, also mirror the preview horizontal and vertical?
Thanks! Great app!
Thanks a lot for putting so much effort into this tool.
Is there any reason why you don't make it available on PyPI, so a simple pipx install cameractrls
would do the trick? If you like the idea, I might provide a PR to include this step in the CI (but you should create and own the PyPI entry).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.