问题描述
我有一个符合ONVIF的摄像机(Amcrest IP8M-2496EW),其板载SD卡用于本地存储。我正在尝试使用“ * {Recording Control Service Specification*””中记录的“ ExportRecordedData()”方法从摄像机将录音(MP4和JPG)下载到我的计算机。这是我发现与从远程ONVIF设备下载或检索文件有关的唯一功能。
我在使用python3,Zeep和elsampsa/valkka-core进行了稍微修改的基础文件与相机通信方面取得了一些成功。借助该软件,我已经测试了使用该设备,记录和搜索服务的各种服务方法。
在ONVIF中,录制的文件不是文件(例如video.mp4),而更像是带有开始和停止事件的媒体时间轴。我的理解是ExportRecordedData()函数将提取该媒体并创建一个文件,我应该可以在该文件中检索该文件然后在其上查看。目前,我对如何真正发挥作用一无所知。这是我正在尝试的代码片段:
for segment in recording_list:
startpoint = segment[0]
endpoint = segment[1]
sp = "%s" % startpoint
ep = "%s" % endpoint
print("StartPoint-EndPoint %s %s" % (startpoint,endpoint))
# Example: 2020-07-10 02:04:15+00:0
storage_root = "/home/pi/"
storage_filename = sp[0:10] + " " + sp[11:13] + "." + sp[14:16] + "." + sp[17:19]
fileformat = "mp4"
full_path = storage_root + storage_filename + "." + fileformat
print("Storing media to %s" % full_path)
scope = recordings[0]
storagereferencepath = {'RelativePath': storage_filename}
storage = {'Storagetoken': storage_root,'RelativePath': storage_filename}
export = {'StartPoint': startpoint,'EndPoint': endpoint,'SearchScope': scope,'FileFormat': fileformat,'StorageDestination': storage}
# Export this segment
print("ExportRecordedData() using recording_service")
export_token = recording_service.ws_client.ExportRecordedData(**export)
我不确定其中的几个参数,因为规范很小,而且我找不到任何合适的示例。调用的结果是这样的:
Traceback (most recent call last):
File "./cam.py",line 322,in <module>
main()
File "./cam.py",line 273,in main
export_token = recording_service.ws_client.ExportRecordedData(**export)
File "/usr/local/lib/python3.7/dist-packages/zeep/proxy.py",line 45,in __call__
kwargs,File "/usr/local/lib/python3.7/dist-packages/zeep/wsdl/bindings/soap.py",line 130,in send
return self.process_reply(client,operation_obj,response)
File "/usr/local/lib/python3.7/dist-packages/zeep/wsdl/bindings/soap.py",line 195,in process_reply
return self.process_error(doc,operation)
File "/usr/local/lib/python3.7/dist-packages/zeep/wsdl/bindings/soap.py",line 362,in process_error
subcodes=subcodes,zeep.exceptions.Fault: UnkNown Error
所以我现在陷入困境,并对如何实现下载MP4的目标有几个疑问。
这台摄像机是否甚至支持ONVIF导出(所有记录都是通过Amcrest Web界面而不是通过ONVIF记录作业开始的?)?
相机未报告任何文件格式(“ SupportedExportFileFormats”:无)。规格说相机在这种情况下不会输出任何东西。是吗结束了吗?
ExportRecordedData()仅表示录制时间轴事件将被导出到相机的SD卡,而不是我的本地计算机吗?我看不到任何旨在保存要远程传递的MP4或JPG数据的WSDL参数。但是从ONVIF描述看来,文件传输应该是可能的。我认为这必须通过zeep传递给我的SOAP响应来实现。
对于我在这个项目中面临死胡同还是需要适当的设置的任何建议,我将不胜感激。我想尽可能使用ONVIF,但会考虑其他有关API的建议。 tchellomello/python-amcrest处还有另一种解决方案,但它是特定于相机的,我想先看看是否有ONVIF解决方案。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)