Video Capture Provides JPEG format screenshot function, including returning image binary data, image file direct storage.
Interface Overview interface Name Functional Description NET_SDK_CaptureJPEGData_V2 JPEG format screenshot interface, JPEG data is saved in the - data cache area. NET_SDK_CaptureJPEGFile_V2 JPEG format screenshot interface, the image is saved - directly as a file format. NET_SDK_CaptureJPEGPicture Crawl the JPEG format image and save it, and save the JPEG - data in the data cache. Only win version support, screenshot in decoding library. NET_SDK_RemoteSnap Control remote device screenshot, picture saving device local. (N9000 only) NET_SDK_SearchPictures Get a list of pictures of the remote device. (N9000 devices only) NET_SDK_DownLoadPicture Download the remote images found by net_SDK_SearchPictures and save them in the cache. (N9000 only)
Process Description ---
title: Video Capture
---
flowchart TD
A(Device SDK initialization <br><strong>NET_SDK_Init</strong>)
B(User registration device <br><strong>NET_SDK_Login</strong> or <br><strong>NET_SDK_LoginEx</strong>)
C("Capture JPEG image data <br><strong>NET_SDK_CaptureJPEGData_V2</strong>")
D("Capture JPEG image file <br><strong>NET_SDK_CaptureJPEGFile_V2</strong>")
E("...")
F("Search for pictures <br><strong>NET_SDK_SearchPictures</strong>")
G("Download the searched pictures <br><strong>NET_SDK_DownloadPicture</strong>")
Y(Logout device <br><strong>NET_SDK_Logout</strong>)
Z(Release SDK resources <br><strong>NET_SDK_Cleanup</strong>)
A --> B
Y --> Z
B ---> C ---> Y
B ---> D ---> Y
B ---> E ---> Y
B ---> F ---> Y
B ---> G ---> Y Sample Code Get screenshot data to cache area Download screenshot to local save as file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 #include <afx.h>
#include <string>
#include <stdio.h>
#include <iostream>
#include "DVR_NET_SDK.h"
void CaptureJPEGData ()
{
// Device information.
const std:: string device_ip = "10.80.1.177" ;
const DWORD decice_port = 6036 ;
const std:: string username = "admin" ;
const std:: string password = "123456" ;
// Initialize SDK.
NET_SDK_Init();
NET_SDK_DEVICEINFO device_info{0 };
DWORD errCode = 0 ;
// Device login.
int userid = NET_SDK_Login(const_cast < char *> (device_ip.c_str()), decice_port, const_cast < char *> (username.c_str()), const_cast < char *> (password.c_str()), & device_info);
if (userid > 0 )
{
std:: cout << "Login successful!" << std:: endl;
}
else
{
errCode = NET_SDK_GetLastError();
std:: cout << "Login failed!" << "Error code:" << errCode << std:: endl;
NET_SDK_Cleanup();
return ;
}
// Get the screenshot data and save it to the local disk.
DWORD dwRetLen = 0 ;
const int nJpgBufLen = 1024 * 1024 * 5 ;
char * pJpegBuf = new char [nJpgBufLen];
memset(pJpegBuf, 0x00 , nJpgBufLen);
char imgName[512 ]{0 };
sprintf_s(imgName, "D:/test.jpg" );
BOOL captureStatus = NET_SDK_CaptureJPEGData_V2(userid, 0 , pJpegBuf, nJpgBufLen, & dwRetLen);
if (! captureStatus)
{
errCode = NET_SDK_GetLastError();
std:: cout << "Screenshot failed!" << "Error code:" << errCode << std:: endl;
}
else
{
FILE * file;
errno_t err = fopen_s(& file, imgName, "wb" );
if (err = 0 || file != NULL )
{
fwrite(pJpegBuf, sizeof (char ), dwRetLen, file);
fclose(file);
std:: cout << "Screenshot successful!" << std:: endl;
}
else
{
std:: cout << "Screenshot failed! write file failed!" << std:: endl;
}
}
// Logout.
NET_SDK_Logout(userid);
// Release SDK resources.
NET_SDK_Cleanup();
return ;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 #include <afx.h>
#include <string>
#include <stdio.h>
#include <iostream>
#include "DVR_NET_SDK.h"
void CaptureJPEGFile ()
{
// Device information.
const std:: string device_ip = "10.80.1.177" ;
const DWORD decice_port = 6036 ;
const std:: string username = "admin" ;
const std:: string password = "123456" ;
// Initialize SDK.
NET_SDK_Init();
NET_SDK_DEVICEINFO device_info{0 };
DWORD errCode = 0 ;
// Device login.
int userid = NET_SDK_Login(const_cast < char *> (device_ip.c_str()), decice_port, const_cast < char *> (username.c_str()), const_cast < char *> (password.c_str()), & device_info);
if (userid > 0 )
{
std:: cout << "Login successful!" << std:: endl;
}
else
{
errCode = NET_SDK_GetLastError();
std:: cout << "Login failed!" << "Error code:" << errCode << std:: endl;
NET_SDK_Cleanup();
return ;
}
// Save the screenshot directly to the local disk.
char imgName[512 ]{0 };
sprintf_s(imgName, "D:/test.jpg" );
BOOL captureStatus = NET_SDK_CaptureJPEGFile_V2(userid, 0 , imgName);
if (! captureStatus)
{
errCode = NET_SDK_GetLastError();
std:: cout << "Screenshot failed!" << "Error code:" << errCode << std:: endl;
}
else
{
std:: cout << "Screenshot successful!" << std:: endl;
}
// Logout.
NET_SDK_Logout(userid);
// Release SDK resources.
NET_SDK_Cleanup();
return ;
}