Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ExecStartPre=/bin/chown -R webcam:webcam /run/webcam
ExecStartPre=/bin/chmod -R 0755 /run/webcam

ExecStart=/usr/bin/sudo -u webcam \
/opt/ffmpeg-hls/ffmpeg \
/usr/bin/ffmpeg \
\
-framerate 30 -video_size 640x480 \
-i /dev/video0 \
Expand All @@ -28,7 +28,7 @@ ExecStart=/usr/bin/sudo -u webcam \
-f image2 -r 1 -update 1 -atomic_writing 1 \
/run/webcam/jpeg/frame.jpg \
\
-c:v h264_v4l2m2m -level:v 4.0 \
-c:v h264_omx -profile:v high \
-b:v 1264k -flags +cgop \
-g 30 -keyint_min 30 \
\
Expand All @@ -40,7 +40,7 @@ ExecStart=/usr/bin/sudo -u webcam \
\
-vf scale=-1:240 \
\
-c:v h264_v4l2m2m -level:v 4.0 \
-c:v h264_omx -profile:v high \
-b:v 240k -flags +cgop \
-g 30 -keyint_min 30 \
\
Expand Down
41 changes: 9 additions & 32 deletions src/modules/octopi/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ export LC_ALL=C

source /common.sh

if [ -n "$OCTOPI_APTMIRROR" ];
if [ -n "$OCTOPI_APTMIRROR" ];
then
echo "Switching apt mirror in /etc/apt/sources.list to $OCTOPI_APTMIRROR"
cp /etc/apt/sources.list /etc/apt/sources.list.backup
sed -i "s@http://raspbian.raspberrypi.org/raspbian/@$OCTOPI_APTMIRROR@g" /etc/apt/sources.list
fi

WEBCAM_USER=webcam
FFMPEG_HLS_COMMIT=c6fdbe26ef30fff817581e5ed6e078d96111248a
FFMPEG_HLS_DIR=/opt/ffmpeg-hls

### Script ####

Expand Down Expand Up @@ -68,7 +66,7 @@ pushd /home/"${BASE_USER}"
apt-get -y --force-yes install libjpeg8-dev
fi
fi

apt-get -y --force-yes --no-install-recommends install imagemagick ffmpeg libv4l-dev

wget $OCTOPI_MJPGSTREAMER_ARCHIVE -O mjpg-streamer.zip
Expand Down Expand Up @@ -122,32 +120,11 @@ EOT
# FFMPEG HLS
if [ "$OCTOPI_INCLUDE_FFMPEG_HLS" == "yes" ]
then
apt-get install -y --force-yes --no-install-recommends nginx

FFMPEG_BUILD_DIR=$(mktemp -d)
pushd ${FFMPEG_BUILD_DIR}
FFMPEG_ARCHIVE=ffmpeg.tar.gz
wget https://api.github.com/repos/FFmpeg/FFmpeg/tarball/${FFMPEG_COMMIT} -O ${FFMPEG_ARCHIVE}
tar xvzf ${FFMPEG_ARCHIVE}
cd FFmpeg*
./configure \
--disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
--disable-ffplay \
--disable-ffprobe
make -j$(nproc)
mkdir -p ${FFMPEG_HLS_DIR}
cp ffmpeg ${FFMPEG_HLS_DIR}
popd
rm -r ${FFMPEG_BUILD_DIR}

apt-get install -y --force-yes --no-install-recommends ffmpeg nginx
useradd ${WEBCAM_USER}
usermod -aG video ${WEBCAM_USER}
fi

#CuraEngine
if [ "$OCTOPI_INCLUDE_CURAENGINE" == "yes" ]
then
Expand All @@ -174,7 +151,7 @@ EOT

# fetch current yq build and install to /usr/local/bin
wget -O yq $OCTOPI_YQ_DOWNLOAD && chmod +x yq && mv yq /usr/local/bin

popd

#Make sure user pi / ${BASE_USER} has access to serial ports
Expand Down Expand Up @@ -220,13 +197,13 @@ do
done

for ip in $(hostname -I);
do
do
echo " http://$ip"
done

echo
echo "https is also available, with a self-signed certificate."
echo
echo
echo "------------------------------------------------------------"
echo
EOT
Expand Down Expand Up @@ -299,7 +276,7 @@ systemctl_if_exists enable streamer_select.service
if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ]
then
systemctl_if_exists enable webcamd.service
### use legacy camera stack on bullseye for now
### use legacy camera stack on bullseye for now
if grep "camera_auto_detect=1" /boot/config.txt
then
sed -i "s/camera_auto_detect=1/camera_auto_detect=0/g" /boot/config.txt
Expand Down Expand Up @@ -327,7 +304,7 @@ apt-get -y install avrdude
apt-get clean
apt-get autoremove -y

if [ -n "$OCTOPI_APTMIRROR" ];
if [ -n "$OCTOPI_APTMIRROR" ];
then
echo "Reverting /etc/apt/sources.list"
mv /etc/apt/sources.list.backup /etc/apt/sources.list
Expand Down