Skip to main content

Image Data Handling

All images in HTTP Post data are JPEG files encoded as base64 strings embedded in XML.

Base64 Encoding

Both IPC and NVR posts embed images as base64-encoded JPEG data within <sourceBase64Data> and <targetBase64Data> XML elements. The base64 string can be decoded directly to a valid JPEG file.

sourceBase64Data vs targetBase64Data

FieldContentTypical SizeLocation (NVR)Location (IPC)
sourceBase64DataFull frame overview~400-530 KBsourceDataInfo/sourceBase64DatasourceDataInfo/sourceBase64Data
targetBase64DataCropped target~14-100 KBtargetListInfo/item/targetImageData/targetBase64DatalistInfo/item/targetImageData/targetBase64Data

Image Resolution by Detection Type

Image TypeDetection TypeTypical Resolution
Source (overview)Most types1280x720 or 1920x1080
Source (overview)videoMetadata1280x784 (may vary)
Source (overview)vehicle0x0 metadata (firmware bug), but data present
Target (person crop)regionIntrusion, lineCrossing, counting288x384 or 336x448
Target (face crop)videoFaceDetect184x184 (square)
Target (plate crop)vehicle128x64

Decoding Images in Python

import base64

image_bytes = base64.b64decode(source_base64_data)
with open("snapshot.jpg", "wb") as f:
f.write(image_bytes)
Application Guides

For NVR image configuration options (both images, original only, target only, or no images), see the NVR Event Format page. For working code that extracts and saves images from webhook posts, see the Webhook Event Notification API.