Repository navigation
linux-v4l2: Save device by id or path - #6493
ggodlewski wants to merge 2 commits into
Conversation
|
If this fixes/closes issues or other PRs, use "Fixes" or "Closes" before the Issue/PR reference to automatically link them together. Does this resolve the lingering concern raised in #3437?
|
5c9491c to
3cdb2f8
Compare
|
I don't think GitHub picks up the keywords if you use a colon between them and the reference. See:
|
3cdb2f8 to
57cc18a
Compare
From PR description:
Seems like a yes. |
|
Im not a big fan of having both id and path options since I don't think there is really a good way to expose this to the user. I dont think that anyone will get the intention behind the two names in the list without reading this PR. I was leaning towards saving by path but checking with windows it looks like we save by ID there so id prefer we just keep it consistent with windows and only expose by-id to users. I like the code structure though, seems like a good solution to the issue of virtual devices. |
57cc18a to
ad16694
Compare
|
As a user I'm unable to remember which USB port I used previously for specific camera. |
ad16694 to
ea596df
Compare
|
Between
When you want to give choice, you need to check if any user that knows nothing about how device works on Linux could understand the choice they had to/can make. Here you put everything in a list without even telling the difference between them. |
ea596df to
59c8664
Compare
|
I pushed some changes to clean up the freebsd defs. I think the code is fine now but I still dont believe the UX is really usable and we must choose one or the other of id or path. Or find a better UX. |
|
Maybe with #5160 we could add information with another property list which makes the user choose between
|
|
Another property list is more clicking. Most users have just one camera. Another, simple proposition: Normal user won't bother to click this list. |
|
Thanks, this patch is a lifesaver. I would suggest that attempts to make this user-friendly by dumbing things down and hiding them and coming up with subjective labellings like "Advanced:..." and "Connection path" ... actually complicates it for 95% of users. And it's not a "Danger" if your cameras show up the other way around. No credentials are gonna get leaked. You just notice it in the process of tweaking your scenes. And this is linux. We have all devices in a filesystem tree, we are proud of it, and we are not afraid to use it. I'd prefer the dropdown to look basically like what you get when you run: |
c218b73 to
7a6bbe9
Compare
7a6bbe9 to
e1f934a
Compare
|
I've done more testing and resolved one bug. There was a problem because UDEV is always using real path to device instead of by-* scheme. |
9f71de0 to
5416596
Compare
|
Now that #5160 is merged, I reiterate my proposal: We could add information with another property list which makes the user choose between /dev/v4l/by-path (as default) and /dev/v4l/by-id. And also a third option for /dev/videoX .
Why
Adding potential clicks doesn't mean bad UX because it can be avoided with a good default (here with |
|
@DarkDefender I will not provide any updates to this project. I wasted many hours to prepare my patches and I bought 2 more devices to do a proper testing. Maintainers ignored me so someone else has to work on that. Obviously linux support is not a priority. |
|
I don't know if you had some additional communication with the developers, but I wouldn't attribute any of this to malice or unwillingness to make linux support better. As I am a Blender developer myself, I do see the same thing on our side of things regarding code contributions. We get a lot of pull requests but we don't really have time to properly spent the time needed on all of them. Usually that means that contributors has to jump through hoops to get things merged. It is not a good situation, but I there is simply not enough developers around to properly take care of every contributor. I kinda see the same thing here. |
I am not a Linux-based dev. My previous reviews here were only cosmetic. The only Linux-based contributor that I can think of who I would ask to review this is @kkartaltepe , who volunteers their free time as available. I can't force them to have more free time or force them to look at this. |
|
@RytoEX would you be fine if I step in as a reviewer and test this so I can vouch for the changes? I'm sure kkartaltepe didn't intentionally abandon this patch as he had a patch of his own addressing the same issue. (But his patch was seemingly abandoned in favor of this one). I think it is just that he legitimately doesn't or didn't have time. So if I am allowed to step up and help this get merged, I will happily do so. |
|
I did look at it again and it again seemed fine from a code perspective. But as I said " I think the code is fine now but I still dont believe the UX is really usable and we must choose one or the other of id or path. Or find a better UX." and as the author said "@tytan652 it this case someone needs to fork this PR and prepare working proposition. I already spent more time than expected." This is reasonable code and probably will help whoever wants to do that fork and prepare something with better ux, but for me im not really convinced we should merge this as is and then try to change the UI again later. In fact merging this will probably just prevent us from ever making it more user friendly as such changes would probably break users who depend on having all these options available. Its definitely at least partially my fault if I wasnt clear the main problem here is not the code but the UX, and at least my position is it should just work like windows. |
|
Thanks for clarifying your position
But the issue here is that under the hood this doesn't work like on Windows. So to me, trying to force the interface to be like Windows would be a mistake. To me, it seems like these two options that tytan652 mentioned are very useful and should be exposed:
This is because in my experience having "Per connection" would be a life saver when running bigger events like the Blender Conference. There we had cameras or capture cards break during the event and being able to simply delegate certain usb ports to a specific video input would make swapping out equipment really easy. For most users though, I think they will most likely just use the "Per device" mode. To me simply having the option in the UX to select which method you want to use shouldn't be too confusing or hard to understand. So I don't see why we would need to restrict ourselves to one or the other. That is how I envision it at least. Do you agree that it sounds reasonable?
100% agree. The design of how we want things to work should be agreed upon and implemented before merging. |
@DarkDefender do you have any of Logitech BRIO or Kiyo Pro cameras? There is also #7346 PR which gives more controls like FOV and HDR. I wasn't able to find anyone to test it.
Oh, what a coincidence. I wanted to provide something for Blender and now I'm afraid ;). |
That would be cool. You'll probably need to add GUID for this camera. I curious about the result.
My job here is done. The last thing I can maybe do is to rebase #7346 after this is merged. Feel free to take it over. The interface looks cool. |
|
@kkartaltepe do you think you will have any time to spend on discussing the UI design? |
the best place to have a design discussion is probably on the discord where most developers are. There may be other people more interested in supporting multiple card lookup strategies. |
|
That sounds like a great idea! |
|
Dealing with this issue, got an additional problem with camera disconnect/reconnect not being detected if I change the Test case and observations:
Multiple cameras of the same model aren't handled gracefully by the udev persistence rule (in Debian bookworm/sid: but this file could be overriden with a custom rule in |
|
(Copying this response from #9246) Thank you very much for the contribution and for the amount of effort put in this PR. I'm afraid I come with bad news though :( After deliberating about this feature, the interaction flow is not what we want to go as the intended user experience. What we want going forward is basically how the macOS integration in OBS Studio handles cameras. Each device gets a unique identifier - even devices of the same model - and that's what's used to address the device. That means that whatever device the user selects in OBS Studio is picked, regardless of where it is connected. Picking the device of a specific bus might incur losing data, or other sorts of incompatibilities, as if the user swaps the device and the new device doesn't support the same properties of the old one. As it is right now, I don't think the behaviour above is what our v4l2 code does. I think it should be what it does. Contributions that implement this behaviour would be welcomed. Hope the user experience considerations that led to rejecting this feature were cleared up. I appreciate that a lot of effort was put in this PR. It is unfortunate that it took so long to close this. I hope we (I) can do better and act faster in the future. |
|
I have a rk3588 board with hdmirx port, but there is only Debian has added this pr to the obs-studio is packages: https://salsa.debian.org/multimedia-team/obs-studio/-/commit/4a353a071febf315746a9d184bc6506e31421882, and this pr code is also included in ubuntu 24.04. When running obs-studio installed from debian or ubuntu's apt repo, if I add a v4l2 capture device, obs will crash. After rebuilding obs-studio without this patch, issue is gone. |
|
There are no debian maintainers here. If you are trying to report a bug about debian you are in the wrong place. |
|
I'm just posting a FYI message, not asking someone to fix the bug in debian. |
|
@amazingfate thanks for the info. I didn't expect that to be included into Debian :). |
|
@keriszafir sorry for the late reply. I don't know if it's still relevant. |
|
@ggodlewski @amazingfate I created a updated version of this PR here: #9246 I'm working at the Blender Studio and we have been using that patch without issues since then. If you have any issues with the patch you could report it in the https://projects.blender.org/ZedDB/studio_portage_conf repo. There is also a design task about it here in the OBS repo: obsproject/design#21 |
|
If you guys have any feedback on the design task please drop a message in that task. |
|
@DarkDefender I don't care much about UI as long as it supports all my use cases (id, path, other). I also another PR which changes slightly UI. It might be less controversial since it only adds missing controls. |
|
I also don't care UI. What I want is just to fix the current OBS bug. |
Your patch works fine. After clicking |
|
@amazingfate Awesome! Perhaps you could poke the Debian maintainers to switch to my patch? I'm not using Ubuntu/Debian myself, so I think it would be best for an actual end user to do it. (Especially since you had issues with the current included patch). Also useful to know that you have a device that only has a "by path" and not "by id". |
Here is the log when using obs with your patch: It seems that no capture device is deteted. |


Description
Use /dev/v4l/by-id or /dev/v4l/by-path when available in order to persist device binding to specific source.
Fixes #3003
Closes #3437
Motivation and Context
Currently v4l2 uses /dev/videoX which is not consistent across reboots and device reconnections.
This patch uses directories:
The device can exists twice on the list (by-id vs by-path addressing). It's up to user which connect to the source.
In case of by-path device the source name consist of "bus_info (device name)"
Otherwise it uses current naming: "device name (bus_info)"
Fixes #3003
Closes #3437
How Has This Been Tested?
Tested with 5 different v4l2 devices:
ID 04fc:6353 Sunplus Technology Co., Ltd General USB Device (Lamax Electra)
ID 0c45:6366 Microdia Webcam Vitade AF (Digital microscope)
ID 534d:2109 MacroSilicon USB3.0 HD VIDEO (Video grabber)
ID 046d:082d Logitech, Inc. HD Pro Webcam C920
ID 046d:085e Logitech, Inc. BRIO Ultra HD Webcam
Test Case 1:
Test Case 2:
Test Case 3:
Test Case 4:
Test Case 5:
sudo modprobe v4l2loopback devices=1 video_nr=88 ; ffmpeg -re -f lavfi -i "movie=something.mp4" -f v4l2 /dev/video88Types of changes
Checklist: