apt update
apt install libcamera-apps
apt install nginx libnginx-mod-rtmp
/etc/nginx/nginx.conf:rtmp {
server {
listen 1935;
application restream {
# Enable livestreaming
live on;
# Disable recording
record off;
# Allow only this machine to play back the stream
allow play 127.0.0.1;
#deny play all;
allow play all;
# Push your stream to one or more RTMP destinations
#push rtmp://a.rtmp.youtube.com/live2/XXXX-XXXX-XXXX-XXXX-XXXX;
#push rtmp://a.rtmp.youtube.com/live2/XXXX-XXXX-XXXX-XXXX-XXXX;
#push rtmp://live-cdg.twitch.tv/app/live_XXXXXXXX;
}
}
}
Then
nginx -s reload
#!/bin/bash
#STRM="rtmp://a.rtmp.youtube.com/live2/u0sk-66c1-um4j-dd9b-d88u"
#STRM="rtmp://stream.squash.kiwi/live/squash(^O^)1"
#STRM="rtmp://10.10.8.82"
STRM="rtmp://localhost/restream"
echo "Outputting to $STRM"
XDG_RUNTIME_DIR=/run/user/$(id -u) libcamera-vid -t 0 -g 10 --bitrate 4500000 --inline --width 1920 --height 1080 --framerate 30 --rotation 180 --codec libav --libav-format flv --libav-audio --audio-bitrate 16000 --av-sync 200000 -n -o "${STRM}"
@reboot j /usr/local/bin/stream.sh >> /home/j/stream.log 2>&1