Issue
I am making a MJPEG video stream using Raspberry Pi with dedicated Pi Camera. For this I am using jpeg libraries and the following web application found on Github. The use is pretty straightforward, you just type cd mjpg-streamer/mjpg-streamer-experimental
and then ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"
. However, I would like to make it run on every reboot, so that the camera is "maintenance free".
I researched that I need to put the path and the executable file in the /etc/rc.local
. Nevertheless, when I put the path (mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"
) to this executable file, it did not work at all. I tried to run the stream as one command in the Terminal, it did not work either. I also tried to set up a variable PATH in .bashrc
in order to access it from /etc/rc.local
, but it also did not want to work.
I suspect it might have something to do with command ./mjpg_streamer
needing some input for it to work (-o "output_http.so -w ./www" -i "input_raspicam.so"
)
Do you have any idea how to start it with every reboot?
Thanks for your time and help
Solution
i have solved similar issue for my rpi and jpeg streamer as following.
create a shell script in /home/pi
touch /home/pi/mjpg-streamer.sh
edit that shell script and add this content
#!/bin/bash
cd /home/pi/mjpg-streamer/mjpg-streamer-experimental/
LD_LIBRARY_PATH=.
./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"
make sure new shell script has execution rights
add that shell script to your /etc/rc.local
Answered By - NauT