2

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"
1
  • does this script work when run manually? how did you make this script to run at boot time?
    – lenik
    Commented May 17, 2013 at 2:49

4 Answers 4

2

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"
2
  • does this script work with the raspberry camera module?
    – Piotr Kula
    Commented 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
    Commented Jun 20, 2013 at 22:48
1

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"
################

Follow along these steps in order to make it work

1

I solved it by adding this to rc.local

enter image description here

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.