Control Camera settings

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.

Relax, dude. If this were in real life, you'd see that I'm smiling when I mess with you. I was in the Air Force at one time and some light ribbing and humor are a part of being social.

1 Like

@Jonas_Ohrfeldt, I think you are taking things a bit too seriously. Everyone here is trying to help you. Tech support is very difficult, especially when it is not a paying job, and the software itself is open source and free. Some good spirited humor can be a good way to relax a bit when dealing with such complicated issues and myriad hardware configurations. Perhaps something was lost in translation?

I'd like to point out that the guide you used was NOT intended to support camera control, but rather to support a remote webcam stream, which it does correctly. Octolapse has limited support for the camera control you seek, but it is definitely incomplete and could use improvement. I'm running on a limited budget, both from a time and money perspective, and haven't gotten around to working on the raspicam. I even portioned out some of my Patreon money (thanks Patrons!) to order a raspicam (and a longer cable, since the stock version is uselessly short for this) so that I can see what's going on exactly with these things. I've recently added a newer control screen, so you can see that I'm actively working to improve things. Perhaps you'd like to contribute time or some spare change to assist with the development? If so I'd appreciate it.

I'm not sure that the webcam control is possible with a raspicam at this moment. I'm not sure why this camera is so highly recommended except for various hardware integrations due to its small form factor. A webcam can be purchased for around the same price, and is likely to have the features you want. If you have one lying around it wouldn't hurt to plug it in, change the input module (from raspicam module to webcam), and see if control.htm works.

Anyway, I hope you appreciate the situation from my perspective a bit better. I really hope your problem can be solved, and I'm sure everyone else on this thread does too.

4 Likes

And you're the author of OctoLapse so you'd be the one to know.

Hey Outsourced, let me call this as I see it, youโ€™re being a jack ass. Just because someone did not choose the "fast as possible" method and actually followed the instructions given, your trying to make fun of him. He explained what he did and the information he was looking for yet you referenced something, that was not part of what he did, which is not helpful. That is like giving someone instructions on how to fix an airplane when they are working on a car. If you can only support the "fast and easy" method because that is the best you can understand that's fine, stick to it. Just don't try to put others down just because you're not able to understand the more complicated stuff. Maybe you just need to get out and away from your computer more in order to learn how to be social.

1 Like