I've bougth an IP camera. I then, discovered that it uses a standard called ONVIF. I searched about it and saw that it's a good way to put all the cameras in the world to be implemented in the same way.
Of course I've read the ONVIF specification PDFs. What I understand about how it works, is the following:
There is a WSDL file that describes how the camera (or another thing) can be accessed. Like, which settings can be modified, which methods are accepted, and so. When I read this WSDL file, I'll choose a method and send a type of message called SOAP, which will be a XML containing the response to some method on the WSDL file. SOAP is a XML that can go over HTTP (so it can go through firewalls), but also can be sent over other protocols.
So, as I understood, if I want to tell my camera to start streaming video, I just need to find the WSDL method that describes how to initiate a stream, and then send a SOAP message to tell it that I need to start a video stream over some protocol, at some port. Then, I can read and decode the stream.
By knowing this simple example I gave, I could do other things, like, control the camera and so. I don't know the public for which the PDFs at ONVIF are directed for, but I couldn't understand it enough so I could explore my camera. For example: I don't know how to receive this WSDL file. I've read somewhere that I should access http://ip_of_camera/onvif/device_service to get the file, and then I should send a SOAP message to it and watch the response.
I even tried to analyse the packets via wireshark, but they've seem nonsense to me. It was difficult because I couldn't even make my camera work with iSpy software. It only works perfectly (but with no audio or talk) in my android app, so I've set up a proxy at my raspberry pi and then analyzed the packets.
Could somebody give me a basic example of how to receive the WSDL file, and then how to call one method of it? I wanted to see how it works in a network level, but I can only find how to call libraries in C# that are ready to deal with it.
For example: I wanted to know what I need to send through TCP or over TCP/HTTP to the camera, and how to initate a stream. All of this in network level, no code needed at all.
I'm just trying to learn here, but this doesn't seem like a real "open" standard. It's very hard to understand if you never programmed anything like it. So I guess those PDFs are for people who work with it. I know how TCP and UDP works and how to send raw messages by them, so it's all a question of finding a good resource with examples, so I can understand what ONVIF is really about.
Couldn't the internet unite to make it more clear? Why there are no posts about it?
Thanks, amazing community <3
Related
I would like to code my own client and server in C++ (which I have found plenty of tutorials on) and access to all information about the headers and all the fields in a frame that is going to be sent across a network.
I need it to be able to edit and/or manipulate information in all the header fields before sending the frame across the network. What's more, it needs to be able to receive a frame and read/manipulate all the header fields from layer 2 to up layer.
I just want to know what library in C++ I need to use or is there any information on how I can code something to accomplish this via C++ that I can be directed to?
If you want to construct a client/server, it's easy. But if you want to build a packet from MAC to Transport Layer, then you need to use the Linux kernel. You need to have some knowledge about how the packets are sent and received. What's more, we always use C to realise it.
For my scientific collaboration, I wrote a C++ server/client (terminal server for linux, and cross-platform GUI client using Qt) that is mainly meant to transfer data from multiple clients around the world to store it on one server for analysis (pretty much like LIGO and Virgo that caught gravitational waves). For the communication low-level protocol I used boost::asio::ssl.
The "odd" part: In my programs, I created my own half-duplex messaging protocol between the server and the client from scratch. The messaging was in string form containing the version of the protocol, endianness of the computer, length of the message, type of the message (login/file/error/etc...), an MD5 hash for verification of the completeness of the transferred data. I got highly criticized on Stackoverflow chat when I said I did this. The part that got specially criticized is: Writing my own messaging protocol.
Now I created this, and I know there should be better protocols that are already written that I shouldn't rewrite it from scratch. However, I wanted to learn how to do this myself, and I did, and the program works, and my collaboration is satisfied, and the sky is blue with birds singing.
My question: If I am to rewrite this program again, what kind of libraries should I use? I'm looking for a protocol, using which I can send messages/data and get the server to respond with messages/data, including username/password to authenticate the user before any communication is transferred? How would you have done it?
PS: Please consider this question coming from a beginner in writing network and internet wide programs. And please don't hesitate to ask for more details.
I'm building an application that needs to modify DHCPv6 packets dynamically before they hit the wire. I'm doing some heavily proprietary work with DHCPv6 vendor options, and I need the ability to examine and modify those options in-memory before they are transmitted.
I've built a proof-of-concept layered service provider on top of Winsock by modifying the Microsoft sample code. It intercepts outgoing HTTP packets, changes the referrer-agent to something funny, and sends the packet on its way. Verified in Wireshark, works great.
It was also straightforward to change my installer code so that my LSP gets chained in on top of UDP/IPv6 rather than TCP/IPv4, and now, with a debugger attached, I can see myself getting callbacks with stacks leading into the DHCP server. However, I can no longer see the buffers in memory.
WSPSend and WSPConnect don't get called, since we're on a connectionless protocol--that makes sense. I do get a consistent callback in WSPSendTo but the lpBuffers member, which in my HTTP prototype contained the buffer representing the outgoing packet, is NULL.
Am I going about this completely the wrong way, or is there another Winsock operation I need to override? I'd be happy to go in another direction if an LSP is the wrong way to go, but outside libraries are a very tough sell for this application--otherwise, I'd be looking at Winpcap.
EDIT: Wow, this was a long time ago. For those coming behind me, this ultimately worked fine. I'm embarrassed to say that the issue was that I was compiling with optimizations that prevented me from seeing the correct data in the debugger. When I stopped being lazy and dumped the bytes to a file, I saw that all was well.
LSP does can only intercept Winsock traffic, DHCP is at a lower layer, you need a different technology to do this, for example: NDIS, TDI (Will not work on Win8) or WFP (Will not work on XP)
In my application we will present the video stream from a traffic camera to a client viewer. (And eventually several client viewers.) The client should have the ability to watch the live video or rewind the video and watch earlier footage including video that occurred prior to connecting with the video stream. We intend to use wxWidgets to view the video and within that we will probably use the wxMediaCtrl.
Now, from the above statements some of you might be thinking "Hey, he doesn't know what he's talking about." And you would be correct! I'm new to these concepts and I confused by the surplus of information. Are the statements above reasonable? Can anyone recommend a basic server/client architecture for this? We will definitely be using C++ wxWidgets for the GUI, but perhaps wxMediaCtrl is not what I want... should I be directly using something like the ffmpeg libraries?
Our current method seems less than optimal. The server extracts a bitmap from each video frame and then waits for the single client to send a "next frame" message, at which point the server sends the bitmap. Effectively we've recreated our own awkward, non-standard, inefficient, and low-functionality video streaming protocol and viewer. There has to be something better!
You should check out this C++ RTMP Server: http://www.rtmpd.com/. I quickly downloaded, compiled and successfully tested it without any real problems (on Ubuntu Maverick). The documentation is pretty good if a little all over the place. I suspect that once you have a streaming media server capable of supporting the typical protocols (which rtmpd seems to do), then writing a client should fall into place naturally, especially if you're using wxWidgets as the interface api. Of course, it's easy to write that here, from the comfort of my living room, it'll be a different story when you're knee deep in code :)
you can modify your software such that:
The server connect, server grabs an image, passes it to ffmpeg establishing stream, then copy the encoded data from ffmpeg stream and send to client via network, if the connection drops, close the ffmpeg stream.
Maybe you can use the following to your own advantage:
http://www.kirsle.net/blog.html?u=kirsle&id=63
There is a player called VLC. It has a library for c++ and you can use it to embed the player in your GUI application. It supports a very wide range of protocols. So you should leave connecting, retrieving and playing jobs to VLC and take care of the starting and stopping jobs only. It would be easy and probably a better solution than doing it yourself.
For media playing facility, both music and audio, you can a look on GStream. And talking about the server, I think Twisted (A network library in Python) should be good option. The famous live video social website justin.tv is based on Twisted. Here you can read the story from here. Also, I built a group of server for streaming audio on Twisted, too. They can serve thousands of listener on line in same time.
I have an application that grabs video from multiple webcams, does some image processing, and displays the result on the screen. I'd like to be able to stream the video output on to the web - preferably to some kind of distribution service rather than connecting to clients directly myself.
So my questions are:
Do such streaming distribution services exist? I'm thinking of something like ShoutCAST relays, but for video. I'm aware of ustream.tv, but I think they just take a direct webcam connection rather than allow you to send any stream.
If so, is there a standard protocol for doing this?
If so, is there a free library implementation of this protocol for Win32?
Ideally I'd just like to throw a frame of video in DIB format at a SendToServer(bitmap) function, and have it compress, send, and distribute it for me ;)
Take a look at video LAN client (or VLC for short) as a means for streaming video.
As for distribution sites, I don't know how well it works with ustream.tv and similar new services.
ustream.tv works by using Adobe Flash's support for reading input from a webcam. To fake it out, you need a fake webcam driver. Looking on the ustream.tv site, they point to an application called WebCamMax that allows effects and splicing in video. It works by creating a pseudo-webcam that mixes video from one or more cameras along with other sources. Since that app can do it, your own code could do that too, although you'll probably need to write a Windows driver to get it all working correctly.