Compare commits

..

2 commits

Author SHA1 Message Date
4d68cace69
Minor improvements 2020-08-21 19:09:58 -06:00
d9c15f9502
Added Golang MJPG Streamer, updated TODO
Added Golang based MJPG streamer https://github.com/blueimp/mjpeg-server
Still need to figure out HW acceleration

Changed default timezone to UTC
2020-08-20 02:56:51 -06:00
8 changed files with 21 additions and 29 deletions

View file

@ -6,8 +6,8 @@ RUN apt-get -y update && \
apt-get -y install --no-install-recommends \
git vim parted \
quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \
bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\
binfmt-support ca-certificates \
bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc \
binfmt-support ca-certificates golang \
&& rm -rf /var/lib/apt/lists/*
COPY . /pi-gen/

View file

@ -45,14 +45,15 @@ TODO
### OctoPrint Setup
- If the GUI is enabled, you can setup OctoPrint on the Raspberry Pi. You can also setup OctoPrint by opening up a web browser on another computer and navigating to `https://RPI-IP`, replacing RPI-IP with the IP address of your Raspberry Pi.
- If MJPG-Streamer is enabled, you can put `/webcam/?action=stream` into the Stream URL box to enable it in OctoPrint.
- If MJPG-Streamer is enabled, you can put `/webcam` into the Stream URL box to enable it in OctoPrint.
### Accessing OctoPrint
- If OctoPrint is enabled, you can access it at `https://RPI-IP`, replacing RPI-IP with the IP address of your Raspberry Pi.
### Reporting Bugs
Please report any bugs by [filing an issue](/issues). Please include as much detail as you can, including:
Please report any bugs by [filing an issue](/issues). Please include as much detail as you can, including (but not limited to):
- Raspberry Pi Model
- Version of TouchPrint
- What you were doing when the bug occured
- Steps to reproduce
- Logs

View file

@ -3,13 +3,14 @@
## First time/Octo-Config
- Add network configuration (replace nmtui)
- Add hostname configuration (replace nmtui)
- Better service configuration (deeper menu)
- System check
## Misc
- More security
- Wiki
## Things to consider
- Wayland using labwc/waybox
- Python 3
- Detect if frontend did not load correctly (probably not easy)
- HTTP/Port 80 redirect
- https://github.com/blueimp/mjpeg-server

View file

@ -177,7 +177,7 @@ export LOCALE_DEFAULT="${LOCALE_DEFAULT:-en_US.UTF-8}"
export KEYBOARD_KEYMAP="${KEYBOARD_KEYMAP:-us}"
export KEYBOARD_LAYOUT="${KEYBOARD_LAYOUT:-English (US)}"
export TIMEZONE_DEFAULT="${TIMEZONE_DEFAULT:-America/New_York}"
export TIMEZONE_DEFAULT="${TIMEZONE_DEFAULT:-UTC}"
export GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"}

View file

@ -20,7 +20,7 @@
}
upstream "mjpg-streamer" {
server 127.0.0.1:8080;
server 127.0.0.1:9000;
}
server {

View file

@ -3,23 +3,9 @@
install -m 644 files/mjpg-streamer.service ${ROOTFS_DIR}/etc/systemd/system/mjpg-streamer.service
install -m 755 files/start-mjpg ${ROOTFS_DIR}/usr/local/bin/start-mjpg
on_chroot << EOF
# If mjpg is already installed, skip this (for debugging)
if ! which mjpg_streamer; then
cd /tmp
# Making sure that this directory doesn't exist
rm -rf /tmp/mjpg-streamer
git clone https://github.com/jacksonliam/mjpg-streamer/
cd mjpg-streamer/mjpg-streamer-experimental/
make
make install
cd /
# Cleanup
rm -rf /tmp/mjpg-streamer
# Create needed folder
mkdir -p /var/www/mjpg
# Permissions
chown octoprint:octoprint /var/www/mjpg
if [[ ! -f ${ROOTFS_DIR}/usr/local/bin/mjpeg-server ]]; then
# Do some semi janky cross compilation since Golang won't let me set GOBIN when cross compiling
GOPATH=/tmp/go GOARCH=arm64 go get github.com/blueimp/mjpeg-server
cp /tmp/go/bin/linux_arm64/mjpeg-server ${ROOTFS_DIR}/usr/local/bin/mjpeg-server
rm -rf /tmp/go
fi
EOF

View file

@ -1,2 +1,6 @@
#!/bin/bash
/usr/local/bin/mjpg_streamer -i input_uvc.so -o "output_http.so --port 8080 -w /var/www/mjpg"
if [[ "$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=nokey=1:noprint_wrappers=1 /dev/video0)" == "h264" ]]; then
/usr/local/bin/mjpeg-server -a 127.0.0.1:9000 -- ffmpeg -input_format h264 -i /dev/video0 -c:v h264_v4l2m2m -f mpjpeg -
else
/usr/local/bin/mjpeg-server -a 127.0.0.1:9000 -- ffmpeg -i /dev/video0 -f mpjpeg -
fi

View file

@ -137,5 +137,5 @@ video_config () {
[[ "$DEVICE_MENU" == "" ]] && return 0
# Write selected value to startup script
echo -e '#!/bin/bash'"\n/usr/local/bin/mjpg_streamer -i \"input_uvc.so -d $DEVICE_MENU\" -o \"output_http.so --port 8080\"" > /usr/local/bin/start-mjpg
echo -e '#!/bin/bash'"\n/usr/local/bin/mjpeg-server -a 127.0.0.1:9000 -- ffmpeg -i $DEVICE_MENU -f v4l2 -f mpjpeg -" > /usr/local/bin/start-mjpg
}