Mjpg-streamer not working after reboot

I have searched the existing open and closed issues

Required Information

  • DietPi version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=9
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘applied’
    G_LIVE_PATCH_STATUS[1]=‘applied’
    G_LIVE_PATCH_STATUS[2]=‘not applicable’

  • Distro version bookworm 0

  • Kernel version Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

  • Architecture arm64

  • SBC model RPi 3 Model B+ (aarch64)

Hello,

Running latest Dietpi on RPi3 and just installed mjpg-streamer. After install and enabling DietPi Codecs, RPi Camera, RPi Camera LED via dietpi-config the stream will show in the web browser:

http://192.168.1.10:8082/?action=stream

Good!

However, after reboot, the stream will not show and the commands listed in the dietpi website result in error messages:

dietpi@DietPi:~$ sudo systemctl status mjpg-streamer
× mjpg-streamer.service - mjpg-streamer (DietPi)
     Loaded: loaded (/etc/systemd/system/mjpg-streamer.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Thu 2025-01-02 07:56:56 GMT; 2min 54s ago
   Duration: 334ms
       Docs: https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental
    Process: 436 ExecStart=/opt/mjpg-streamer/mjpg_streamer -i input_uvc.so -d /dev/video0 -o output_http.so -p 8082 -n (code=exited, status=1/FAILURE)
   Main PID: 436 (code=exited, status=1/FAILURE)
        CPU: 158ms

Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: Format............: JPEG
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: TV-Norm...........: DEFAULT
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: init_VideoIn failed
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Desired Resolution: 640 x 480
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Frames Per Second.: -1
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Format............: JPEG
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: TV-Norm...........: DEFAULT
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: init_VideoIn failed
Jan 02 07:56:56 DietPi systemd[1]: mjpg-streamer.service: Main process exited, code=exited, status=1/FAILURE
Jan 02 07:56:56 DietPi systemd[1]: mjpg-streamer.service: Failed with result 'exit-code'.
dietpi@DietPi:~$ sudo journalctl -u mjpg-streamer
Jan 02 07:56:56 DietPi systemd[1]: Started mjpg-streamer.service - mjpg-streamer (DietPi).
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: starting application
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG Streamer Version.: 2.0
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: MJPG Streamer Version.: 2.0
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: Using V4L2 device.: (null)
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: Desired Resolution: 640 x 480
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: Frames Per Second.: -1
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Using V4L2 device.: (null)
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: Format............: JPEG
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: TV-Norm...........: DEFAULT
Jan 02 07:56:56 DietPi mjpg_streamer[436]:  i: init_VideoIn failed
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Desired Resolution: 640 x 480
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Frames Per Second.: -1
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: Format............: JPEG
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: TV-Norm...........: DEFAULT
Jan 02 07:56:56 DietPi mjpg_streamer[436]: MJPG-streamer [436]: init_VideoIn failed
Jan 02 07:56:56 DietPi systemd[1]: mjpg-streamer.service: Main process exited, code=exited, status=1/FAILURE
Jan 02 07:56:56 DietPi systemd[1]: mjpg-streamer.service: Failed with result 'exit-code'.

I notice /dev/video0 does not longer exist

dietpi@DietPi:~$ sudo ls -alh /dev/video*
crw-rw---- 1 root video 81,  0 Jan  2 07:56 /dev/video10
crw-rw---- 1 root video 81,  3 Jan  2 07:56 /dev/video11
crw-rw---- 1 root video 81,  8 Jan  2 07:56 /dev/video12
crw-rw---- 1 root video 81,  1 Jan  2 07:56 /dev/video13
crw-rw---- 1 root video 81,  2 Jan  2 07:56 /dev/video14
crw-rw---- 1 root video 81,  4 Jan  2 07:56 /dev/video15
crw-rw---- 1 root video 81,  5 Jan  2 07:56 /dev/video16
crw-rw---- 1 root video 81, 11 Jan  2 07:56 /dev/video18
crw-rw---- 1 root video 81,  6 Jan  2 07:56 /dev/video20
crw-rw---- 1 root video 81,  7 Jan  2 07:56 /dev/video21
crw-rw---- 1 root video 81,  9 Jan  2 07:56 /dev/video22
crw-rw---- 1 root video 81, 10 Jan  2 07:56 /dev/video23
crw-rw---- 1 root video 81, 12 Jan  2 07:56 /dev/video31

I’m attaching dmesg output as well

[    5.546158] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    5.547774] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    5.547808] [vc_sm_connected_init]: start
[    5.548705] [vc_sm_connected_init]: installed successfully
[    5.567148] mc: Linux media interface: v0.10
[    5.629939] videodev: Linux video capture interface: v2.00
[    5.705314] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.708730] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.726159] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    5.730688] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    5.738118] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.738169] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    5.742877] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    5.743541] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    5.744057] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.744064] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    5.744112] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    5.744584] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    5.744636] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.744654] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.744668] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.744681] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.752857] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[    5.753507] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[    5.753893] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[    5.754261] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[    5.754294] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.754312] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.754325] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.754338] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.754510] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    5.755089] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    5.755146] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    5.758096] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    5.785519] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[    5.785579] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[    5.791508] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[    5.791564] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[    5.982660] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    6.009544] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    6.080432] brcmfmac: F1 signature read @0x18000000=0x15264345
[    6.086825] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    6.088778] usbcore: registered new interface driver brcmfmac
[    6.323641] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Aug 29 2023 01:47:08 version 7.45.265 (28bca26 CY) FWID 01-b677b91b
[    7.861496] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save disabled
[   13.504847] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   26.073228] Initializing XFRM netlink socket
[   26.134088] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.

RPi Camera is not official. Still it worked perfectly until reboot. Thank you for any piece of advice. I will be glad to run any tests needed.

maybe @MichaIng has an idea

It worked with the input_uvc module? That is interesting. If you had the RPi camera stack enabled before installing it, it would have loaded the input_raspicam module, and I was expecting it to be required in any case, if the lagacy stack is still available (kernel/firmware-wise) at all. Currently, you have KMS enabled, probably you installed some GUI application which requires it? mjpg-streamer so far/natively supports the legacy camera driver only, not the modern one along with KMS.

Please disable KMS and see whether this fixes the steam:

sed --follow-symlinks -Ei '/^[[:blank:]]*dtoverlay=vc4-f?kms-v3d/d' /boot/config.txt

See also: Raspberry Pi | Legacy camera apps fail on Bookworm · Issue #6848 · MichaIng/DietPi · GitHub

Thank you for the feedback.
In my previous attempt I install mjpeg-streamer and later added the RPi Camera stack (DietPi Codecs, RPi Camera) so that may be why it worked ok with input_uvc Regarding kms I only installed docker and docker-compose Nothing else.

Now, I’m trying as suggested so:
Just to try it again I started from zero, so:
Latest DietPi image burnt to SD card and after install:
Enable DietPi Codecs, RPi Camera via dietpi-config, RPi Camera LED is already enabled by default
reboot (root user)
Now dietpi user so

sudo dmesg
[    5.200518] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    5.200547] [vc_sm_connected_init]: start
[    5.232822] [vc_sm_connected_init]: installed successfully
[    5.251338] videodev: Linux video capture interface: v2.00
[    5.286913] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.325493] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    5.345605] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    5.351013] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    5.515197] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.541824] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.655344] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.655353] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    5.655399] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    5.656047] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    5.657376] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    5.658271] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.658329] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    5.658853] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    5.658887] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.658909] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.658924] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.658937] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.658984] brcmfmac: F1 signature read @0x18000000=0x15264345
[    5.662259] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    5.662302] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    5.664773] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[    5.664886] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[    5.664967] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[    5.665244] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[    5.666621] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[    5.666952] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[    5.666996] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.667012] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.667025] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.667038] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.667247] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    5.667393] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[    5.667439] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image

sudo dietpi-software > search software > mjpeg-stramer > install

dietpi@DietPi:~$ ls -alh /dev/video*
no video0

sudo reboot

dietpi@DietPi:~$ sudo cat /boot/config.txt | grep kms
dietpi@DietPi:~$

no reference to kms

dietpi@DietPi:~$ sudo systemctl status mjpg-streamer
× mjpg-streamer.service - mjpg-streamer (DietPi)
     Loaded: loaded (/etc/systemd/system/mjpg-streamer.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Thu 2025-01-02 12:15:57 GMT; 2min 19s ago
   Duration: 155ms
       Docs: https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental
    Process: 433 ExecStart=/opt/mjpg-streamer/mjpg_streamer -i input_raspicam.so -o output_http.so -p 8082 -n (code=exited, status=1/FAILURE)
   Main PID: 433 (code=exited, status=1/FAILURE)
        CPU: 147ms

Jan 02 12:15:57 DietPi mjpg_streamer[433]:        Perhaps you want to adjust the search path with:
Jan 02 12:15:57 DietPi mjpg_streamer[433]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Jan 02 12:15:57 DietPi mjpg_streamer[433]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]: MJPG Streamer Version.: 2.0
Jan 02 12:15:57 DietPi systemd[1]: mjpg-streamer.service: Main process exited, code=exited, status=1/FAILURE
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]: ERROR: could not find input plugin
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]:        Perhaps you want to adjust the search path with:
Jan 02 12:15:57 DietPi systemd[1]: mjpg-streamer.service: Failed with result 'exit-code'.
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory

No success, but you may notice -i input_raspicam.so

dietpi@DietPi:~$ sudo journalctl -u mjpg-streamer
Jan 02 12:15:56 DietPi systemd[1]: Started mjpg-streamer.service - mjpg-streamer (DietPi).
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]: starting application
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG Streamer Version.: 2.0
Jan 02 12:15:57 DietPi mjpg_streamer[433]: ERROR: could not find input plugin
Jan 02 12:15:57 DietPi mjpg_streamer[433]:        Perhaps you want to adjust the search path with:
Jan 02 12:15:57 DietPi mjpg_streamer[433]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Jan 02 12:15:57 DietPi mjpg_streamer[433]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]: MJPG Streamer Version.: 2.0
Jan 02 12:15:57 DietPi systemd[1]: mjpg-streamer.service: Main process exited, code=exited, status=1/FAILURE
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]: ERROR: could not find input plugin
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]:        Perhaps you want to adjust the search path with:
Jan 02 12:15:57 DietPi systemd[1]: mjpg-streamer.service: Failed with result 'exit-code'.
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Jan 02 12:15:57 DietPi mjpg_streamer[433]: MJPG-streamer [433]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory

Should I follow a different approach. Thank you in advance.

Did you try > export LD_LIBRARY_PATH=/path/to/plugin/folder ?

Thank you @anika200 I notice plugins are located in /opt/mjpg-streamer/

dietpi@DietPi:~$ ls -alh /opt/mjpg-streamer/
total 308K
drwxr-xr-x 2 root root 4.0K Jan  2 12:13 .
drwxr-xr-x 3 root root 4.0K Jan  2 12:13 ..
-rwxr-xr-x 1 root root  72K Jan  2 12:13 input_file.so
-rwxr-xr-x 1 root root  72K Jan  2 12:13 input_http.so
-rwxr-xr-x 1 root root  76K Jan  2 12:13 input_uvc.so
-rwxr-xr-x 1 root root  67K Jan  2 12:13 mjpg_streamer
-rwxr-xr-x 1 root root  72K Jan  2 12:13 output_file.so
-rwxr-xr-x 1 root root  73K Jan  2 12:13 output_http.so
-rwxr-xr-x 1 root root  71K Jan  2 12:13 output_rtsp.so
-rwxr-xr-x 1 root root  71K Jan  2 12:13 output_udp.so

so…

dietpi@DietPi:~$ export LD_LIBRARY_PATH=/opt/mjpg-streamer
dietpi@DietPi:~$ sudo systemctl daemon-reload 
dietpi@DietPi:~$ sudo systemctl status mjpg-streamer
× mjpg-streamer.service - mjpg-streamer (DietPi)
     Loaded: loaded (/etc/systemd/system/mjpg-streamer.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Thu 2025-01-02 13:29:55 GMT; 1min 37s ago
   Duration: 159ms
       Docs: https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental
   Main PID: 432 (code=exited, status=1/FAILURE)
        CPU: 150ms

Jan 02 13:29:55 DietPi mjpg_streamer[432]:        Perhaps you want to adjust the search path with:
Jan 02 13:29:55 DietPi mjpg_streamer[432]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Jan 02 13:29:55 DietPi mjpg_streamer[432]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
Jan 02 13:29:55 DietPi mjpg_streamer[432]: MJPG-streamer [432]: MJPG Streamer Version.: 2.0
Jan 02 13:29:55 DietPi mjpg_streamer[432]: MJPG-streamer [432]: ERROR: could not find input plugin
Jan 02 13:29:55 DietPi systemd[1]: mjpg-streamer.service: Main process exited, code=exited, status=1/FAILURE
Jan 02 13:29:55 DietPi mjpg_streamer[432]: MJPG-streamer [432]:        Perhaps you want to adjust the search path with:
Jan 02 13:29:55 DietPi systemd[1]: mjpg-streamer.service: Failed with result 'exit-code'.
Jan 02 13:29:55 DietPi mjpg_streamer[432]: MJPG-streamer [432]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Jan 02 13:29:55 DietPi mjpg_streamer[432]: MJPG-streamer [432]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory

Maybe the service file should be edited to fully reference to that path?

dietpi@DietPi:~$ sudo nano /etc/systemd/system/mjpg-streamer.service 
Unit]
Description=mjpg-streamer (DietPi)
Documentation=https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental
Wants=network-online.target
After=network-online.target remote-fs.target

[Service]
User=mjpg-streamer
WorkingDirectory=/opt/mjpg-streamer
ExecStart=/opt/mjpg-streamer/mjpg_streamer -i 'input_raspicam.so' -o 'output_http.so -p 8082 -n'

# Hardening
ProtectSystem=strict
PrivateTmp=true
ProtectHome=true
ProtectKernelTunables=true
ProtectControlGroups=true

[Install]
WantedBy=multi-user.target

Wait, just in case, it seems there’s no input_raspicam.so

dietpi@DietPi:~$ sudo find / -name input_raspicam.so
dietpi@DietPi:~$
1 Like

Not sure why it is not there, I guess you could try building it yourself from github, It is nine years old though so not sure.

https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental/plugins/input_raspicam

The readme has some info.