(See also same answer from user ivanivan - realised that his answer existed after I posted this:)
What about motion?
From the output of apt show motion
https://motion-project.github.io/
Download-Size: 238 kB
Description: V4L capture program supporting motion detection
Motion is a program that monitors the video signal from
one or more cameras and is able to detect if a significant
part of the picture has changed. Or in other words, it can
detect motion.
.
Motion is a command line based tool. It has no graphical
user interface. Everything is setup either via the
command line or via configuration files.
.
The output from motion can be:
- jpg/ppm image files
- mpeg/mp4/swf/flv/mov/ogg video sequences
.
Also, motion has its own minimalistic web server. Thus,
you can access the webcam output from motion via a browser.