A while back, I wrote an article showing you how to create your own C# app for controlling the FOSCAM Wireless IP Camera. In that project, I showed you how to access individual images from your camera using the “snapshot.cgi” URL. Basically, that app would call the IP camera and retrieve 1 frame at a time which would simulate the appearance of streaming video. However, that app wasn’t really utilizing the streaming video capabilities that the camera had to offer which was somewhat noticeable in the video playback. Since writing that article, I have received hundreds of emails asking if I would show how to use the “videostream.cgi” URL instead. At one point I had built an app that does just that, but seemed to have lost the project somewhere along the way. Unfortunately, I have not had a lot of extra time to revisit this app until. The only reason I’m getting the chance / making the time to revisit the app now is because I have recently been conducting a major overhaul of my home automation & security system which involves this app.
One of the things I’ve done during that process is replace all of my FOSCAM IP Cameras with the INSTEON 75790WH wireless security IP cameras which are available on Amazon currently for around $65.00. They are pretty much the same exact cameras. Just like the FOSCAM IP cameras, the INSTEON cameras also include pan, tilt, & night vision. But, with many parts of my home automation system already being INSTEON, I chose to also use the INSTEON cameras as well. Since the FOSCAM and INSTEON cameras are basically the same, the C# IP camera controller app I introduced you to in the previous article will work for both. Plus, the updated version of the app I’m going to show you here also works with both cameras. After playing around with both cameras, the only real reason I would suggest going with the INSTEON version over the FOSCAM version is that INSTEON’s mobile app already supports the INSTEON camera natively. But, if you’re a geek like me and decide to roll your own software, you will be pleased with either camera.
Since, as previously mentioned, I don’t have a lot of extra time these days, I’m not going to bore you with all of the details about the updated code. But, for those of you that are interested, feel free to leave a comment below and I will answer any questions you might have. The only real difference between this version of the app and the original is its ability to read a streaming video feed instead of grabbing 1 frame at a time. To do that, you have to break apart your incoming response from the camera since the incoming content type is “multipart/x-mixed-replace”. Because of this, your incoming stream contains several parts. The only part that we’re really concerned about for this article is the “boundary”. So, all you have to do is read the stream from “boundary=” onward. There is obviously a lot more to it than that which you will see in the code. But, for now, that’s all you really need to concern yourself with.
Below is a screenshot of the app in action. Even though the screenshot doesn’t illustrate the streaming capabilities, I chose to include it anyways since it shows that I’ve also added the ability to control brightness & contrast. This was a feature that I also added to the previous version of the app, but I never created a new screenshot showing that I added it. Since the app works with IP cameras other than just FOSCAM, I also chose to rename the app from “FOSCAM IP Camera Control” to just “IP Camera Control”.
For those of you that prefer to use the snapshot version of the app over the streaming version, I didn’t remove that code. I just added the extra code for handling streaming as well. If you want to switch over to using snapshot, all you need to do is change the callback name from “RunStream” to “RunSnapshot” in the thread start call at line 46. At some point I plan on adding a dropdown on the form that allows the user to decide which version they want to use at runtime instead of requiring any code changes. Unfortunately, I don’t have the time to do that right now. So, it’ll have to wait.
Note: One thing that you’ll also need to be aware of is that the INSTEON camera listens on a different port than the FOSCAM. You can learn how to get the port your INSTEON camera is listening as well as learn how to do port forwarding at https://www.insteon.com/port-forward-home.html.
Download: IPCamera.zip – source code included (42KB)
PayPal will open in a new tab.