python宇视IPC调用SDK抓图

总结:

由于IPC版本太低导致调用SDK抓图失败(宇视技术支持给出的结果)

  • 宇视SDK官网下载地址:宇视

  • 我所使用的SDK版本:NETDEVSDK_Linux64_V2.3.17.0

  • 我的抓图流程:初始化(NETDEV_Init) -> 设备登录(NETDEV_Login_V30)-> 查询视频通道信息列表(NETDEV_QueryVideoChlDetailList)-> 非预览下抓拍(NETDEV_CaptureNoPreview)

  • 具体python的demo代码,可以参考SDK中给出的demo来写(c++)

一、demo代码运行结果:
image.png
二、SDK打印日志如下:
[06-29 15:23:45.111] [id:355] [thr:140707158558528][NetDEVSDK.cpp:495](NETDEV_Init) SDK Version: V2.5.2.0 (Built on 20201026)
[06-29 15:23:45.111] [id:355] [thr:140707158558528][NetDEVSDK.cpp:499](NETDEV_Init) Path:AA==
[06-29 15:23:45.120] [id:366] [thr:140707158558528][ezr_rm.c:289](RM) InitRtspMsgQueue Success, BufSize[10240].
[06-29 15:23:45.121] [id:366] [thr:140707158558528][ezr_rm.c:4053](RM) RM_Init Success.
[06-29 15:23:45.121] [id:366] [thr:140707158558528][ezr_rm_ex.c:1099](RM) IMCP_RM_Init Success, MaxSession:[128].
[06-29 15:23:45.121] [id:0] [thr:140707158558528][player_sdk_func.c:92](ND) Call NDPlayer_Init.
[06-29 15:23:45.121] [id:0] [thr:140707158558528][player_manager.cpp:193](ND) Player Startup.
[06-29 15:23:45.121] [id:0] [thr:140707158558528][sdlDisplay.cpp:91](ND) dlopen libX11.so failed, error : libX11.so: cannot open shared object file: No such file or directory.
[06-29 15:23:45.123] [id:366] [thr:140706525955840][ezr_rm.c:3908](RM) Start MainProc Thread Success.
[06-29 15:23:45.123] [id:366] [thr:140706534348544][ezr_rm.c:3345](RM) Start ClientRcvProc Thread Success.
[06-29 15:23:45.148] [id:0] [thr:140707158558528][player_sdk_func.c:118](ND) Call NDPlayer_Init Success, Version: 2.5.0112.
[06-29 15:23:45.148] [id:0] [thr:140707158558528][player_sdk_func.c:261](ND) Call NDPlayer_SetPlayerRunMsgCB Success.
[06-29 15:23:45.148] [id:355] [thr:140707158558528][NetDEVSDK.cpp:565](NETDEV_Init) NetDEVSDK init succeed.
[06-29 15:23:45.316] [id:355] [thr:140707158558528][lapi_manager.cpp:592](getRSAPublicKeyEx) Success, m_enAuthMode : 2, url : HTTP://10.55.5.51:80/LAPI/V1.1/System/Security/RSA, response : {
"Response": {
        "ResponseURL": "/LAPI/V1.1/System/Security/RSA",
        "CreatedID": -1,
        "ResponseCode": 0,
        "SubResponseCode": 0,
        "ResponseString": "Succeed",
        "StatusCode": 0,
        "StatusString": "Succeed",
        "Data": {
        "RSAPublicKeyE":        "10001",
        "RSAPublicKeyN":        "D63480AC5E0615A4235AFECE1D196FD4BF2FAC989CA7A88E71422DF02780DFC3692490F2CD3DADAA18872108D731FB7EE17892E7379DB549C4B301C835C525DAC98BAB04C06914
[06-29 15:23:45.316] [id:355] [thr:140707158558528][NetDEVSDK.cpp:1663](NETDEV_Login_V30) Succeed, IP : 10.55.5.51, port : 80, userID : 0x1caa5d0
[06-29 15:23:45.997] [id:355] [thr:140707158558528][system_LAPI.cpp:7246](getDevChnDetailList) Parse responce fail, retcode : 8, url : HTTP://10.55.5.51:80/LAPI/V1.0/Channels/System/ChannelDetailInfos, response : {
"Response": {
        "ResponseURL": "/LAPI/V1.0/Channels/System/ChannelDetailInfos",
        "CreatedID": -1,
        "ResponseCode": 4,
        "SubResponseCode": 0,
        "ResponseString": "Not Supported",
        "StatusCode": 8,
        "StatusString": "UnSupport",
        "Data": "null"
        }
}

[06-29 15:23:45.997] [id:355] [thr:140707158558528][NetOnvif.cpp:1015](queryVideoChlList) Query video chl info failed, Video Source Num : 1
[06-29 15:23:46.077] [id:355] [thr:140707158558528][netsdk_func.cpp:528](CreateDirectory) Create Directory fail, not find '\' in path. path : /app/test/1.jpg
[06-29 15:23:56.079] [id:355] [thr:140707158558528][http.cpp:1555](httpGetFileByHeader) httpGetFileByHeader, Http curl perform fail. retcode : 28. Download fail, retcode : 0
[06-29 15:23:56.079] [id:355] [thr:140707158558528][media_LAPI.cpp:45](saveSnapShotFileByURL) Save snapshot file. Http Get snapshot file fail, retcode : -1, snapshot url : http://10.55.5.51:85/images/snapshot.jpg
[06-29 15:23:56.079] [id:355] [thr:140707158558528][NetDEVSDK.cpp:3606](NETDEV_CaptureNoPreview) Save Snapshot file fail, retcode : -1, userID : 0x1caa5d0, snapUrl : http://10.55.5.51:85/images/snapshot.jpg, filename : /app/test/1, capture mode : 1
root@a38597d22295:/app/test#

感觉稀里糊涂的,同时也奇怪抓图怎么走的85端口:http://10.55.5.51:85/images/snapshot.jpg
最后实在没办法,给宇视官方邮箱提交工单,回复如下:

image.png

三、排查

(感谢宇视技术支持的技术支持)
电脑是win10,下载win10的SDK调试:win10SDK下载地址

3.1)解压后,打开bin目录下的NetDemo.exe,启动文件。部分电脑可能需要下载安装 Visual C++ 2013

image.png

(链接: https://pan.baidu.com/s/1PY38Ydxi7mVmZeS_JlT39w 提取码: is9d 复制这段内容后打开百度网盘手机App,操作更方便哦)

image.png

配置连接IPC,点击抓图按钮,底下会出现log日志
也可以在sdk/bin/log下查看日志


image.png
[06-29 20:15:18.592] [id:0] [thr:3892][.\src\dsp_h264_gpu_dec.cpp:561](ND) [3980-3892] Call DSP_GPU_Global_Free
[06-29 20:15:18.658] [id:0] [thr:3892][..\..\..\src\player_sdk_func.c:149](ND) [3980-3892] Call NDPlayer_Cleanup Success.
[06-29 20:15:18.658] [id:367] [thr:3892][..\..\..\src\rtmp\rtmp_sdk_func.c:229](RTMP) [3980-3892] Call NDRtmp_Cleanup
[06-29 20:15:18.686] [id:367] [thr:3892][..\..\..\src\rtmp\rtmp_sdk_func.c:243](RTMP) [3980-3892] Call NDRtmp_Cleanup success
[06-29 20:15:18.686] [id:355] [thr:3892][..\src\NetDEVSDK.cpp:802](NETDEV_Cleanup) NetDEVSDK clean up succeed.
[06-29 23:11:05.629] [id:355] [thr:9164][..\src\NetDEVSDK.cpp:495](NETDEV_Init) SDK Version: V2.5.0.9 (Built on 20201116)
[06-29 23:11:05.629] [id:355] [thr:9164][..\src\NetDEVSDK.cpp:499](NETDEV_Init) Path:aHR0cDovLzEwLjIyMC4zLjI0Mi9yZF9wcm90b2NvbF9jb2RlL2JyYW5jaGVzX3Z2ZGJ1Z2ZpeC9nMDU2MjkvYnJfU0RLX1YyLjUuMC45X0RlbEV0aGljQ29kZVszMDQ3MV0A
[06-29 23:11:05.631] [id:366] [thr:9164][..\..\..\src\rm\ezr_rm.c:289](RM) InitRtspMsgQueue Success, BufSize[10240].
[06-29 23:11:05.631] [id:366] [thr:9164][..\..\..\src\rm\ezr_rm.c:4032](RM) RM_Init Success.
[06-29 23:11:05.631] [id:366] [thr:9164][..\..\..\src\rm\ezr_rm_ex.c:1099](RM) IMCP_RM_Init Success, MaxSession:[128].
[06-29 23:11:05.631] [id:366] [thr:15140][..\..\..\src\rm\ezr_rm.c:3324](RM) Start ClientRcvProc Thread Success.
[06-29 23:11:05.631] [id:366] [thr:7796][..\..\..\src\rm\ezr_rm.c:3887](RM) Start MainProc Thread Success.
[06-29 23:11:05.631] [id:367] [thr:9164][..\..\..\src\rtmp\rtmp_sdk_func.c:194](RTMP) [13332-9164] Call NDRtmp_Init Info, MaxSession(128)
[06-29 23:11:05.631] [id:367] [thr:9164][..\..\..\src\rtmp\rtmp_sdk_func.c:222](RTMP) [13332-9164] Call NDRtmp_Init success
[06-29 23:11:05.631] [id:0] [thr:9164][..\..\..\src\player_sdk_func.c:92](ND) [13332-9164] Call NDPlayer_Init.
[06-29 23:11:05.631] [id:0] [thr:9164][..\..\..\src\player_manager.cpp:193](ND) [13332-9164] Player Startup.
[06-29 23:11:05.639] [id:0] [thr:9164][.\src\dsp_h264_gpu_dec.cpp:471](ND) [13332-9164] Call DSP_GPU_Global_Init, Media SDK version:1.16
[06-29 23:11:05.640] [id:0] [thr:7316][.\src\dsp_h264_gpu_dec.cpp:368](ND) [13332-7316] __InitSessionThreadEntry start
[06-29 23:11:06.289] [id:0] [thr:9164][.\coom_resources.cpp:114](ND) [13332-9164] -> GPU 0: < GeForce MX330 > driver mode is: WDDM.
[06-29 23:11:06.373] [id:0] [thr:9164][..\..\..\src\player_sdk_func.c:118](ND) [13332-9164] Call NDPlayer_Init Success, Version: 2.5.0111.
[06-29 23:11:06.373] [id:0] [thr:9164][..\..\..\src\player_sdk_func.c:261](ND) [13332-9164] Call NDPlayer_SetPlayerRunMsgCB Success.
[06-29 23:11:06.373] [id:355] [thr:9164][..\src\NetDEVSDK.cpp:565](NETDEV_Init) NetDEVSDK init succeed.
[06-29 23:11:16.400] [id:355] [thr:3816][..\..\thirdpart\common\bp\http.cpp:160](ns_NetSDK::CHttp::httpGet) httpGet, Http curl perform fail. retcode : 28
[06-29 23:11:16.400] [id:355] [thr:3816][..\src\NetOnvif.cpp:12710](ns_NetSDK::CNetOnvif::parseVersionHtml) Http Get version html fail, retcode : 114, Url : http://10.55.5.51:80/Version.html, responce : 
[06-29 23:11:16.400] [id:355] [thr:3816][..\src\NetOnvif.cpp:347](ns_NetSDK::CNetOnvif::login) Login. Get version.html faild,  Url:http://10.55.5.51:80/Version.html
[06-29 23:11:16.400] [id:355] [thr:3816][..\src\NetDEVSDK.cpp:1635](NETDEV_Login_V30) Fail, retcode : 114, IP : 10.55.5.51, port : 80

你可能感兴趣的:(python宇视IPC调用SDK抓图)