Control Camera settings

I have searched and searched to find answers to my question.

And that is how to get control over my Camera Module inside Octolapse.

Like changing White balance and thoose kind of settings.

I found that i should change

#camera_http_webroot="./www-octopi"

#camera_http_options="-n"

to this:

camera_http_webroot="./www"

camera_http_options=""

This is inside "boot/octopi.txt".

But the problem is that i do not have an Octopi version of octoprint. I have it installed on Raspbian Stretch with desktop as a venv. According to this "Setting up OctoPrint on a Raspberry Pi running Raspbian"

How do i find thoose settings with this install ? Where is that .txt file that i can change settings in so that i can turn on the advanced settings ?

I am using the latest Octolapse and Latest octoprint. Actually installed octolapse 5 days ago.

Hi there! Those changes should only be required on an OctoPi instance. I'm not an mjpegstreamer expert, but I believe the base install includes access to control.htm, which is what Octolapse needs to control the camera. Some changes were made on OctoPi to provent remote control of your camera since lots of ppl use port forwarding when it shouldn't be used. It's possible some additional mjpegstreamer setup is required, but you should be able to test by going to your camera url (something like this - ip_address:8080\control.htm ) and seeing if control.htm pops up. If so, you just need to make sure your webcam url is correct in Octolapse.

Ye but when I go to "myurl:8080/control.htm" i get a yellow line at the top saying:

(null) Http output plugin

Inside octolapse under Camera settings at the bottom is the following:

Custom Image Preferences

Here you can adjust brightness, contrast, focus, pan, tilt, etc. for your webcam. If enabled, these preferences are applied at the start of each print.

It is highly recommended that you take the time to configure these settings since they can make a big difference in the quality of your timelapse, and reduce the required snapshot delay.

And there i can enable it but it does not work. And it actually states that the settings there most likely wont work. But if they most likely wont work, why have them there?

Ye but when I go to "myurl:8080/control.htm" i get a yellow line at the top saying:

This sounds like an mjpegstreamer install or startup issue. I'm not an expert on installing this package since I'm targeting primarily OctoPi users, so this question might be best answered on the mjpegstreamer github page.

And there i can enable it but it does not work. And it actually states that the settings there most likely wont work. But if they most likely wont work, why have them there?

I'm not sure what you mean by this. I have only one type of camera to test with (a logitech webcam) for mjpegstreamer, and some of the settings that appear in control.htm don't seem to affect MY camera. However, I strongly suspect these settings work on some other cameras, which is why I left them in there. Not all cameras, for example, support auto focus or pan and tilt, but SOME do (including mine).

Check this link that shows command usage. It looks like the www argument is included. You might want to check your startup script to see if it's there.

If I go to http://myurl:8080 then i get to Mjpegstreamer de o pages and when I try the link for control it just says (null) Http output plugin.

Ive installed this by the book.

But I guess that the problem aint with octolapse then.

Just that thoose settings cant be changed from within octoprint if im not using octopi? Am i right there?

@Jonas_Ohrfeldt, You should still be able to change the settings even if you aren't using OctoPi as long as control.htm (which is a part of mjpegstreamer NOT octopi) is working properly.

Also, installing 'by the book' might not include control.htm. Can you post your startup command for mjpegstreamer? I should probably try a manual install of this at some point so I am familiar with setup. OctoPi has spoiled me in this regard.

If you sroll down to section : Optional Webcam in this guide. Setting up OctoPrint on a Raspberry Pi running Raspbian

I have done Exactly like it says there. Only settings i can find there are in the script. Im using Raspberry pi camera module v2.1.

I havent used webcam for more then a week with raspberry so im quite new at it.

Part of the problem may be that I don't have a raspicam, and am unsure how it works regarding the control.htm page. However, I saw this in the setup guide you mentioned:

# runs MJPG Streamer, using the provided input plugin + configuration
function runMjpgStreamer {
    input=$1
    pushd $MJPGSTREAMER_HOME
    echo Running ./mjpg_streamer -o "output_http.so -w ./www" -i "$input"
    LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www" -i "$input"
    popd
}

Notice the ./www in there. Does your code look like that (I'm guessing it does)?

I think to debug this 100% I need a raspi cam. I'll add it to the growing list of equipment I need, lol! Hopefully I'll be able to figure it out before the next release.

Reviewing Guy's /root/bin/webcamd presumably part of the OctoPi image, there's a header at the top:

...Please edit the octopi.txt file instead...

...which leads us to foosel's FAQ on the subject.

/bin/webcamd:

#!/bin/bash

########################################################################
### DO NOT EDIT THIS FILE TO CHANGE THE CONFIG!!!                    ###
### ---------------------------------------------------------------- ###
### There is no need to edit this file for changing resolution,      ###
### frame rates or any other mjpg-streamer parameters. Please edit   ###
### /boot/octopi.txt instead - that's what it's there for! You can   ###
### even do this with your Pi powered down by directly accessing the ###
### file when using the SD card as thumb drive in your regular       ###
### computer.                                                        ###
########################################################################

MJPGSTREAMER_HOME=/home/pi/mjpg-streamer
MJPGSTREAMER_INPUT_USB="input_uvc.so"
MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so"

# init configuration - DO NOT EDIT, USE /boot/octopi.txt INSTEAD!
camera="auto"
camera_usb_options="-r 640x480 -f 10"
camera_raspi_options="-fps 10"
camera_http_webroot="./www-octopi"
camera_http_options="-n"
additional_brokenfps_usb_devices=()

if [ -e "/boot/octopi.txt" ]; then
    source "/boot/octopi.txt"
fi

brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "${additional_brokenfps_usb_devices[@]}")

# check if array contains a string
function containsString() {
  local e match="$1"
  shift
  for e; do [[ "$e" == "$match" ]] && return 0; done
  return 1
}

# cleans up when the script receives a SIGINT or SIGTERM
function cleanup() {
    # make sure that all child processed die when we die
    local pids=$(jobs -pr)
    [ -n "$pids" ] && kill $pids
    exit 0
}

# says goodbye when the script shuts down
function goodbye() {
    # say goodbye
    echo ""
    echo "Goodbye..."
    echo ""
}

# runs MJPG Streamer, using the provided input plugin + configuration
function runMjpgStreamer {
    input=$1
    pushd $MJPGSTREAMER_HOME > /dev/null 2>&1
        echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input"
        LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" &
        wait
    popd > /dev/null 2>&1
}

# starts up the RasPiCam
function startRaspi {
    logger -s "Starting Raspberry Pi camera"
    runMjpgStreamer "$MJPGSTREAMER_INPUT_RASPICAM $camera_raspi_options"
}

# starts up the USB webcam
function startUsb {
    options="$usb_options"
    device="video0"

    # check for parameter and set the device if it is given as a parameter
    input=$1
    if [[ -n $input ]]; then
        device=`basename "$input"`
    fi

    # add video device into options
    options="$options -d /dev/$device"

    uevent_file="/sys/class/video4linux/$device/device/uevent"
    if [ -e $uevent_file ]; then
        # let's see what kind of webcam we have here, fetch vid and pid...
        product=`cat $uevent_file | grep PRODUCT | cut -d"=" -f2`
        vid=`echo $product | cut -d"/" -f1`
        pid=`echo $product | cut -d"/" -f2`
        vidpid=`printf "%04x:%04x" "0x$vid" "0x$pid"`

        # ... then look if it is in our list of known broken-fps-devices and if so remove
        # the -f parameter from the options (if it's in there, else that's just a no-op)
        for identifier in ${brokenfps_usb_devices[@]};
        do
            if [ "$vidpid" = "$identifier" ]; then
                echo
                echo "Camera model $vidpid is known to not work with -f parameter, stripping it out"
                echo
                options=`echo $options | sed -e "s/\(\s\+\|^\)-f\s\+[0-9]\+//g"`
            fi
        done
    fi

    logger -s "Starting USB webcam"
    runMjpgStreamer "$MJPGSTREAMER_INPUT_USB $options"
}

# make sure our cleanup function gets called when we receive SIGINT, SIGTERM
trap "cleanup" SIGINT SIGTERM
# say goodbye when we EXIT
trap "goodbye" EXIT

# echo configuration
echo "Starting up webcamDaemon..."
echo ""
echo "--- Configuration: ----------------------------"
echo "camera:        $camera"
echo "usb options:   $camera_usb_options"
echo "raspi options: $camera_raspi_options"
echo "http options:  -w $camera_http_webroot $camera_http_options"
echo "-----------------------------------------------"
echo ""

# we need this to prevent the later calls to vcgencmd from blocking
# I have no idea why, but that's how it is...
vcgencmd version > /dev/null 2>&1

usb_options="$camera_usb_options"

# if webcam device is explicitly given in /boot/octopi.txt, save the path of the device
# to a variable and remove its parameter from usb_options
extracted_device=`echo $usb_options | sed 's@.*-d \(/dev/video[0-9]\+\).*@\1@'`
if [ "$extracted_device" != "$usb_options" ]
then
    # the camera options refer to a device, save it in a variable
    usb_device_path="$extracted_device"
    # replace video device parameter with empty string and strip extra whitespace
    usb_options=`echo $usb_options | sed 's/\-d \/dev\/video[0-9]\+//g' | awk '$1=$1'`
    echo "Explicitly set USB device was found in options: $usb_device_path"
fi

# keep mjpg streamer running if some camera is attached
while true; do

    # get list of usb video devices into an array
    video_devices=($(find /dev -regextype sed -regex '\/dev/video[0-9]\+' | sort 2> /dev/null))

    if [ ${#video_devices[@]} != 0 ] && { [ "$camera" = "auto" ] || [ "$camera" = "usb" ] ; }; then

        echo "Found video devices:"
        printf '%s\n' "${video_devices[@]}"

        if [[ $usb_device_path ]]; then
            # usb device is explicitly set in options
            if containsString "$usb_device_path" "${video_devices[@]}"; then
                # explicitly set usb device was found in video_devices array, start usb with the found device
                echo "USB device was set in options and found in devices, start MJPG-streamer with the configured USB video device: $usb_device_path"
                startUsb "$usb_device_path"
            else
                # explicitly set usb device was not found
                echo "Configured USB camera was not detected, trying again in two minutes"
                sleep 120 &
                wait
            fi
        else
            # device is not set explicitly in options, start usb with first found usb camera as the device
            echo "USB device was not set in options, start MJPG-streamer with the first found video device: ${video_devices[0]}"
            startUsb "${video_devices[0]}"
        fi

        sleep 30 &
        wait

    elif [ "`vcgencmd get_camera`" = "supported=1 detected=1" ] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi" ] ; }; then
        startRaspi
        sleep 30 &
        wait

    else
        echo "No camera detected, trying again in two minutes"
        sleep 120 &
        wait

    fi
done

Yes but since my install of octoprint is on raspbian stretch i dont have the octopi.txt file.

Sure i get the camera to work and can do octolapses. But I am unable to make changes the easy way wich i am looking for.

I can ofc use commands in my script.

I wish i was more experienced in scripting, that way one would actually be able to add all custom settings to octoprint that the raspberry pi camera module is capable of?

Why i got this camera is because most people recommended it.

So since i actually followed the guide to install Octoprint and webcam on a Pi running Raspbian stretch i do wonder where i could find theese settings?

My Guess is that the Webcamdaemon script that actually starts the webcam is the config file ?

And why isnt control.htm supported ? I do not get any snapshot there from my camera. And it looks like it does not load the "plugin".

:the lighting dims:
:drum music fillls the room:
:a voice speaks after the final note:

It is said that the original OctoPi image many moons ago was born straight from the fires of a volcano we call Ubehebe (which is maybe Polynesian for Raspbian Stretch).

Is that the point where I don my sith robe for dramatic effect?

2 Likes

Nicely played. I could only counter with my Gryffindor robe.

This might be the part where you use your light saber to slash a message into the wall that the user should start over by installing the OctoPi image. (I think they must have missed the "Heads Up" paragraph in the beginning.)

Well should i take this as your knowledge really isnt there, and the only way to handle it is to goof around making fun of users in need of help?

Foosel who actually wrote the guide on how to install it on raspbian stretch might be able to answer what I initially asked?

Its alot easier to answer "no Sorry we dont know how accomplish what you are asking for, we really dont know much at all. We just copy/paste info that we actually dont know anything about"

Allow people who are constantly fielding repetitive support requests which often (though not on this case) can be answered by using the Search and reading the FAQ a bit of late night fun, will you?

@FormerLurker already gave you something to check. It might be that mjpgstreamer's control stuff doesn't work with raspicams - I honestly wouldn't know because as you already heard we actually disable that stuff altogether in OctoPi for security reasons anyhow and instead recommend configuration via the config file, which is documented in the FAQ and if you followed the guide you can just use the very same file - just create it.

2 Likes

Thank you for a more informative answer.

I have tried to search for the answer, i think i mentioned that. And as always, if people would answer to my questions it is done whith free will. I am not forcing anyone to answer. But if they do answer, i would appreciate a more mature approach.

And yes, I tried to find my answers from links and other info in this thread, but I was unable to see what others saw.

Is there a way to download octopi.txt in its full content to see what other settings there is?

If you'd followed the FAQ link that @OutsourcedGuru provided you with you'd already found the contents of that file plus information on how to adjust it.

@Jonas_Ohrfeldt By your own admission you were working from foosel's installation instructions. Here is a screenshot of the very top of that page where she has highlighted in a quotation block the easiest method of installing OctoPrint on Raspbian:

Rather than following that advice, you then plowed ahead and installed it manually and are having difficulties. You wanted the first link on that page for OctoPi in this case. Both she and Guy have tried to make this super-easy.

So forgive me if I take the micky on this one when you suggest that you chose not to follow her instructions.

1 Like

Does that change the fact that she actually made a GUIDE on how to install it under raspbian.

You are kind of saying to me something like this "dumbasses like you should not be here wasting our time"

And someone in this threads said that I was to search using the search function BECAUSE it was wasting "important peoples(so they think)" time.

Let me ask you, who is actually wasting time here and making this thread alot longer then it needs to be?

If you dont have anything useful to say, it is usually best not to say anything.

And to make something clear. I do want to use my raspberry to more then ONE task. Yo do know that it is possible for a pi to run multiple servers?

Im running multiple servers for home automation, cloud services and such on my raspberry and it handles it like a charm.

It does also run octoprint. Using octolapse was just an unecessary fun option. If you had answered, what I was trying to do, was impossible, then i wouldnt have continued on that track.

People are not born with all knowledge you know, you learn from searching and asking.

Im so Sorry that I joined this forum. I did not know it was more of a comic con hangaround.