Skip to content

Instantly share code, notes, and snippets.

@mngyuan
Last active January 14, 2024 03:07
Show Gist options
  • Save mngyuan/32073c49ff6d4b7ce16a0b1052f944b4 to your computer and use it in GitHub Desktop.
Save mngyuan/32073c49ff6d4b7ce16a0b1052f944b4 to your computer and use it in GitHub Desktop.
Raspberry Pi Zero 2 W Server configuration

Stream video from RPi Camera v3 NoIR with RTSP

libcamera-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264

# WiFi connectivity test (and reconnect if needed)
# Source: https://feriman.com/automatically-reconnect-to-wifi-on-raspberry-pi/
#
# Check the connectivity
if ! ping -c2 8.8.8.8 > /dev/null; then
# Shut down the wlan0 adapter if the network is not reachable
ifconfig wlan0 down
# Sleep 2 seconds to be sure
sleep 2
# Start the wlan0 adapter again
# It will reconnect to the WiFi automatically
ifconfig wlan0 up
# Sleep 10 seconds to be sure
sleep 10
# Put here all services with network dependencies
systemctl restart smbd ssh rpimonitor rtorrent apache2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment