A continuous save that quietly misses one frame in a thousand is worse than a loud failure: the gap surfaces weeks later, when someone asks for the missing image. The cause is almost never the camera and rarely the trigger. It is the disk being asked to open, write and close one file per frame with zero slack inside each frame interval. This guide gives you the arithmetic — frame size, stream rate in MB/s, frame interval in ms — then two tests that separate trigger faults from write stalls, and the ring-buffer writer that carries a 5,000-trigger run with every frame on disk. All numbers use a 1024×768 RGB24 stream at 10 and 30 frames per second, so the arithmetic rescales directly to your camera.
Why do frames go missing while saving images continuously?
A frame drops when the write path needs longer than the frame interval — 33 ms at 30 fps, 100 ms at a 10 Hz trigger — to accept the next file, because saving one file per frame leaves the camera's queue no room to wait out a slow write.
Losses come in two families, and they leave different fingerprints. Write-path losses are random single misses: the disk stalls once, the queue overruns, one frame is gone, and the next run loses different frames. Capture-path losses — a noisy trigger line, double triggers, a link error, a brownout during exposure — cluster in time or correlate with machine activity nearby.
The mechanics are simple. Each frame-ready callback opens a file, writes one 2.25 MB BMP, closes it, and inherits whatever the operating system chooses to flush at that moment. While every cycle lands inside the interval, nothing is lost. Once one cycle overruns, the driver's queue has nowhere to put the next frame and drops it — the same overrun that shows up as why camera fps alternates between two values.
Measure before you fix. The next two sections put a number on the stream, then put a test on each family.
How much data does continuous saving push to disk each second?
Multiply width by height by bytes per pixel by frames per second: the 1024×768 RGB24 stream at a 100 ms trigger is 2,359,296 × 10 = 23,592,960 B/s, or 22.5 MB/s, and the same camera free-running at 30 fps pushes 67.5 MB/s against a 33 ms interval.
Worked through: 1024 × 768 × 3 = 2,359,296 bytes per frame, or 2.25 MB (this article counts 1 MB as 1,048,576 bytes, the way camera SDKs size buffers).
| Format | Frame size | Stream at 10 Hz | Stream at 30 fps |
|---|---|---|---|
| RGB24, 1024×768 | 2.25 MB | 22.5 MB/s | 67.5 MB/s |
| RGB24, 1024×600 crop | 1.76 MB | 17.6 MB/s | 52.7 MB/s |
| Y800 mono, 1024×768 | 0.75 MB | 7.5 MB/s | 22.5 MB/s |
| Y800 mono, 1024×600 crop | 0.59 MB | 5.9 MB/s | 17.6 MB/s |
The crop removes 22% (600/768) and mono removes two thirds. Read the two rate columns as two different problems: a stream under about 25 MB/s fails through write variance, which buffering fixes; a stream near 70 MB/s also needs sustained throughput, which is a disk and format decision.
Is the trigger losing frames, or is the disk losing them?
Count triggers at the source and count frames at the camera with saving switched off: when both totals match after a 5,000-trigger run, the trigger path is clean and every missing file afterwards is a write-path loss, not a capture loss.
- Turn saving off, log every frame-ready callback with a timestamp, and run 5,000 triggers at the production interval — 100 ms makes it a 500 s test.
- Count pulses at the source and callbacks at the camera. Equal totals clear the trigger path; a mismatch or a run of double pulses points at wiring and grounding, and the camera trigger common-reference check is where to start.
- Enable the missed-trigger event your SDK exposes — several name it FrameTriggerMissed, raised when a pulse arrives while the sensor is still busy. If it never fires with saving off, the sensor kept up.
- Turn saving back on and repeat. Callbacks matching pulses while files fall short convicts the writer; files matching callbacks while both fall short of pulses convicts capture.
The test needs no special hardware: any triggered camera with a frame callback works, and a 2.5 MP GigE global-shutter model like this one holds a steady cadence all day:
- Sensor format
- 1/1.7"
- Lens mount
- C-mount
- Interface
- GigE
- Resolution
- Up to 3 MP
If step 4 clears capture and files still go missing, the disk sections below are your problem. If step 2 shows mismatched counts, fix the electrical path before touching any software.
Why does a disk that is fast on paper still drop frames?
A 7200 rpm desktop drive sustains far more than 22.5 MB/s on average, but one random write costs about 8 ms of seek plus 4 ms of rotational latency, so metadata updates, flushes and fragmented files produce stalls that exceed a 33 ms frame interval.
The two mechanical latencies set the floor. A 7200 rpm platter turns once every 8.3 ms, so the average wait for the right sector is 4.2 ms; a typical desktop seek adds about 8 ms. One random write therefore waits roughly 12 ms before its first byte moves; seek time and rotational latency are the two mechanisms, with typical desktop figures in that reference. Twelve milliseconds fits inside a 100 ms interval and already overlaps a 33 ms one, and it is the benign case.
Software sets the real cost. Per-frame BMP writes churn metadata — directory entries, allocation updates, timestamps — which the OS batches and flushes on its own schedule, occasionally for hundreds of milliseconds. An antivirus scanner checks each new file. Months of recording fragment the allocation, so the nominal 8 ms seek becomes a long stroke. Any one of these can push a single save past the interval, at random — which is the fingerprint that separates write variance from trigger noise.
That is why a 5,000-trigger run against a 500 GB, 7200 rpm desktop drive comes up short in most runs while its average throughput looks healthy. The average was never the deciding number; the worst single write is.
How big should the RAM ring buffer be?
Size the ring as worst-case stall in seconds × frame rate: 500 frames at 1024×768 RGB24 occupy 500 × 2.25 MB = 1.13 GB and cover a 16.7 s write stall at 30 fps, or 50 s at a 10 Hz trigger, far beyond any ordinary disk stall.
Pick the stall you intend to survive first. A 5 s stall is already generous for a healthy disk, and at 30 fps it needs 5 × 30 = 150 frames; triple it for margin and round to 500. The memory bill is 500 × 2,359,296 B = 1,179,648,000 B ≈ 1.13 GB, and the mono variant needs 500 × 786,432 B = 375 MB. Allocate all slots once at start-up and reuse them as a ring; per-frame allocation fragments the heap and eventually fails mid-run.
How does the writer thread keep saving from blocking the camera?
Never call the save function inside the frame-ready callback: push each frame onto a fixed ring and let one writer thread drain it to disk, so the callback only copies 2.25 MB and returns in well under a millisecond.
- Pre-allocate the ring — 500 slots of 2.25 MB here — once, at start-up.
- In the callback, copy the frame into the next slot, enqueue its index, and return. No file system calls, no allocation.
- Run one writer thread that owns the disk: dequeue, write, advance. Sequential writes to pre-named files avoid most seeks, and holding the file open across frames removes the per-frame open and close.
- Log queue depth once per second; a rising trend is your early warning, so alarm at 80% full.
- At the end of the run, drain the queue and reconcile: trigger count = callback count = file count.
The same pattern is written up for capture cards in saving an image sequence from a frame grabber with a ring buffer, and streaming camera images to disk at high frame rate covers the throughput side. When short bursts exceed the link itself, camera burst capture faster than link bandwidth applies the same buffering one level down.
When is buffering not enough?
Buffering cannot help when the sustained stream rate exceeds what the disk writes on average: 67.5 MB/s of RGB24 is beyond a 7200 rpm hard disk's comfortable average, so drop to Y800 at 22.5 MB/s, crop the ROI, or move the run to an SSD.
The fixes, ordered by cost: save mono when colour carries no information, which cuts the rate by two thirds at the same resolution; crop the ROI, 22% in the reference geometry; or record a defined window instead of the whole shift. An SSD removes the 12 ms random-write tax and sustains several hundred MB/s, which carries full RGB24 with room to spare. Before you switch formats, check the rate-related side effects, because linked attributes can move more than file size — changing pixel format halves your frame rate walks through that trap.
Short counts with saving off point upstream of the disk. Shared USB host controllers drop frames under load, and the USB3 camera low-frame-rate fixes cover the host-side half; intermittent link or power faults show up as a camera that randomly disconnects while running. For a methodical tour of the camera-side causes, this step-by-step dropped-frame diagnosis of a GigE camera shows the order in which to check.
Power deserves its own line in the log: a brownout during exposure writes a black or truncated frame that no buffer can restore. Give the camera and light chain a filtered, dedicated supply instead of sharing power with the PC:
- Type
- Power cords and supplies
A 48 V, 76.8 W enclosed supply runs a camera harness plus an LED light with headroom, and a fuse and filter in front of it keep drive and welder noise out of the frames — parts and values are in the DC line fuse and noise filter guide. The power supplies category lists the enclosed 12/24/48 V units.
Capture traffic belongs on its own interface too, not on a motherboard port sharing interrupts with the rest of the system:
- Interface
- GigE
- Ports
- 2 ports
This dual-port PoE NIC is the standard fix on a single-camera station; multi-camera lines move up to 4-port GigE cards with one camera per port, all in the frame grabbers category.
What do I check before the next production run?
Before the next run, walk this list once: computed stream rate with headroom, matched counts at all three points, a capped ring with a logged queue depth, and a clean trigger and power path — ten minutes that catch every loss mode in this guide.
Numbers
- Stream rate computed as width × height × bytes per pixel × fps, with at least 3× headroom to the disk's sustained write speed.
- Ring sized at three times the worst stall you intend to survive, allocated once at start-up (500 frames = 1.13 GB in the reference stream).
Capture path
- The 5,000-trigger count test passed five runs in a row: source pulses = camera callbacks = files on disk.
- Missed-trigger event enabled and logged on every run.
- Trigger wiring on shielded pairs with a common reference, camera traffic on a dedicated network interface.
Writer
- No save call inside the frame callback; one writer thread owns the disk and its log.
- Queue depth logged every second, alarm at 80%.
Power and disk
- Camera and lights on a filtered, dedicated supply.
- Target disk kept under 80% full, defragmented if spinning, SMART clean.
Run the checklist once and the loss mode names itself: mismatched counts mean capture, random shortfalls mean writes, a rising queue means sustained throughput. If a buffered writer still loses frames on your hardware, send the three counts and the queue log through the contact page and we will help you read them. To pick the acquisition side first, the camera finder filters area scan cameras by interface, resolution and frame rate, and the system configurator assembles camera, lens and light into one build. More storage and streaming write-ups sit on the systems topic page.
Questions
How much RAM would I need to buffer a full hour of continuous saving?
An hour at 22.5 MB/s is 3,600 × 22.5 MB = 81,000 MB, about 79 GB, and that is the wrong design. The ring only covers stalls; the writer's sustained throughput carries the average. Size the ring for the worst delay you intend to survive — 500 frames covers 50 s at a 10 Hz trigger — and let the disk keep up with the 22.5 MB/s average.
Should I save BMP or JPEG to keep up with the camera?
Save BMP or raw. JPEG spends CPU on every frame, puts compression artifacts into every measurement, and does not fix a drop problem — it only changes what gets dropped. Compress offline after the run if the files are too large to keep, and the original pixels stay available for reprocessing.
Can I write the images straight to a network share instead of the local disk?
Not during the run. A share adds latency with millisecond-to-second jitter, and one disconnect can end the recording. Write to the local ring and local disk, then copy to the server as a background job with retry after the run closes. Never put the network in the frame path.
My saved-image count is still short even with an SSD — what else loses frames?
Count at three points: trigger pulses at the source, frame-ready callbacks at the camera, files on disk. Whichever pair disagrees names the culprit. An SSD still stalls on cache flushes or when nearly full, so keep it under 80% and watch the queue-depth log. A firing missed-trigger event moves the hunt to link and power instead.
Does exposure time limit how fast I can save images continuously?
Yes. A camera cannot deliver a frame faster than exposure plus readout, so a 100 ms exposure caps the stream near 10 fps no matter how fast the disk writes. Keep exposure well inside the trigger interval, and read a firing missed-trigger event as an exposure or trigger-timing problem before you blame storage.


