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
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,271评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,275评论 2 380
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,151评论 0 336
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,550评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,553评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,559评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,924评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,580评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,826评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,578评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,661评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,363评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,940评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,926评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,156评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,872评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,391评论 2 342

推荐阅读更多精彩内容