Skip to content

v4l2 properties not set when changing device in video capture device #3865

Closed as not planned

Description

@janakelarsson

Platform

Operating system and version: Ubuntu Linux 20.04
OBS Studio version: 26.0.2, installed via snap package

Expected Behavior

When I switch camera in a Video Capture Device I expect the settings in the Video Capture Device dialogs to be applied on the camera.

Current Behavior

I need to manually select each option I need to apply (resolution, zoom, manual focus, power line frequency, ...), change the setting away from the setting I want and then change it back to /set/ the value.

I think this only happens if I disconnect hardware and re-insert it. Perhaps also on sleep/resume

Steps to Reproduce

  1. Disconnect camera from laptop
  2. Re-connect camera, this will now appear as different device
  3. Select new camera device in Video Capture Device
  4. Start re-applying settings

Additional information

Activity

  1. Fenrirthviti commented on Dec 11, 2020

    @Fenrirthviti
    Member

    Maybe I'm misunderstanding here, but if the system is treating this as a new device, sounds normal? I wouldn't want to apply previous device settings to a new device that might not be the same one, that sounds like a bad idea.

  2. janakelarsson commented on Dec 11, 2020

    @janakelarsson
    Author

    If I wanted different settings, I would have created (two different scenes with) two different Video Capture Devices.

    Plus, that this gets reset if the computer wakes up from suspend really is a hassle. Or if I remove the computer from the dock, run to a meeting without the camera, and then return to my office, I then need to reset all of the settings I thought I had fixed.

    Also, my ambient light won't magically shift from 50 Hz to 60 Hz for example.

    If this really was intentional, then why do the settings remain in the UI (without being applied to the new --- in reality same --- device)?

  3. Scrxtchy commented on Dec 12, 2020

    @Scrxtchy
    Contributor

    It sounds lik but these are the device configurations that are provided by the driver of the camera, and not the properties that are controlled by by OBS. There have been a plethora of discussions that people have in regards to their logitech webcams not persisting settings at all, more specifically for a single device, but these UVC controls are isolated to that device so I don't expect them to be have any sync capability.
    https://obsproject.com/forum/threads/why-does-my-webcam-settings-in-obs-keep-resetting-configure-video-setting.107243/
    As mentioned in this forum thread, device settings are not ccontrolled by OBS by any capacity, it is only a dialogue exposed by the device driver, and the vendor is responsible for its functionality.

  4. janakelarsson commented on Dec 13, 2020

    @janakelarsson
    Author

    You mean to say, the dialog itself is displayed by the driver, not by OBS Studio? On a linux system? Forgive me if I doubt that, but this makes me curious. Can you point to where in the source I would find the call to open the driver dialogue?

  5. Scrxtchy commented on Dec 13, 2020

    @Scrxtchy
    Contributor

    I have found the fatal flaw in my point of view. I was under the assumption that dshow is platform agnostic and that's what I had made by basis off of, this isn't the case as it is purely Microsoft APIs. The dshow code is still a little complicated but I still understand how it works.
    Now that I'm looking at the code responsible for linux capture, it is a bit more complicated that I'm willing to sink time into.

  6. janakelarsson commented on Dec 13, 2020

    @janakelarsson
    Author

    That sounds more like what I expect. Can you link to where in the code to look?

  7. Fenrirthviti commented on Dec 13, 2020

    @Fenrirthviti
    Member

    There was a PR recently that added support to these controls for v4l2 (which is what Linux uses, dshow is windows-only).

    You can see the PR (and references to codepaths which are controlling theses settings) here: #1815

  8. janakelarsson commented on Dec 13, 2020

    @janakelarsson
    Author

    That helps explain the situation. I'll try to follow the discussion there (also).

  9. Fenrirthviti commented on Dec 13, 2020

    @Fenrirthviti
    Member

    Sorry, I say recently but this was about a year ago, there was one a few months back that fixed up some issues with the controls (unrelated to this specific issue), but hopefully helps point you in the right direction.

    While not 100% the same thing, there's been a lot of discussion historically on the Windows dshow side of things where we should save those driver-specific settings and just apply them if the same device is detected. There's documentation that seems to indicate there is some expectation for an application to be saving those settings individually, rather than system-wide (which, when you think about it, makes sense as you might have different settings for different applications). I'd say the same expectation applies here, given the current behavior. I'm unsure what the best solution is, though.

  10. janakelarsson commented on Dec 13, 2020

    @janakelarsson
    Author

    I saw it was a year ago and thought recent meant different things to you and me, no real problem.

    For devices, trouble is to keep track of what was set before. I would be fine with using different scenes with different settings for different cameras.

    I'd expect the following behavior: either 1) When I insert a new device I get the defaults displayed in the dialog. I then need to re-set everything. Or (preferred) 2) When I insert a device I get the settings I have specified, which are displayed in the dialog. (Settings not available for the new device, that I changed, get greyed out. Or something.)

    As it is now I get 0) When I insert a device it has default settings but the ones displayed in the dialog is what I set before. I need to change them and then re-set to get the value I want. Every time I connect to the office dock.

  11. added
    platform/linux
    on Oct 19, 2022
  12. changed the title [-]Camera properties not set when changing device in video capture device[/-] [+]v4l2 properties not set when changing device in video capture device[/+] on Oct 19, 2022
  13. Fenrirthviti commented on Oct 14, 2024

    @Fenrirthviti
    Member

    Closing as stale. If this is still an issue please open a new issue with updated reproduction steps on the latest version of OBS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform/linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions