(Terrible) Adventures with WVC54GC IP Cam
I was looking for a new, relatively inexpensive, gadget for my house. I was looking at the flyer for Canada Computers and there was a deal on a Linksys WVC54GC IP Cam. So I figured OK.
Anybody who has bought a WVC54GC knows that this IP Camera has a complicated setup and not to many features. I learned this the hard way. The positive thing about this camera is that, if your crafty, you can make it do everything with a lot of work. What following is the things I managed to make mine do.
Streams Coming out of the Cam
The cam has three streams coming out of the cam:
- http://[camera address]/img/video.asf [ASF Stream]
- http://[camera address]/img/mjpeg.jpg [Motion JPEG]
- http://[camera address]/img/mjpeg.cgi [Motion JPEG]
Opening one of the Steams
The cam is designed to be used either through Internet Explore (via ActiveX control) or using the Linksys IP Cam think client, available for download here:
http://www.linksysbycisco.com/CA/en/support/WVC54GC/download
The Setup Wizard is actually the Think Client
However the above mentioned streams can also be directly opened in VLC. VLC is a cross-platform media player and streaming server.
http://www.videolan.org/vlc/
Capturing a Still Image from the IP Cam
So as complained about by many, the Cam cannot capture a still jpg. Can't do it. The WVC54GCA can but not this guy. Plus it needs a ActiveX control to view anything so, checking in on the cam from any browser just isn't possible.
Solution
So here starts the terrible adventure. There are ton of open source encoding tools that can literally do everything in the right hands. As with most open source projects, they are not that polished and more geared for Linux users. One of them is mplayer.exe. The mplayer project can be found here:
http://www.mplayerhq.hu/
As you may have noticed, only the source code is available. Thankfully, somebody has compiled it for Windows and posted it here and lots of other places:
http://majorgeeks.com/MPlayer_d5663.html/
So it is possible to grab a frame from the stream as a jpeg using the following mplayer.exe command
I got this info from this guy:
http://www.infohit.net/blog/post/using-linksys-wvc54gc-webcam-with-linux.html/
I took this caputing a jpg from the cam one step futher. I wrote a .NET/C# app to execute a batch script (that contains the above command). This bascially creates a event driven web site that can display a still from the cam. This is a very rough app. This app requires framework 2.0.
This small (and terrible) little app can be downloaded here:
http://mystyleit.com/downloads\blogs\TerribleAdventureswithWVC54GCIPCam/poll.zip
Capturing a Video from the stream
The next thing I wanted to do with this cam was to capture a video at a specific time. This can be done through the Thick Client but I really don't like the included scheduler. I'd prefer to do it with a batch script stuffed into the Windows Scheduler.
Solution
A command line solution does exist using a open source project called ffmpeg. The ffmpeg project is located here:
http://www.ffmpeg.org/
Like mplayer this project doesn't come compiled (and not compiled for windows for sure). Luckily somebody else has compiled it and this is located here:
http://www.videohelp.com/tools/ffmpeg
Most of this cam from this post:
http://www.infohit.net/blog/post/using-linksys-wvc54gc-webcam-with-linux.html/
A asf file should be able to play in Windows Media Player without issue. I suppose you could re-encode the file to a mpeg or something else depending on your requirements.
Transcoding to Flash
This is where things go terrible. So what if you want to see the stream in a browser but don't want to install the ActiveX control? Well you can do on the fly transcoding to a different stream type, like flash
According to this this you should be able to open the asf stream in a embedded media player, but I was never able to make this work.
I believe this CAN be done through VLC but I have not been able to figure out how, or been able to find any posts about how to do this whatsoever. If anybody knows how please comment on this post or send me a message here. See link below for more information about VLC:
http://wiki.videolan.org/Flash_Video
If however you are game, this can be done through ffserver. To the best of my knowledge there is no port of ffserver to Windows. I am unsure if it can be compiled for Windows through Cygwin. I tried but get the same errors as everyone else. Ever post I found did not have a solution. If you are looking for a guide to proceed this is the best I have found:
http://www.infohit.net/blog/post/motion-capture-using-the-wvc54gc-with-linux.html
http://ubuntuforums.org/archive/index.php/t-665607.html
Here is a excellent guide on how to install ffmpeg (and ffserver) on a Ubuntu box:
http://ubuntuforums.org/showpost.php?p=6963607&postcount=360
If you can follow all that, if you add the following to your ffserver.conf file, you'll get a swf stream out that you can open in a browser.
If you put something like the following in a page, you should be able to open the swf stream:
See the following for more information:
http://ubuntuforums.org/showthread.php?t=665607
Again, I think it should be possible to do the transcode through VLC but I have not be able to figure it out. Hopefully somebody can post some tips about this.
Running FFMPEG using a Script
The FFMPEG process needs a terminal to run. In addition it seems to crash every 5 to 6 hours. Ideally you would have a cron job to monitor the process but running FFMPEG in a script can be tricky. It can be done using the screen command.
Here is my cron job script which I have scheduled to run every hour. I kill FFMPEG because I found that sometimes the process was still running but not working. This way I can ensure that I will always get a stream.
Conclusion
Streaming media is complex. I much prefer web and app servers!