Replies: 3 comments
-
Thanks for sharing. I am interested, in fact I had posted earlier this week: #3536 |
Beta Was this translation helpful? Give feedback.
-
I am interested in your more complete script. I'd then like to add self hosted openai API compatible text annotation of the snap to it. Thanks |
Beta Was this translation helpful? Give feedback.
-
@saket424 @filamonkey my script an few explaination. My mediamtx.yml configuration contain:
And RTSP camera exemple: parking_hd: The file in my /motion/24/mp4/ directory look like: -rw-r--r-- 1 root wheel 214M Aug 18 17:51 20240818-175105-738338-parking_hd.mp4 The little script from my FreeBSD system (also attached as .TXT)
|
Beta Was this translation helpful? Give feedback.
-
For several years, I have been using external equipment to trigger
actions (PIR detectors, contact sensors, etc.).
I have tested various methods to obtain a snapshot from video cameras
(Reolink and other brands) at a specific moment. Sometimes this was
done with a simple wget on the camera's URL, sometimes by setting
up an RTSP stream and capturing an image with ffmpeg, or by running
ffmpeg continuously to take snapshots every second, etc.
Overall, I was not satisfied with these solutions, as establishing
an RTSP connection takes time. For example, with a PIR motion
detection, the snapshot would sometimes be taken after the person
had already passed, or significant resources were consumed, such
as running ffmpeg 100% of the time to take snapshots.
I eventually found a solution that requires few resources and is
very responsive for obtaining one or more snapshots during an event.
I'm sharing it in case it might be useful to others.
1/ I use mediamtx to record the video stream from the cameras.
2/ During an event (PIR detection, opening a gate or door, etc.),
I trigger a script with ffmpeg to take a snapshot from the last few
seconds of recording.
The basic idea example:
ffmpeg -hide_banner -loglevel quiet -y -sseof -1 /mediamtx/camera/parking_hd.mp4 -frames:v 1 -y -strftime 1 /mediamtx/jpg/parking_snap.jpg
I have a more complete script if anyone is interested, but I believe
this is the right method as it requires fewer resources compared
to other solutions I have tested and which are frequently mentioned
in this forum.
Beta Was this translation helpful? Give feedback.
All reactions