server listen 80; location /cam1 proxy_pass http://localhost:8081; proxy_buffering off; location /episodes alias /home/pi/cam_episodes; autoindex on;
: Check /home/pi/cam_episodes – you’ll find .mkv files created every 10 minutes, each an “episodio.”
sudo apt update sudo apt install motion -y Edit the config file:
sudo systemctl enable motion sudo systemctl start motion Open a browser and go to: http://your-server-ip:8081 You’ll see the live MJPEG stream. For a static snapshot (Netsnap style): http://your-server-ip:8081/1/snapshot.jpg
Then a timer: /etc/systemd/system/cam-episodes.timer
#!/bin/bash # List of public camera snapshot URLs CAMERAS=( "https://webcam.lacity.org/live.jpg" "https://images.webcams.travel/snapshots/..." ) EPISODE_DIR="./episodi_$(date +%Y%m%d_%H%M)" mkdir -p $EPISODE_DIR
Run it:
[Unit] Description=Capture episode from cam feed After=network.target [Service] Type=simple ExecStart=/usr/bin/ffmpeg -i http://localhost:8081 -t 600 -f segment -segment_time 600 -reset_timestamps 1 /var/cams/episode_%Y%m%d_%H%M%S.mkv User=motion