I seem to be having trouble getting this to work, I'm trying to run mjpg-streamer when the Raspberry boots, but it doesn't using the script below. I have mjpg-streamer installed in: /home/pi/mjpg-streamer/mjpg-streamer
I appreciate any help provided! Thank you.
Code:
#!/bin/sh
STREAMER=/home/pi/mjpg-streamer/mjpg-streamer/mjpg_streamer
DEVICE=/dev/video0
RESOLUTION=320x240
FRAMERATE=25
HTTP_PORT=8080
$STREAMER -i "./input_uvc.so -n -d $DEVICE -r $RESOLUTION -f $FRAMERATE" -o "./output_http.so -n -p $HTTP_PORT"
-
does this script work when run manually? how did you make this script to run at boot time?lenik– lenik2013年05月17日 02:49:21 +00:00Commented May 17, 2013 at 2:49
4 Answers 4
I fixed it after trial and error:
#!/bin/sh
STREAMER=/home/pi/mjpg-streamer/mjpg-streamer/mjpg_streamer
DEVICE=/dev/video0
RESOLUTION=320x240
FRAMERATE=25
HTTP_PORT=8080
$STREAMER -i "/home/pi/mjpg-streamer/mjpg-streamer/input_uvc.so -n -d $DEVICE -r
$RESOLUTION -f $FRAMERATE" -o "/home/pi/mjpg-streamer/mjpg-streamer/output_http.so -n -p
$HTTP_PORT"
-
does this script work with the raspberry camera module?Piotr Kula– Piotr Kula2013年05月17日 07:33:07 +00:00Commented May 17, 2013 at 7:33
-
@troop231: How you actually make it so start from boot ? Can you specify what command you've used ?el.severo– el.severo2013年06月20日 22:48:10 +00:00Commented Jun 20, 2013 at 22:48
What I've used and it works for me is:
#!/bin/sh
#
# created by : [email protected]
#
# last update: 2014年01月24日.
#
################
# customize these:
# mjpg_streamer's install location
MJPG_STREAMER_INSTALL="/home/pi/builds/mjpg-streamer"
# mjpg_streamer excutable's location
MJPG_STREAMER="$MJPG_STREAMER_INSTALL/mjpg_streamer"
# streaming port
MJPG_STREAMER_PORT="8080"
# htmls and related files' location
MJPG_STREAMER_WWW="$MJPG_STREAMER_INSTALL/www"
# video device
DEVICE_IN="/dev/video0"
# video settings
RESOLUTION="640x480"
FPS=24
# authentication
USERNAME="pi"
PASSWORD="raspberry"
if [ ! -z $USERNAME ] && [ ! -z $PASSWORD ]; then
AUTH="-c $USERNAME:$PASSWORD"
else
AUTH=""
fi
# LED blink
LED="off" # on/off/blink/auto (may not work on rpi camera modules)
# plugin
PLUGIN_IN="$MJPG_STREAMER_INSTALL/input_uvc.so -d $DEVICE_IN -r $RESOLUTION -f $FPS -l $LED"
PLUGIN_OUT="$MJPG_STREAMER_INSTALL/output_http.so -p $MJPG_STREAMER_PORT -w $MJPG_STREAMER_WWW $AUTH"
################
# run mjpg_streamer
$MJPG_STREAMER -i "$PLUGIN_IN" -o "$PLUGIN_OUT"
################
I solved it by adding this to rc.local
you most definitely should replace ./input_uvc.so
in your script with the full-path links, because most probably it's not going to be started from your home directory or whatever place you think it might be started from.