Most businesses already own hours of footage and thousands of photos: the camera over the gate, the pump, the till or the loading dock, and the pictures field staff take of sites and assets. Little of it is ever used, because using it means someone has to sit and watch. Video and image analytics turns each of those files into data. Once a file has been analysed, you can ask who came, what happened, how many and when, and have the answer in seconds.
This article starts with what businesses use it for. It then explains how a video is read, what is stored and where, and ends with the API, the SQL and the limits you should know about.
What businesses use it for
- Fuel stations and parking. Count vehicles by type and by hour, find the busiest stretch of the day, and find a vehicle by its colour, its make or its number plate: "Was a black BMW with a plate starting EMC 25 at pump 1 between 10 and 11 on Thursday?"
- Retail stores. See footfall by hour and the moments at the till, and find a customer from a description instead of scrubbing through hours of video: "When was the shopper in the pink top at the counter?"
- Traffic, campuses and townships. Count two-wheelers, cars, autos, buses and lorries per camera and per hour, and see the peak at each gate.
- Security and facilities. Review what happened after hours, see which vehicles came to the gate and when, and go straight to the second something happened.
- Warehouses and logistics. See which trucks were at a dock, when they arrived and left, what their plates were and when loading started.
- Field photos, inspections and claims. Find site, asset and damage photos by what is in them, including any labels, meter readings or plates that can be read.
Each of those questions can be typed into the Analyze room of InventDB SOAR exactly as it is written here. The assistant turns it into SQL over the findings, runs the query with your access rights and shows it beside the answer, as described in How the InventDB SOAR AI answers with SQL you can check.
What the analysis records
For each file, the analysis writes one row for every thing it found. Every row carries the file's id, the record the file is attached to and the name of the AI model that produced it.
| Row type | What it holds |
|---|---|
summary | One per file: a title and a few sentences describing it, how many unique people, vehicles, animals and objects it contains, the highest number of each kind seen at the same moment, and how much of a video was analysed. |
entity | One per unique person, vehicle, animal or object in the whole file, with the time it was first and last seen. A person has clothing and colours, an age group, what they carry and what they do. A vehicle has its type, make, model, colour, markings and the number plate when it is legible. |
sighting | A person, vehicle, animal or object in one 20-second stretch of a video, with where it was in the frame. |
event | An arrival, a departure, a payment, a delivery or anything unusual, with its start and end time and the people and vehicles involved. |
text | Text that can be read: signs, screens, labels, documents, number plates and the camera's own on-screen clock. |
segment | One per 20-second stretch of a video: what the scene shows and how many of each kind are visible. |
A number plate is also stored with only its letters and digits, in plate_norm, so a search for EMC25 matches a plate written as EMC 25 or EMC-25.
How a video is read
A file uploaded with analysis turned on is first stored and processed like any other file: its bytes are saved, and any text it carries is read and indexed, as described in Files on every record, read by OCR and searchable by meaning. The analysis then runs in a background worker of its own, so a long video never holds up the processing of other files. The file shows Pending, then Processing, then Ready, together with the model that was used and the number of tokens it took. A failed attempt is tried again, up to three times.
For a video, the worker uses ffprobe to read the length and the recording time, and ffmpeg to take one frame for every second of video, scaled so that its longer side is 1,024 pixels. The frames go to the model in groups of 20, so each request covers 20 seconds, and each frame is labelled with its time so that everything the model reports has a time attached. A photo is sent as a single image, scaled to 1,568 pixels on its longer side.
Each request also lists the people and vehicles the video has shown so far, with their ids. The model keeps the id when it sees the same person or vehicle again, and writes one short line when someone is still in view and unchanged, so a car parked for ten minutes is counted as one vehicle and not as thirty. After the last group of frames, one more request reads the whole timeline and writes the file's title and summary.
The model is the one set for the instance in Settings, which is the same model the rest of InventDB SOAR uses, and every file gets the same instructions. They ask for everything that is visible rather than for any particular use, which is why one analysis can answer a question about vehicles at a pump and another about a shopper's clothes. They also tell the model to write only what it can see, to give a plate, a make or a brand only when it is legible or unmistakable, and to leave colours as unknown in black-and-white or infrared footage.
The summary and a readable timeline also become the file's searchable text and are embedded like any other document. A full-text or meaning search for "red scooter" or "delivery at night" therefore finds the video itself, not only its rows.
The ffmpeg and ffprobe tools ship with InventDB SOAR, so there is nothing to install. They read MP4, MOV, 3GP, MKV, WebM, AVI, MPEG transport and program streams, Ogg, FLV and WMV files containing H.264, H.265, VP8, VP9, AV1, MPEG-2, MPEG-4, Motion JPEG, Theora or WMV9 video. Photos can be JPEG, PNG, GIF, WebP, TIFF or BMP.
Clock times and cameras
Seconds from the start of a file are useful, but questions are usually about the clock. When you upload footage, you can give the camera name and the time the recording started as the file's custom properties camera and recorded_at. If no start time is given, the worker uses the creation time stored in the video itself, when the file has one.
Every finding with a time then also gets ts_start and ts_end in the camera's local time, together with day, weekday and hour, so "between 10 and 11 on Thursday" becomes a simple filter. The camera, site and location properties are copied onto every row, so counts can be grouped by camera without a join.
Stored with the file
The findings are kept in a system table beside the file's own: {namespace}._attachment_analysis, next to {namespace}._attachments. The file store owns those rows, so they follow the file. Deleting a file deletes its findings and its analysis job. Deleting a record, by any route, deletes the record's files together with their findings. Dropping a type deletes all of its files, including those in the type's shared vault, and moving a file to another record moves its findings with it. A file that another record also links to moves to that record instead of being deleted.
The engine reports each removal of records to the file store as soon as the removal is durable, whether it was a single delete, a batch delete, the deletes in a committed transaction, or a dropped type or namespace. A transaction that is rolled back removes nothing. Nothing derived from a video can outlive the video, which makes a retention policy simple to honour.
Asking questions with SQL
Because the findings are rows, everything that reads rows can read them: SQL, reports, dashboards, workflows and the AI assistant, which lists the table and its columns in the schema it works from. Here is how to count vehicles per camera, hour and type on one day:
SELECT camera, hour, label, COUNT(*) AS vehicles
FROM cctv._attachment_analysis
WHERE row_type = 'entity' AND kind = 'vehicle' AND day = '2026-10-22'
GROUP BY camera, hour, label
ORDER BY camera, vehicles DESC
On the public test clips we use, this returns rows such as five auto-rickshaws, four buses and two cars on the junction camera between 10 and 11. The question about the black BMW is a filter on colour, make, the normalised plate and the clock:
SELECT camera, file_name, color, make, plate, ts_start, ts_end
FROM cctv._attachment_analysis
WHERE row_type = 'entity' AND kind = 'vehicle'
AND color = 'black' AND make = 'BMW' AND plate_norm LIKE 'EMC25%'
AND ts_start >= '2026-10-22T10:00:00' AND ts_start < '2026-10-22T11:00:00'
An empty result is an answer too: no such vehicle was seen in that hour. To bring in the file and the record it is attached to, join on the ids every row carries:
SELECT r.name, a.filename, m.description
FROM cctv._attachment_analysis m
JOIN cctv._attachments a ON m.attachment_id = a._id
JOIN cctv.cameras r ON a.record_id = r._id
WHERE m.row_type = 'summary'
The API
To analyse a file as you upload it, add analyze=true to the multipart upload, and give the camera and the recording start in custom_properties. The response is 201, with analysis_state set to Pending.
curl -X POST https://<your-instance>/attach/cctv/cameras/<record-id> \
-H "Authorization: Bearer $TOKEN" \
-F "file=@gate-2026-10-22-1000.mp4" \
-F "analyze=true" \
-F 'custom_properties={"camera":"gate-1","recorded_at":"2026-10-22T10:00:00+05:30"}'
A file that is already stored is analysed, or analysed again, with POST /attach/{namespace}/{type}/{record id}/{attachment id}/analyze, which answers 202 with the state Pending. A new analysis replaces the previous findings. The request is refused with 400 for a file that is neither an image nor a video, and with 403 on InventDB Serverless or for a caller without write access to the file. GET on .../analysis returns the job, the summary row and a count of the rows by type. This is a shortened response for a screenshot we analysed while writing this article:
{
"ok": true,
"job": {
"state": "Ready", "attempts": 1, "model": "claude-sonnet-5",
"rows": 63, "entities": 20,
"input_tokens": 2994, "output_tokens": 4326, "elapsed_s": 37.8
},
"rows": { "summary": 1, "entity": 20, "text": 40, "event": 2 },
"summary": {
"camera": "office-screen", "unique_objects": 20,
"ts_start": "2026-10-30T10:00:00", "weekday": "Friday", "hour": 10
},
"type": "_attachment_analysis"
}
The worker runs with these defaults:
| Setting | Default | What it controls |
|---|---|---|
INVENTDB_MEDIA_FPS | 1 | Frames taken for each second of video, between 0.1 and 4. |
INVENTDB_MEDIA_SEGMENT_FRAMES | 20 | Frames sent to the model in one request, between 2 and 40. |
INVENTDB_MEDIA_FRAME_EDGE | 1,024 | The longer side of each video frame, in pixels. |
INVENTDB_MEDIA_IMAGE_EDGE | 1,568 | The longer side of a photo, in pixels. |
INVENTDB_MEDIA_MAX_SECONDS | 1,800 | How much of one video is analysed, in seconds. |
Both requests are documented with their parameters and responses on the API page.
Speed, cost and limits
- Analysing a video takes about three to five times its length, because every 20 seconds of video is one request to the model. A photo usually takes well under a minute.
- The work uses the instance's AI credits, and a video uses far more than a photo, mostly for the text the model writes about each group of frames. It suits uploaded clips, incidents and sampled footage. Analysing every camera around the clock is not what it is built for today.
- Number plates are read when they are legible in the frame, but this is not certified number-plate recognition. In our tests, one plate was read correctly in one run and with one digit wrong in another.
- In a busy scene, a person who leaves and comes back much later can be counted twice.
- Black-and-white and infrared footage has no colour, so colours from that footage are not reliable.
- The analysis describes what people look like and what they do. It does not recognise faces or identify who someone is.
- Videos are sampled once a second, so an event shorter than a second can be missed, and up to 30 minutes of each file is analysed.
- Analysis is available on InventDB SOAR instances, not on InventDB Serverless, and the instance needs an AI model configured.
Using it
In the Files room of InventDB SOAR, tick "Analyze images and videos with AI" when you add files, and give the camera name and the time the recording started if you know them. A file that is already stored can be analysed from its Info tab, and analysed again later. When its state reads Ready, ask about it in the Analyze room, search for what is in it, or build a report on its findings.