Updated license and TODO, massive MJPG improvements

MJPG now has a massively improved command. Instead of transcoding the
video for no reason, instead we ask the camera driver for MJPG data so
that we don't have to transcode raw video if we don't have to.

MJPG's resolution and FPS can now also theoretically be changed from a
config file. The frontend components for this however are not
implemented.

Updated notice in first time setup since we're not in alpha anymore.
This commit is contained in:
Logan G 2020-08-24 03:04:27 -06:00
parent 4d68cace69
commit 9132a8b7f7
Signed by: logan
GPG key ID: E328528C921E7A7A
6 changed files with 27 additions and 6 deletions

View file

@ -1,5 +1,5 @@
Copyright (c) 2015 Raspberry Pi (Trading) Ltd. Copyright (c) 2015 Raspberry Pi (Trading) Ltd.
Copyright (c) 2020 Logan Gartner
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View file

@ -5,6 +5,13 @@
- Add hostname configuration (replace nmtui) - Add hostname configuration (replace nmtui)
- Better service configuration (deeper menu) - Better service configuration (deeper menu)
- System check - System check
- Touch screen calibration
## Frontend
- Separate frontend from pi account
## Nginx
- Add HTTP basic auth (especially to MJPG)
## Misc ## Misc
- More security - More security

View file

@ -2,9 +2,11 @@
install -m 644 files/mjpg-streamer.service ${ROOTFS_DIR}/etc/systemd/system/mjpg-streamer.service 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 install -m 755 files/start-mjpg ${ROOTFS_DIR}/usr/local/bin/start-mjpg
mkdir -p ${ROOTFS_DIR}/usr/local/etc/mjpg-server/
install -m 755 files/config.sh ${ROOTFS_DIR}/usr/local/etc/mjpg-server/
if [[ ! -f ${ROOTFS_DIR}/usr/local/bin/mjpeg-server ]]; then 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 # Do some semi janky cross compilation since Golang won't let me set GOBIN when cross compiling (gogl plz fix)
GOPATH=/tmp/go GOARCH=arm64 go get github.com/blueimp/mjpeg-server 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 cp /tmp/go/bin/linux_arm64/mjpeg-server ${ROOTFS_DIR}/usr/local/bin/mjpeg-server
rm -rf /tmp/go rm -rf /tmp/go

View file

@ -0,0 +1,3 @@
VIDEO_DEVICE="/dev/video0"
VIDEO_SIZE="1280x720"
FRAMERATE=15

View file

@ -1,6 +1,15 @@
#!/bin/bash #!/bin/bash
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 - # Include environment variables
source /usr/local/etc/mjpg-server/config.sh
# Test if camera can just give us MJPG frames so that we can save a bunch of CPU
if ffmpeg -input_format mjpeg -video_size $VIDEO_SIZE -framerate $FRAMERATE -nostats -v quiet -i $VIDEO_DEVICE vframes 1 -f null - >/dev/null; then
/usr/local/bin/mjpeg-server -a 127.0.0.1:9000 -- ffmpeg -input_format mjpeg -video_size $VIDEO_SIZE -framerate $FRAMERATE -i $VIDEO_DEVICE -f mjpeg -c:v copy -
# Oh, it can't :( Guess I'll just blast the CPU to maybe get 5FPS
elif ffmpeg -video_size $VIDEO_SIZE -framerate $FRAMERATE -nostats -v quiet -i $VIDEO_DEVICE -vframes 1 -f null - >/dev/null; then
/usr/local/bin/mjpeg-server -a 127.0.0.1:9000 -- ffmpeg -video_size $VIDEO_SIZE -framerate $FRAMERATE -i /dev/video0 -f mjpeg -
else else
/usr/local/bin/mjpeg-server -a 127.0.0.1:9000 -- ffmpeg -i /dev/video0 -f mpjpeg - echo "FFmpeg could not start. Double check your configuration."
exit 1
fi fi

View file

@ -64,7 +64,7 @@ suggested_menu () {
done done
} }
dialog --title "NOTICE" --nocancel --colors --msgbox "This collection of software is currently in alpha. It is lacking several critical features. \Zb\Z1DO NOT\Zn use this in a production environment. This image has been provided for testing purposes only." 10 50 dialog --title "NOTICE" --nocancel --colors --msgbox "This collection of software is currently in beta. It is lacking several critical features. \Zb\Z1DO NOT\Zn use this in a production environment." 10 50
# Force the user to change the pi user's password before the RPi gets botnetted # Force the user to change the pi user's password before the RPi gets botnetted
change_password change_password