Candy Cam, Part II: Audio & Video
If you haven't seen it already, check out Part I about Seven's Candy Cam
Since the original idea was just a bell and a camera to watch Seven, I decided to get one of those indoor/outdoor "security" cameras with the IR emitters. That way at night with the lights off Seven would still be visible.
The security cameras output an NTSC composite video feed which doesn't hook directly to a computer. Fortunately I had a KWorld USB thingamabob around which, besides having an ATSC tuner, has S-Video and Composite input. I wasn't sure if the device would be supported on Linux, and since my Linux laptop is old and slow anyway, I chose to use Windoze for the camera.
In the past when I've setup a video feed I always had everyone connecting to my computer at home. Of course that quickly saturated my bandwidth. In this day & age I expected there must be an easier way than me setting up some relay off another of my servers on a fast connection. A quick google search turned up several possibilities. The top of the list was Ustream so I gave them a try. They are free and I liked how they had somehow managed to get Flash to handle everything so I didn't have to install any software. The downside was that they had no way to let me choose which input I wanted to use on the USB capture card. It took quite a bit of battling with the crappy software that came with the USB device before I was finally able to get off the tuner and choose the composite input. Once I did that Ustream was up and running and streaming my camera.
The night vision on the camera didn't work very well though, it tended to make a bright spotlight right in the center. Plus being a cheap camera the colors were very washed out even during the day. The next morning I got out my old Sony Video 8 Pro camera to see if it would look better. It looked a lot better. But unfortunately it had a narrower field of view and I had to set it up right in front of a doorway in order to use it. I had to rearrange the entire dining room in order to turn everything so I could get a good angle with the camera. I also now have to leave the dining room lights on constantly to provide enough light for the camera. Fortunately they are compact fluorescents.
After adding Elmo to the display, I realized I was going to have include audio in the stream. The security camera I had picked up also has a built-in microphone. I patched the audio into the USB capture card too, but because of some bug in Windoze, Flash, or the Ustream software, I couldn't choose the USB device as the audio source. After repatching it into the laptop's built-in sound card I had the audio up and running too.
Elmo however is quite loud. Obnoxiously loud. Plus having the microphone picking up any noise around it bothered me a bit too. In order to deal with both problems I picked up a cheap 4 channel mixer from Radio Shack. I disconnected Elmo's speaker and tied it directly into one channel. I also did the same with Santa. The output was patched straight into the Windoze laptop's sound card. This also had the advantage of making Elmo slightly more understandable in the video stream. Elmo's circuitry tended to cause a lot of pops and clicks on the audio feed though when he wasn't talking. The quickest way I could think of to deal with it was to play music in the background. I patched the output from the Ubuntu laptop and started up a CLI based mp3 player called mp3blaster. Once the music was playing the pops and clicks were much less noticable.
One of the things I lost by removing the microphone was the jingling of the bells. The sound you hear now is simulated. When the program triggers the LEGO to jingle the bells, it also plays a sound file so that the video stream hears bells too. I still need to digitize my pachinko machine hitting a jackpot and play that when the candy machine is triggered.