![]() |
Network cam viewing
I did some searching and didn't find any good solutions, so I thought I'd post what I've managed to get working regarding viewing my network camera on my N800.
The camera is a SkyIPCam500 by Airlink. It has sound and nightvision, and I've got it set up as a baby cam. You access it through a webpage, and there's a Java or ActiveX viewer. Unfortunately, I can't use either of those on the N800. Even if I installed Debian for Java, the sound only works with the ActiveX control. I did some sniffing with Wireshark and found the URL's that ActiveX is calling. One is for a MJPEG stream. I can plug that into MicroB, but it only displays the first frame. However, I did get it working with mplayer, here is the command line I used: Code:
mplayer -demuxer lavf http://admin:admin@xxx.xxx.xxx.xxx/cgi/mjpg/mjpeg.cgi?foo.mjpg I'm still having some issues with the audio though. The stream is raw PCM data, so I had some trouble figuring out the details. Thankfully, the ActiveX control has an option to record to an AVI file, and using that I figured out it was 8000Hz mono at 128K bitrate. This command line decodes that: Code:
mplayer -rawaudio channels=1:rate=8000:bitrate=128 -demuxer rawaudio http://admin:admin@xxx.xxx.xxx.xxx/cgi/audio/audio.cgi Anyway, just wanted to share what I've got and see if anyone has any suggestions. It will be very cool to just prop the N800 on my nightstand when I go to bed and be able to watch the baby (when it gets here in a few weeks). Even if I don't get the audio working I'm guessing I'll be able to hear the baby screaming without it. :) |
Re: Network cam viewing
Quote:
|
Re: Network cam viewing
I got some time to mess with this again today, and you're right lardman, it did have extra data in there. The video and audio streams are broken up by Content-Length headers. After I figured out the format of the header, I wrote a Python script to try and extract out the unnecessary data. Unfortunately, even after stripping out the header I was still getting popping. The beginning of the data after the header doesn't have anything resembling a WAV header, so I assume it's some custom control data the ActiveX program uses (sync data?). Anyway, as a hack I just stripped out extra bytes until the popping stopped. Not really the best solution, but the audio seems to sound right now.
Once I got that working I tried using the same code to extract the video data, to make things easier on the decoder. Unfortunately, it didn't work. For some reason mplayer thinks it ran out of data before it even gets any. Setting the cache size didn't seem to help. So, in the interest of getting something working I spawned off a process letting mplayer handle the video stream, while I piped the cleaned up audio data to another instance. It worked, but it's pretty rough. I tried running mplayer streaming the video feed overnight last week, and when I woke up in the morning it was desynched an not rendering anymore. That's why I was hoping to process the video data myself too, so I could catch that and restart it. Anyway, at this point I'm not too confident that I'll get something solid working. I've got a Aspire One on order, and I may end up just using that so I can use the ActiveX crap. It's too bad these camera manufacturers don't settle on some standard format. Flash would be pretty sweet, because then I could play it on my Chumby. I'm including my very rough code below, in case anyone else ends up trying to do something like this. Code:
import urllib2 |
Re: Network cam viewing
That's a great idea!
Quote:
Quote:
Quote:
Let me give you my standard advice.... get ALL the sleep you can get NOW. You have a 95% chance of getting about 2 hours a night... for about the next decade or so. |
Re: Network cam viewing
I just picked up a similar IP cam and tried using your mplayer commands and it seemed to work just as you described. The video looks great but the audio isn't working quite right. I can hear it but it's pretty choppy.
Did you ever figure out how to clean up your audio stream? Also, sorry if this is a dumb question, but how can I use your code? I'm new to the n800 world so I'm not sure if that's just a script or if I need to compile it somehow. Thanks! |
Re: Network cam viewing
Update:
VLC may work. This worked great from VLC on my pc. rtsp://admin:admin@xxx.xxx.xxx.xxx/mpeg4 I thought I saw somewhere there was a VLC player for the n800. Will try that next. |
Re: Network cam viewing
dude, it might be cool for you to be ABLE to have that on your nightstand for your own personal hobby and fun but just a word of advice after going throught that with my first one(but not any others ever since)
a) babies scream, you can hear them from a ways away and your hearing gets a lot better as soon as you hear it scream the first time. b) when a baby screams into a cheap microphone placed conveniently next to its head the effects on the receiving end can be deafening. c) no matter what scheme ypu have cooked up for monitoring the baby with your gadgets, if it hiccups once it is ****. just get the exact baby monitor she wants, it doesn't matter if your solution does infrared at 30fps with stereo audio, it doesnt say monitor for babies on the package d) sleep is so precious in that beginning time, why put a speaker on your nightstand. good luck, ypu are gonna need it. |
Re: Network cam viewing
Hey, been a while since I checked this. Quipper, I'll have to disagree with you on always being able to hear the baby. He's in a room upstairs, and if either door is closed it can be hard to hear. I did end up buying a regular audio monitor like you suggested though. After my wireless crapped out a few times I figured I needed something more reliable. Thing is, the audio monitor isn't perfect either. Once a month or so it will be totally blown out by random static (ham radio operator or something). That's when it's nice to just use the webcam. Also, the video feed is nice if you hear something through the audio monitor and just wanna see what's up (usually he's eating his blanket).
I did actually improve the script a lot. I switched to pygame due to all my problems with mplayer. Unfortunately, on the N800 neither pygame or PIL have JPEG support compiled in. (PIL not having it is a big WTF.) So, my script won't work on the N800, I run it on my Aspire One. Also, even with perfectly decoded wave data pygame still has some issue playing the audio for more than a second or so (it's not really set up for streaming the way I'm trying to do it). Here's the latest code though, with misc crap scattered around, for anyone who wants to play with it. Code:
import urllib2 |
All times are GMT. The time now is 14:31. |
vBulletin® Version 3.8.8