简体   繁体   English

带有登录名和密码的开源URL

[英]Open Source URL with login and password

I am working on preparing a Media Foundation session that reads a video stream from a network security camera, displays it on screen and encodes it to disk. 我正在准备一个Media Foundation会话,该会话将从网络安全摄像机读取视频流,然后将其显示在屏幕上并将其编码到磁盘。 I have everything working with a webcam and now I'm trying to connect to the network camera using the IMFSourceResolver 's CreateObjectFromURL() . 我已经使用网络摄像头进行所有操作,现在我正尝试使用IMFSourceResolverCreateObjectFromURL()连接到网络摄像头。 The problem is that the camera requires a login and password and formatting the URL as: 问题是相机需要登录名和密码,并将URL格式设置为:

rtsp://login:password@IPaddr

still results in a "permission denied" response. 仍然会导致“权限被拒绝”响应。

MSDN has a few pages on using IMFNetCredentialManager to provide the user name and password, but it is not working and I still get permission denied. MSDN上有几页使用IMFNetCredentialManager提供用户名和密码,但是它不起作用,我仍然会拒绝权限。 Using WireShark I can see that the camera responds with the "Unauthorized" RTSP response to the first MF connection attempt, and then MF just gives up and doesn't check the credential manager, ending in failure. 使用WireShark,我可以看到摄像机对第一个MF连接尝试做出了“未经授权”的RTSP响应,然后MF放弃了,并且不检查凭据管理器,以失败告终。

I don't find any other example using IMFNetCredentialManager out there. 我没有找到其他使用IMFNetCredentialManager示例。 It seems like reading a video stream from an IP camera that requires a password should be a common task yet I can find no evidence of it being done in practice. 从IP摄像机读取需要密码的视频流似乎是一项常见的任务,但我找不到在实践中完成该操作的证据。 Is it possible to do with Media Foundation or is there another approach that I missed? 是否可以使用Media Foundation或我错过了另一种方法?

After completing my research, here is the conclusion that I have reached. 完成研究后,这里是我得出的结论。

Windows Media Foundation provides good (but not thorough) support for USB webcams and basic streaming. Windows Media Foundation为USB网络摄像头和基本流提供了良好(但不是彻底的)支持。 It is just a foundation though. 它只是一个基础。 Anything more advanced like communicating with a networked IP camera requires a lot of extra work by the programmer to fully implement their protocol of choice, like RTSP, HTTP or ONVIF. 诸如与网络IP摄像机进行通信之类的任何更高级的操作,程序员都需要大量额外的工作来完全实现其选择的协议,例如RTSP,HTTP或ONVIF。

I was expecting that I could set up a media session for a webcam and then simply switch the source to a network camera with RTSP by using the source resolver with a URL. 我期望我可以为网络摄像头设置媒体会话,然后通过将源解析器与URL一起使用RTSP将源切换到网络摄像机。 Authorization using the network credential manager as shown in MSDN is not part of the media source provided by Media Foundation, which is why BeginGetCredentials() is not called. 如MSDN中所示,使用网络凭据管理器进行的授权不是Media Foundation提供的媒体源的一部分,这就是为什么未调用BeginGetCredentials()的原因。 It is just an example of what you need to implement with your own scheme. 这只是您需要使用自己的方案实现的示例。

My solution is therefore to abandon using Media Foundation and go with a 3rd party library from LEADTOOLS, etc. It costs money, but otherwise it would cost a lot more development time for me to create what I need. 因此,我的解决方案是放弃使用Media Foundation,而使用LEADTOOLS等提供的第三方库。这需要花钱,但是要创建所需的东西,我将花费更多的开发时间。

I hope this answer helps save someone all the time I spent chasing this rabbit into the abyss! 我希望这个答案可以帮助我在追逐这只兔子到深渊的整个过程中节省时间!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM