Skip to content

Feature Suggestion: Use libgphoto2 to control an attached mirrorless camera #69

@cnschn

Description

@cnschn

I've been using this wonderful project with a Logitech webcam in the past, but have now switched to a mirrorless camera (a Sony a6400) hooked up to an inexpensive USB HDMI capture card.

While I still use cameractrlsgtk for a quick preview of the capture card's output, I obviously cannot control any of the camera's settings anymore. I can however control the camera using libgphoto2, in fact it's really easy to do so via its python bindings.

See for example this simple PyQT tool that queries all available options for a camera and presents them using the appropriate widgets. Conveniently, libgphoto2 already provides all the information about how to present the option, e.g. (from above PyQT script):

[...]
      for child in camera_config.get_children():
            label = '{} ({})'.format(child.get_label(), child.get_name())
            child_type = child.get_type()
            if child_type == gp.GP_WIDGET_SECTION:
                if not tabs:
                    tabs = QtWidgets.QTabWidget()
                    self.layout().insertRow(0, tabs)
                tabs.addTab(SectionWidget(config_changed, child), label)
            elif child_type == gp.GP_WIDGET_TEXT:
                self.layout().addRow(label, TextWidget(config_changed, child))
            elif child_type == gp.GP_WIDGET_RANGE:
                self.layout().addRow(label, RangeWidget(config_changed, child))
            elif child_type == gp.GP_WIDGET_TOGGLE:
                self.layout().addRow(label, ToggleWidget(config_changed, child))
[...]

And so on. Would something like this fit into cameractrls? My absolute dream would be a way to specify "this v4l2 video device (the capture card) belongs to this libgphoto2 device (the camera)" and have it show up as a configurable camera in cameractrlsgtk.

If anyone is interested in something like this I can have a look into what would be needed myself.

EDIT: A quick read of cameractrls.py suggests that adding something like a class GPhoto2Ctrls should be simple enough. I'm not sure if all the controls exposed for a libgphoto2 device have a consistent enough naming scheme to have some identifiers in the pop_list_by_*() calls find everything relevant automatically, but at the very least it should be easy to hack something together for my specific setup as a proof of concept.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions