Webcam Autofocus

Hello, everyone,

I have a question about the autofocus of the webcam. I would like to switch it off. 
When I go to the local side of the M-JPEG streamer I can turn off the focus and set a manual value. Unfortunately this setting is not saved. 
I then sent the following commands via SSH:
sudo v4l2-ctl --set-ctrl=focus_auto=0
sudo v4l2-ctl --set-ctrl=focus_absolute=40

These commands disable the autofocus and set a manual focus. Unfortunately you have to send them again after each restart. 
So I wanted to ask you if there is a possibility to set these commands always at system start.
Unfortunately an entry in the rc.local did not work. 

Comments

  • Try adding it to /usr/local/Repetier-Setup/bin/startAllCams at the end. That script is run to start all mjpg_streamer when new webcams are available. So there it should work.
  • Many thanks for the quick help. This works great. The autofocus is now off after a restart and the manual focus is set.
    Thanks a lot.
  • Hello i´m new @ ssh and whre i can find my cam name?
    I would also like to switch off the autofocus (Cannot open device /dev/video0, exiting.)

  • ps aux | grep mjpg

    shows running mjpg streamer instances with command line. The -d parameter is your device and you also see the assigned port. From there it should be easy to change the parameter.


    For some reason the buster now seems to show multiple entries per webcam but only one will work.

  • Repetier said:

    ps aux | grep mjpg

    shows running mjpg streamer instances with command line. The -d parameter is your device and you also see the assigned port. From there it should be easy to change the parameter.


    For some reason the buster now seems to show multiple entries per webcam but only one will work.

    hmm OK thanks for the answer  ;)

    So I get this displayed
    Sl   19:44   0:01 /usr/local/bin/mjpg_streamer -i /usr/local/lib/mjpg-streamer/input_uvc.so -d /dev/video0 --fps 24 -q 85 -r 1280x720  -o /usr/local/lib/mjpg-streamer/output_http.so -p 8082 -w /usr/local/share/mjpg-streamer/www -b


    I can not interpret it so well what and how to understand it or how I find out how I enter my cam :/
    sudo v4l2-ctl --set-ctrl=focus_auto=0


  • From -d /dev/video0 you see device is /dev/video0 so command is
    sudo -d /dev/video0 v4l2-ctl --set-ctrl=focus_auto=0
  • So I get this message
    sudo: invalid option -- 'd'

    when i use  

    sudo -d /dev/video0 v4l2-ctl --set-ctrl=focus_auto=0
     :/ 
  • Pasted it in wrong position

    sudo v4l2-ctl -d /dev/video0 --set-ctrl=focus_auto=0

    should do it.

  • super , thanks for help, now works fine also the absolute command B)

    now i just need the right command to set these commands always at system start
    you said "Try adding it to /usr/local/Repetier-Setup/bin/startAllCams at the end"
    I tried something around but didn't find the right one :/

  • What is the problem. 
    sudo nano  /usr/local/Repetier-Setup/bin/startAllCams

    and add it after the last line. Then it always runs after the streamer is started.

  • Repetier said:
    What is the problem. 
    that was a new command for me (nano)

    thaks for this "noob" howto ;)  now works all fine with the cam as I imagine it
    i love the repetier server to make my prints!

    thanks a lot 
    • Greetings from Germany
Sign In or Register to comment.