Commit b35b191 Sungjin Han
committed
1 parent 98f103e commit b35b191 Copy full SHA for b35b191
File tree 5 files changed +147
-0
lines changed
5 files changed +147
-0
lines changed Original file line number Diff line number Diff line change
1
+ .git
2
+ .gitignore
3
+ README.md
4
+ run-mjpg-streamer.sh.sample
5
+
6
+ systemd /
7
+
8
+ Dockerfile
9
+ docker-compose.yaml
10
+ .env
Original file line number Diff line number Diff line change
1
+ PORT = 8080
2
+ RESOLUTION = 800x600
3
+ FPS = 24
4
+ ANGLE = 0
5
+ FLIPPED = false
6
+ MIRRORED = false
7
+ USERNAME = pi
8
+ PASSWORD = raspberry
Original file line number Diff line number Diff line change
1
+ # Dockerfile for rpi-mjpg-streamer
2
+
3
+ # https://www.balena.io/docs/reference/base-images/base-images-ref/
4
+ ARG RPI=raspberrypi3
5
+
6
+ FROM balenalib/$RPI-debian:latest
7
+
8
+ WORKDIR /
9
+
10
+ # install packages
11
+ RUN apt-get update -y && \
12
+ apt-get install -y build-essential libjpeg8-dev imagemagick libv4l-dev git cmake uvcdynctrl libraspberrypi-bin
13
+
14
+ # build mjpg-streamer
15
+ RUN ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h && \
16
+ git clone https://github.com/jacksonliam/mjpg-streamer && \
17
+ cd mjpg-streamer/mjpg-streamer-experimental && \
18
+ cmake -DCMAKE_INSTALL_PREFIX:PATH=.. . && \
19
+ make install
20
+
21
+ # copy rpi-mjpg-streamer files
22
+ COPY ./ /
23
+
24
+ # arguments (default values in `.env` file)
25
+ ARG PORT
26
+ ARG RESOLUTION
27
+ ARG FPS
28
+ ARG ANGLE
29
+ ARG FLIPPED
30
+ ARG MIRRORED
31
+ ARG USERNAME
32
+ ARG PASSWORD
33
+
34
+ # environtment variables
35
+ ENV PORT=${PORT} \
36
+ RESOLUTION=${RESOLUTION} \
37
+ FPS=${FPS} \
38
+ ANGLE=${ANGLE} \
39
+ FLIPPED=${FLIPPED} \
40
+ MIRRORED=${MIRRORED} \
41
+ USERNAME=${USERNAME} \
42
+ PASSWORD=${PASSWORD}
43
+
44
+ # configure
45
+ RUN echo "{'angle': ${ANGLE}, 'flipped': ${FLIPPED}, 'mirrored': ${MIRRORED}}" \
46
+ > /www/config.json
47
+
48
+ # Open ports
49
+ EXPOSE $PORT
50
+
51
+ # Entry point for the built application
52
+ ENTRYPOINT ["/run-mjpg-streamer.docker.sh" ]
Original file line number Diff line number Diff line change
1
+ version : " 3.7"
2
+ services :
3
+ streamer :
4
+ build :
5
+ context : .
6
+ args :
7
+ - PORT=${PORT}
8
+ - RESOLUTION=${RESOLUTION}
9
+ - FPS=${FPS}
10
+ - ANGLE=${ANGLE}
11
+ - FLIPPED=${FLIPPED}
12
+ - MIRRORED=${MIRRORED}
13
+ - USERNAME=${USERNAME}
14
+ - PASSWORD=${PASSWORD}
15
+ image : rpi-mjpg-streamer:latest
16
+ devices :
17
+ - " /dev/video0:/dev/video0"
18
+ ports :
19
+ - " ${PORT}:${PORT}"
20
+ restart : always
21
+ command : run-mjpg-streamer.docker.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # Script for docker
4
+ #
5
+
6
+ # last update: 2019.04.24.
7
+ #
8
+
9
+ # ###############
10
+ # customize these:
11
+
12
+ # mjpg_streamer's install location
13
+ MJPG_STREAMER_DIR=" /mjpg-streamer"
14
+
15
+ # mjpg_streamer excutable's location
16
+ MJPG_STREAMER_BIN=" $MJPG_STREAMER_DIR /bin/mjpg_streamer"
17
+
18
+ # mjpg_streamer plugins' location
19
+ MJPG_STREAMER_PLUGINS_DIR=" $MJPG_STREAMER_DIR /lib/mjpg-streamer"
20
+
21
+ # streaming port
22
+ MJPG_STREAMER_PORT=$PORT
23
+
24
+ # htmls and related files' location
25
+ MJPG_STREAMER_WWW=" /www"
26
+
27
+ # video device
28
+ DEVICE_IN=" /dev/video0"
29
+
30
+ # video settings
31
+ RESOLUTION=$RESOLUTION
32
+ FPS=$FPS
33
+
34
+ # authentication
35
+ USERNAME=$USERNAME
36
+ PASSWORD=$PASSWORD
37
+ if [ ! -z $USERNAME ] && [ ! -z $PASSWORD ]; then
38
+ AUTH=" -c $USERNAME :$PASSWORD "
39
+ else
40
+ AUTH=" "
41
+ fi
42
+
43
+ # LED blink
44
+ LED=" off" # on/off/blink/auto (may not work on rpi camera modules)
45
+
46
+ # plugins
47
+ PLUGIN_IN=" $MJPG_STREAMER_PLUGINS_DIR /input_uvc.so -d $DEVICE_IN -r $RESOLUTION -f $FPS -l $LED "
48
+ PLUGIN_OUT=" $MJPG_STREAMER_PLUGINS_DIR /output_http.so -p $MJPG_STREAMER_PORT -w $MJPG_STREAMER_WWW $AUTH "
49
+
50
+
51
+
52
+ # ###############
53
+ # run mjpg_streamer
54
+ $MJPG_STREAMER_BIN -i " $PLUGIN_IN " -o " $PLUGIN_OUT "
55
+ # ###############
56
+
You can’t perform that action at this time.
0 commit comments