Putting the final touches on the scripts and processes to do the time lapse, and webcam capture. There is quite a bit of detail that is behind the scenes to make this work as none of the systems I am using are meant to do what they are doing.
Some insight:
Basics:
The camera (a free Microsoft LifeCam Cinema I had laying around) is connected via a 35ft USB active power extetion cable, to a small Intel Atom based “server” (that runs as an ISCSI SAN for my lab).
The Atom box runs WincamXP Private to do the image capture. It captures a single image and uploads it to my web server (either my internal one here or my hosted one in Houston). That is the generic webcam still image. That is about where the software stops doing what its supposed to. The stills are 1280×800 (a bit taller than 16:9)
The LifeCam was never even supposed to work on Windows 2008 R2, I had to hack the MSI, and INF files to get it to install and operate as expected. That took almost a day on its own.
Another basic hurdle was, that the app wont work with the camera if you RDP onto the desktop. I had to use LogMeIn to do the work as that is actually using the physical console and not an emulated remote desktop session. If I used RDP, I was unable to get the app to connect to the camera.
Time Lapse:
To do the time lapse, lots of fun stuff happens. I am using the Gallery function in the software to capture up to 2880 (30seconds x 24hrs) images and overwrite as needed. These images are named a crazy string that is ordered by date, camera, etc…
I use a piece of software called IrFanView and scripted a process to copy all JPG from one location, rename them sequentially (Pict####), and drop them on another file share.
With each image being 200 – 250K, to do the next step was taxing the Atom processor, so I have all the IrFanView tasks, and upcoming ones happen in a VM on my Dual Xeon server. (which brought the time for all the steps here from 10 minutes of processing, to 3)
On the processing VM, I have a scheduled task with a number of items in it. First one is to run the rename process above. The second step is to run a two pass FFMpeg routine to merge the now sequential JPG files into a single h.264 compatible mp4 file at half resolution (640×400).
The FFMpeg routines happen in two steps, 2 passes. So the tool is run twice, this gives better quality,and smaller size.
Once that is done, I have a upload script that also loads that finished file up on my web server.
I have this whole routine setup to run every 1 Hour. (was going to do it only every 12, but since the systme handles the load so well, why not do it more often?)
One quirk is the camera’s auto exposure is not fine grained, so you can see the big bumps up and down in exposire at dawn and dusk… a little annoying, but its a free camera, so I’ll live with it 🙂
Tumblr:
To Get the time lapse to view and play properly across a wide range of systems I chose to insert HTML5 code to handle this. No Flash, no javascript, etc… just straight up HTML5. The code couldnt be easier. After doing reading on the attributes for the <video> tag in HTML 5, the biggest issues was defining the proper codecs you need to list.
I was able to easily get this text into the Tumbler page, and it plays like a pro, pulling the .mp4 file from my web server.
Final:
Since I haven’t used HTML5, IrFanView, Webcam XP, FFMpeg, or any real hacking in Tumblr before… this was quite a fun experience. Only issues I have with this right now is trying to ID any app crashes that happen (as I am pushing Webcam XP pretty hard, I had it crash once today). I have tasks setup to watch for a crash, and restart the app if that happens, and email me if it does. Just for kicks 😉
I have 1 camera currently, but the license for Webcam XP lets me link up to 5 IP and hard connected cameras, so I am pondering a few more to mess around with.
I also have 1 image being captured and put in a seperate directory at noon each day, hoping that after a year, I could have a fun little video of the seasons of CO.
If anyone needs more info to do a similar implementation I would be happy to supply more details, just ping me.
Leave a Reply