Using mjpg-streamer on Debian Bookworm

Users using recent version of Debian might have noticed, that the tutorial for setting up webcams for Linux doesn't work anymore. This is because mjpg-streamer requires "libjpeg8-dev" which is not available anymore, and its successor libjpeg9-dev is incompatible with it. Furthermore, the repository for mjpg-streamer seems to be abandoned, so fix is unlikely to come. For future developments something like ustreamer might be interesting, but for now I found a workaround, requiring minimal effort. (I also managed to get it working rudimentarily with ustreamer, however this skips the proper setup, and I won't guarantee that it will work for you.)

At first we have to install snap, the TL;DR is:

sudo apt update
sudo apt install snapd
sudo snap install core

After this is done, we can install mjpg-streamer and v4l2camera via snap:
sudo snap install mjpg-streamer
sudo snap install v4l2camera

In order for mjpg-streamer to be able to make calls to the cameras, we need to connect it to v4l2camera:
sudo snap connect mjpg-streamer:camera

And we are almost done! Because we installed mjpg-streamer via snap instead of apt, the configuration provided by Repetier in step 6, and configured in step 7 needs some additional modifications.

Per default these are:
MJPG_STREAMER=/usr/local/bin/mjpg_streamer
MJPG_PLUGIN_DIR=/usr/local/lib/mjpg-streamer
MJPG_WWW_DIR=/usr/local/share/mjpg-streamer/www

and we simply need to change them to:
MJPG_STREAMER=/snap/bin/mjpg_streamer
MJPG_PLUGIN_DIR=/snap/mjpg-streamer/current/lib/mjpg-streamer
MJPG_WWW_DIR=/snap/mjpg-streamer/current/share/mjpg-streamer/www

(I also suggest using WEBCAM_DIR=/dev/v4l/by-id/* instead of WEBCAM_DIR=/dev/v4l/by-path/* if you have issues with flaky USB connections, and your webcam frequently reconnecting, changing its path)

After this, you should be able to stick to the tutorial again, and it should work!

I hope I saved some of you the work of having to figure this out on your own :)

Comments

  • After much experimenting, I got ustreamer to work on Bookworm.  Here's what worked for me.  It would be a good thing if someone could confirm this procedure.

    note: libjpeg9-dev and libjpeg8-dev removed 

    sudo apt install libevent-dev libbsd-dev
    sudo apt-get install libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++

    cd ustreamer
    make
    ./ustreamer --help

    To run:

    cd ustreamer
    ./ustreamer --device=/dev/video0 --allow-origin=\* --host=0.0.0.0 --port=8080



Sign In or Register to comment.