There was a problem loading the comments.

Setting up 3rd Party Webcam support for Mainsail or Fluidd on Creality K1, K1 Max, or Ender 3 V3 KE

Support Portal  »  Help Guides  »  Viewing Article

  Print

Prerequisites

This guide assumes you have already installed the latest firmware for your machine and have enabled Root access. Make sure you have already added a webcam in the Mainsail or Fluid interface using the MJPG Camera option (or whatever is closest in the options on your installation).

 

Video Guide

Locating and Testing The Camera

First connect the webcam to your printer and boot up the machine if it was not already on. Then SSH into your printer. Now we're going to run a command below to locate the webcam. You can run it one time with NO camera connected to see what is in the list (there are internal video devices) and then another time once it is connected to the machine.

v4l2-ctl --list-devices

Usually this will be /dev/video4.

Now we're going to test the config by executing a test command and if your device is NOT on /dev/video4 make sure to replace it with the correct video device in the command below.

/usr/bin/mjpg_streamer -i "/usr/lib/mjpg-streamer/input_uvc.so -d /dev/video4" -o "/usr/lib/mjpg-streamer/output_http.so -w /www/webcam -p 8080"

If everything is set up correctly, you should see output text indicating that the streamer is running, and your webcam feed should now be visible in Mainsail or Fluidd. Use Ctrl + C to stop the process.

Enabling Automatic Start on Boot

First install nano editor by running opkg install nano in the SSH terminal. Then run nano /etc/init.d/S99mjpg_streamer.

Copy and paste the following script into the window and then save it (CTRL + O) and then close it (CTRL + X). Make sure to change the /dev/video4 line to whatever your camera uses if it is different (this was located in the step above).

#!/bin/sh
### BEGIN INIT INFO
# Provides:          mjpg_streamer
# Required-Start:    $network $local_fs
# Required-Stop:     $network $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts MJPG Streamer
# Description:       Starts MJPG Streamer with specified options.
### END INIT INFO

case "$1" in
    start)
        echo "Starting MJPG Streamer..."
        /usr/bin/mjpg_streamer -i "/usr/lib/mjpg-streamer/input_uvc.so -d /dev/video4" -o "/usr/lib/mjpg-streamer/output_http.so -w /www/webcam -p 8080" &
        ;;
    stop)
        echo "Stopping MJPG Streamer..."
        killall mjpg_streamer
        ;;
    *)
        echo "Usage: /etc/init.d/mjpg_streamer {start|stop}"
        exit 1
        ;;
esac

exit 0

Now we need to make the script executable and then start/stop it to test.

Run chmod +x /etc/init.d/S99mjpg_streamer to make it executable. Then run the following commands to test the new service.

/etc/init.d/S99mjpg_streamer start
/etc/init.d/S99mjpg_streamer stop

Now just type reboot into the terminal and the system should restart. Once it is restarted you should have a webcam working automatically!

References

Script and other information was used from the Github post from rcourtman here: Setting Up a Third-Party Webcam for Mainsail/Fluidd with MJPG Streamer · Guilouz/Creality-K1-and-K1-Max · Discussion #413 (github.com)


Share via

Related Articles


On-Premise Help Desk Software by SupportPal
© TH3D Studio