Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8015

Other programming languages • Re: Two RTSP Web Cams - One bash script or two?

$
0
0
Hi

As of the script to grab the images every 2 minutes, I really think you have the choice. I would go for a single script written with process functions (one for each cam) and using sleep, maybe something like

Code:

process-cam1 (){  your code here}process-cam2 (){  your code here}while true; do  process-cam1    sleep 60  process-cam2    sleep 60done
Obviously there are many ways to write something like this (like passing parameters to a single function for example)
Anyway, this method would make sure your script has plenty of time to process the image grab and the entire process and most likely even to manage errors or timeouts without never never to overlap.

I would make such a script run as a service.
Alternatively it's also possible to use a command like "watch" to run the script every minute for example.

Af of the timelapse videos creations, I would have another script to do this probably scheduled by cron or triggered from the other script whenever you want.

However I'm curious to know if you're using RTSP push or pull and obviously if you open a connection to the camera feed each time you want an image grab (that's what I understood you do)

Haven't you considered to simply "livestream" both camera feeds to your website ? (which does not prevent you from creating a daily timelapse and upload it anyway).

Last question : why bookworm over trixie ?

Statistics: Posted by dwam — Tue Nov 04, 2025 6:31 am



Viewing all articles
Browse latest Browse all 8015

Trending Articles