motioneye-project / motioneyeos

A Video Surveillance OS For Single-board Computers
Other
7.9k stars 904 forks source link

C920 autofocus does not work and there is no slider #2217

Open nigeljohnson73 opened 5 years ago

nigeljohnson73 commented 5 years ago

I have used a C920 on my pi for octoprint monitoring print jobs and the autofocus option worked fine. Looking on the v4l2-ctrl output on the command line it's enabled but the focus never changes (see below). Even when setting the slider for focus absolute nothing seems to change - probably because there is no option to disable the autofocus. Similarly with white balance in that, there is no slider so setting the colour does nothing while auto is set by default and no UI option to disable it.

I have also tried a second C920 and it will not autofocus either on motioneyeos, but dies fine when attached to my computer.

If I go in via ssh, I can manually set the autofocus to off, and then the set explicit values on the command line... but the sliders still do nothing.

I am not sure what is going on, but another interesting little issue-ette is that if you set the brightness to 1 via the slider in the UI, it will go dark. Set it to 250 and its washed out. Set it to 128 and nothing happens. Set it to 127 or 129 and it's back to normal.

[root@meye-1d25a3e6 ~]# v4l2-ctl --all
Driver Info:
    Driver name      : uvcvideo
    Card type        : HD Pro Webcam C920
    Bus info         : usb-0000:01:00.0-1.4
    Driver version   : 4.19.65
    Capabilities     : 0x84a00001
        Video Capture
        Metadata Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Media Driver Info:
    Driver name      : uvcvideo
    Model            : HD Pro Webcam C920
    Serial           : 5B86112F
    Bus info         : 1.4
    Media version    : 4.19.65
    Hardware revision: 0x00000019 (25)
    Driver version   : 4.19.65
Interface Info:
    ID               : 0x03000002
    Type             : V4L Video
Entity Info:
    ID               : 0x00000001 (1)
    Name             : HD Pro Webcam C920
    Function         : V4L2 I/O
    Flags         : default
    Pad 0x01000007   : 0: Sink
      Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3': Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 640/480
    Pixel Format      : 'MJPG' (Motion-JPEG)
    Field             : None
    Bytes per Line    : 0
    Size Image        : 614400
    Colorspace        : sRGB
    Transfer Function : Default (maps to sRGB)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization      : Default (maps to Full Range)
    Flags             : 
Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 640, Height 480
    Default     : Left 0, Top 0, Width 640, Height 480
    Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 640, Height 480, Flags: 
Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags: 
Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 30.000 (30/1)
    Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=199
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=200
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature 0x0098091a (int)    : min=2000 max=6500 step=1 default=4000 value=3526 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=583 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1
                   pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=0 max=250 step=5 default=0 value=55 flags=inactive
                     focus_auto 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100

Preliminary Docs

I confirm that I have read the CONTRIBUTING guide before opening this issue.

I confirm that I have read the FAQ before opening this issue.

motionEyeOS Version

I am running motionEyeOS version: 20190911.

Board Model

I am using the following board/model: RPI 3B+.

Camera

I am using the following type of camera: V4L2

My camera model is: Logitech C290

Network Connection

My motionEyeOS unit is connected to the network via: WiFi

Peripherals

I am not using any peripherals

Log Files

I consider the following log files relevant to this issue:

I don't have any logs that show any relevant information.

gfondeur commented 4 years ago

I have the same camera and I'm having issues with autofocus on motioneyeos

quizknows commented 2 years ago

I have a set up with a Microsoft cinema livecam on an RPI3b. I tried several things until this worked: To set / unset autofocus on V4l2 camera:

log in to command line on Pi (either via SSN (PuTTY) or direct connection and use MotionEye credentials

Type "v4l2-ctl --list-ctrls" after the prompt Like: [yourRPIname here ~]# v4l2-ctl --get-ctrl focus_auto Response: focus_auto: 1 (means autofocus is on)

to turn it off: [yourRPIname here ~]# v4l2-ctl --set-ctrl focus_auto=0

To keep off: type "nano /data/etc/userinit.sh" (this brings up the nano editor and opens a file called userinit.sh. The file is a custom startup command file) ref: https://github.com/motioneye-project/motioneyeos/wiki/Tweaks

add line: v4l2-ctl -c focus_auto=0 (=0 to turn off or=1 to turn ON)

write the file (CtrlO) and exit (CtrlX)