Skip to content

fix: only write analysis jpegs for alarm frames#4997

Open
SteveGilvarry wants to merge 1 commit into
ZoneMinder:masterfrom
SteveGilvarry:4996-analysis-jpegs-every-frame
Open

fix: only write analysis jpegs for alarm frames#4997
SteveGilvarry wants to merge 1 commit into
ZoneMinder:masterfrom
SteveGilvarry:4996-analysis-jpegs-every-frame

Conversation

@SteveGilvarry

@SteveGilvarry SteveGilvarry commented Jul 22, 2026

Copy link
Copy Markdown
Member

Fixes #4996

Problem

Since the 1.38 analysis pipeline rewrite, packet->analysis_image is created for every frame that goes through motion detection (so the live Analysis view shows full colour instead of greyscale). Event::AddFrame wrote an analysis jpeg whenever the packet had one — which is now always — so SaveJPEGs = Analysis images only (if available) saved every analysed frame of the event instead of only alarmed frames as in 1.36. On a 10fps Always Recording + Always Analysing monitor that is ~6,000 jpegs (~4GB) per 10-minute event vs ~400MB on 1.36.

Fix

Gate the analysis-jpeg write on frame_type == ALARM, restoring 1.36 semantics: analysis jpegs are only written for alarm frames (including scored pre/post-alarm buffer frames). The live analysis view is unaffected.

🤖 Generated with Claude Code

Since the 1.38 analysis pipeline, every analysed packet carries an
analysis_image so the live analysis view can show full colour. Event
AddFrame wrote an analysis jpeg whenever the packet had one, so
SaveJPEGs 'Analysis images only' saved every frame of the event
instead of only alarmed frames as in 1.36. Gate the write on
frame_type == ALARM to restore the old behaviour.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@connortechnology

Copy link
Copy Markdown
Member

I think the if (packet->analysis_image) used to do the gating. But now we always assign analysis_image. Instead we should only populate analysis-image if we have motion detection score (See line 2364 of zm_monitor.cpp).

Thing is, AI comes later and may also create it, but with a zero motion score, so frame type != ALARM.

So I don't think this is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save JPEGs 'Analysis images only' writes every analysed frame since 1.38 instead of only alarmed frames

2 participants