ONVIF snapshot

Prev

Next

 






































































































ONVIF snapshots

Description

ONVIF snapshots

To get just JPEG image from an IP camera, instead of starting the camera live stream, it is possible to request a JPEG snapshot, that is returned as a JPEG file or as a pointer to the JPEG memory buffer, or both.


Sample code to get a JPEG file:

VideoGrabber.VideoSource = vs_IPCamera

VideoGrabber.OpenURLAsync = true; // so the connection does not block the main thread (it's the default anyway)

VideoGrabber.IPCameraURL = "onvif://192.168.0.25:80" // if the port is not specified the default port 80 is used

VideoGrabber.SetAuthentication (at_IPCamera, "root", "admin")

VideoGrabber.ONVIFSnapshot (false, true, "c:/folder/snapshot.jpg")


Sample code to get an access to the JPEG snapshot buffer in memory:

VideoGrabber.VideoSource = vs_IPCamera

VideoGrabber.OpenURLAsync = true; // default, so the connection does not block the main thread

VideoGrabber.IPCameraURL = "onvif://192.168.0.25:80" // if the port is not specified the default port 80 is used

VideoGrabber.SetAuthentication (at_IPCamera, "root", "admin")

VideoGrabber.OnRawVideoSample = OnRawVideoSampleCallback

VideoGrabber.ONVIFSnapshot (true, false, "")

in the OnRawVideoSampleCallback event callback, the pSampleBuffer return a pointer to the JPEG snapshot in memory of a SampleBufferSize size.

Note: it is possible to get both the memory callback and the JPEG file as follows:

VideoGrabber.ONVIFSnapshot (true, true, "c:/folder/snapshot.jpg")