Tuesday, May 25, 2010

Depressing

This was kind of depressing. It arrived in the mail addressed to me. I'm not ready.

I guess this is what happens when you join AARP and they sell your name to mailing lists. Actually, I'll bet that you could get rid of a body for $255 if you wanted to.

Tuesday, May 11, 2010

Sermon Videos

The following is not meant to be read as much as it is to document some of what I've been up to over the last year or so.

I'm gonna talk a little about a small project that I've been working on for the last couple of years. It has turned out to be a bit more complicated than I thought it might be and I'm still working to make it better. It has to do with putting video on the web and, in this case specifically, video of sermons. That's church sermons for you heathens out there, not the sermons you get when your wife catches you drinking milk directly from the carton instead of using a glass.

Anyhow, a little over two years ago, after I became an elder at our church and somehow got conned into being chairman of the Worship & Music (W&M) committee, a panel was set up at the church to figure out what the church might do in the event of a pandemic. Bird flu was the scare at the time. Our committee (W&M) was instructed to respond to the Pandemic panel with recommendations of what we might do, as related to the worship service. We decided that we would probably do whatever the University did, since they were smarter than us and we didn't want to spend a lot of time thinking about it. However, our preacher said that he would keep on preaching even if no one came. At about that same time, we had the Fall "request for proposals" from the endowment committee and our preacher decided that if he was going to keep on preaching and no one was gonna be there to see him, we might just record the service and figure out how to get it to the people suffering from bird flu, who were skipping church. Maybe we would use the internet for distribution. So I wrote a proposal and asked the endowment committee for some money for a camera and recording setup so we could get started. We asked for three and a half grand and they gave us most of it. My estimates said that this should be enough.

Basically, we wanted a PTZ (pan, tilt, zoom) camera, a DVD recorder, a monitor and installation which would involve integrating the church sound system with the DVD recorder. A PTZ camera is capable, via a remote control or computer control, of moving around and zooming in and out. Most allow presets so that you can go from one position to the next by pushing a numbered button.

So with money in hand, I went looking for quotes. I asked the guy who owns the company that handles the sound system for the church and I asked a company in Durham that I had talked to briefly when writing the proposal. Both came back at around six to seven grand. Ouch! So I went back to both of them. The sound system guy wasn't ready to talk about changing things and had different ideas on how we might be using this setup. The guy from Durham was more flexible and said that his quote was for a high definition camera and that for a standard camera it would be about three grand. So we went with him. By the time I decided to go with the guy from Durham, I probably knew these camera systems as well as most people alive and I still didn't have a good handle on this stuff.

One thing that I was interested in was, rather than recording to DVD, I wanted to record directly to a computer. Neither company had much idea about how to do this or interest in figuring it out. Most modern (read digital) video cameras like mom and dad take to the soccer match will do this, but as it turns out, none of the PTZ cameras, which are almost all analogue will. So for a start, we just record to DVD using a DVD recorder. The DVD recorder takes the analog signal and digitizes it and writes it to a DVD in a format that everyone can play on their DVD player, but that is not easy to edit.

Anyhow, after a number of delays from me doing extensive research and the guy in Durham having hernia surgery, we signed the deal and got the camera installed. We installed the camera on the wall of the balcony on the opposite side of the church from the pulpit. Someone (I think he was retired from Kodak) told me you should never point the camera directly at your subject but at a slight angle. I had done a little research and figured with 18x optical, I could get a decent shot of the pulpit without going into the digital zoom range. As we all know, digital zoom is not zoom at all. The camera we installed is a Sony EVID70/W, shown here:

It's actually mounted upside-down. Some little wires run from the camera into a closet in the balcony. One wire sends power to the camera. Another wire allows one to aim the remote at a little box which sends the remote instructions to the camera from within the closet and another wire sends the camera's video signal into the closet. In the closet is a little table on which sits a Toshiba, DVD recorder shown here:
The wire carrying the video signal from the camera and the wire carrying the audio signal from the sound equipment at the other end of the church connect to the DVD recorder. To monitor it all, the DVD recorder sends out audio and video to a Polaroid LCD TV like this:

I can't figure out why they used a Polaroid TV. I didn't even know they existed. Maybe it was cheap.

I was capturing the sermons on DVD for a couple of months and storing them away. Occasionally I would get someone to move the camera around as the service proceeded, but it was hard to get anyone regular so I mostly just left the camera aimed at the pulpit. I sing in the choir so I can't do it. After a few months, the preacher asked me about putting the sermons on the internet. So I looked into it. As it turns out, there are a few problems doing this. The biggest problems are video file size and video format, which are related to each other and impact cost. I was determined to do this as cheaply as possible and still get as high a quality as possible.

The first problem with putting sermons or any video on the web is file size and the length of time that it runs. Currently, Youtube has an eleven minute time limit. So to use Youtube to store and present the files would require watching a 20 minute sermon in 2 parts. You would also lose control of the content. Not acceptable, even for free. There are now some new places that will host video, but you still lose control and have extraneous logos showing up with your videos. So I decided to look into finding a hosting company that would allow the big files.

Before I could actually look for a hosting site, I needed to figure out just how big the files might be and, to do that, I needed to figure out how to handle them. Or, what kind of format or file type would I use. As it turns out, this is extremely complex and all you can do is make some decisions and compromises based on what you can read and find out. The bottom line is that raw video takes up huge amounts of space (1 min of Std TV = ~3 GB) and to store it or transmit it, you have to compress it somehow. The way compression works is that you start with a picture and only save the changes from frame to frame. But to really get the file size down, the compression also has to toss out a lot of data without horribly degrading the quality. The compression tries to throw away as much as it can without you noticing. Finding the best way to do it is insanely complicated. The computer algorithms used to do this compression are called codecs. If you want to know more you can read about it here. I decided to store the files in an MPEG-4 (.mp4) container and compress them using the h.264 codec. Why? It's too hard to explain except to say that I thought this approach would work the best for the future. As browsers become more standards compliant, this approach would continue to work. This approach also is more likely to come from a Mac fan than a PC fan. There are a number of Microsoft approaches that sort of lock you in to Microsoft. I wanted something a little more open that would run on all computers.

So I looked up how to get video files off of DVD's and into a format that you can use on the web. There are some very expensive programs that will do this but it turns out that there are a few popular free programs that will also do the job. The two best are "MPEG Streamclip" and "Handbrake". I downloaded them both and couldn't get either one of them to work. Turns out that you need a license to read a DVD at the bit level. However, you can buy a license from Apple for $20. I don't think Apple owns the license. I think it's owned by a consortium that Apple is a part of and so most of that money to license the codec that allows you to read the MPEG-2 files (container and codec) on the DVD, goes back to the consortium. I think it might be the same consortium that owns the h.264 codec mentioned above. Anyhow, once you buy it (the license is a little piece of software) from Apple, they keep a record of your purchase and if you lose it, you can always go back and download it again without charge.

As an aside, the licensing and ownership of these compression codecs is a real big deal to anybody associated with the internet such as all hardware and software companies but also includes the communications and entertainment industries. It's a big hairy complicated deal, which means it involves a lot of money. But enough of that.

So I started playing with the MPEG Streamclip program. I pulled sermons off the DVDs and played around with the size (how big on the screen) and the amount of compression. Basically, this is all about the art of compromise. The program has this vague slider labeled quality. The higher the quality, the larger the file size.


There are lots of other parameters to set and each button opens up a whole bunch more parameters to play with before you hit "Make MP4". What I do is this. I import the sermon off the DVD, then I export a .mp4 file at 640 x 480 (standard NTSC TV video) with 50% quality setting. I change the audio to mono (since that's what I started with), lower the bit-rate and boost the volume by 10 db. I save these files (~120-180 MB) for posterity and then run them back through to get a 320 x 240 size file which is usually around 45 to 60 MB. So that's a small picture that still looks OK. The .mp4 files contain audio and video. While I'm at it, I also export a .mp3 audio file (20 MB). It takes something like about half real time to do each step. So it takes about 10 minutes for each pass on a 20 minute sermon. That's with a 2007 iMac (2.4 GHz Intel Core 2 Duo).

If you look at a lot of videos on Youtube, the compression is often substantially greater than I'm doing and the videos show it. However, you might notice that newer videos are showing up with a higher quality option. This is because disc space is getting cheaper and internet speeds are getting faster for a lot of people.

So now I know that I want to store around 75 MB (audio and video) a week. And I'd like to have about a year available online. So do some math and that's 3.9 GB/yr. I own a small company and it has a website. The company that hosts my site also hosted the Obama campaign. They're pretty reliable. With my cheapo account, at $10/mo, they only allow 250 MB. The $50/mo plan allows 4 GB. That's expensive. I looked at the hosting company that the church uses for its website. They were more expensive and now they don't even list prices. Call us they say. So managed hosting with good support is out. I think they charge a lot because they can and they assume that you're gonna get a lot of hits (bandwidth). Actually I need lots of space and, probably not much bandwidth.

So now we're back to the art of compromise. There are a lot of cheap sites out there that say unlimited bandwidth and unlimited storage. They all have little asterisks on their ads. So I look at a lot of them. There's a large variety but one thing they have in common is that they all look shady or maybe fly-by-night. The wording around "unlimited" is all kinda wishy-washy. However, about this time, I was unemployed and taking some computer courses so that I could start getting unemployment. I was taking courses on "PHP and MySQL" and needed a hosting company that allowed me to play with and learn both of these. PHP is a programming language for web sites that runs on the server and MySQL is a database that also runs on a server. They're often taught together. Anyhow, I thought about this hosting thing a lot and finally, I decided to go with the biggest of them all, GoDaddy.com. At $6.99/mo, I got the Deluxe Plan with only 150 GB of storage. The unlimited plan was $14.99. You've probably seen the really tacky GoDaddy ads on TV. They had a couple during the Super Bowl. Lots of tacky sophomoric T&A stuff. I think they were voted the worst of the lot. I already had an account with GoDaddy because I had used them to register some domain names that we were thinking of using for the company that never quite came to be. So all I had to do was add on the hosting. So I did. Part of the compromise is using a company with such tacky ads to host church sermons. But I do like the irony.

I used the Godaddy account to learn a bit of PHP and MySQL as I was taking a couple of online courses from Durham Tech. I did a couple of web sites for practice. One was a recipe exchange site that was part of the PHP/MySQL training and another was a rewrite of a friend's web site. I did a lot of work on it but he never got around to using it, which was a little annoying. I also rewrote my company web site using PHP and added a chemistry reaction calculator which utilized PHP, MySQL, JavaScript and CSS and XHTML. But that's all an aside for now.

As I mentioned, I was collecting the services on DVD every week. I have the DVD automatically record the 11 AM service each Sunday and after three services, when the disk is full, I take the disk home and pull out the sermons, convert them to regular size .mp4's and then exported the smaller .mp4's and .mp3's. The video camera stays on the pulpit for the entire service. With the video in hand, I bought the domain name of our church with the ".com" rather than the ".org", which they already owned, and carved out a place on my GoDaddy server for the church stuff. As it turns out, uploading big files from home is a bit of a pain. Three services of audio and video comes to around 200+ MB. If your ISP (internet service provider) is a cable company like mine (Time Warner's Road Runner), you get substantially faster download speeds than upload speeds. It's about thirty times as fast coming down as going up. You can check it out for yourself. What that means is that videos upload slower than real time and for some reason, maxing out your uploading capacity maxes out your internet connection. In other words, I have to wait till everyone else quits using the internet to do the uploads. I usually send them off as I go to bed. But my wife and son both tend to stay up later than I do, so even that causes problems. I need to find a much faster way to upload the files.

I've gotten tired of writing about this so I'm gonna wrap it up soon with a very condensed version of the last steps. Once I got the videos on the GoDaddy server, I would tell the lady at the church who handles the web site that they were there and she would set up a link. To play them it required that the viewer have QuickTime installed on their computer at home. This wasn't perfect. Eventually, using PHP and a bit of code that allows one to play an .mp4 file inside of Flash, I was able to simplify the experience. Just about everybody has the Flash plugin in their browser. So now you just hit the button on the church site and it loads up the file. And more recently, I've started uploading the larger video files instead of the smaller ones. Anyhow, the final result can be seen at the church's site or at my site.

Eventually, I may flesh out this last paragraph with some detail about how the battle between Apple and Adobe is raging over HTML5 and Adobe Flash with Google and Microsoft and everybody else chiming in and how this will impact everything we watch and listen to in the next 10 years. But not today.

Friday, May 07, 2010

Roller Coaster Ride

The last couple of years have been a little worrisome. As it turns out, the career path that I chose for myself about 35 years ago has just about evaporated over the last 10 years. Two things have happened. There has been tremendous consolidation in the pharmaceutical industry and there has been a wholesale swapping out of the chemistry research labor force from an fairly diverse American base to a less diverse Chinese base at about 1/5 the cost per person. As a chemistry researcher, I got consolidated and swapped over a year ago. But that's not what this is about.

I recently found a part-time, work-at-home job as a Scientific Review Officer. I work for a company that manages the review of proposals submitted for research grants issued by a federal program run through the Department of Defense. Most of the funding is related to breast cancer research. Anyhow, what that means is that I'm at my computer a lot during the day. But that's not what this is about.

Not being from the landed gentry, over the years it became apparent that If I didn't want to eat dog food for the last few years of my life, I needed to save a bit. So I have tried. As it turns out, I've tried to take a long view of things and rather than put all my savings into mattresses or mason jars, I've put a good chunk of it into the stock market. I'd say it's about 2/3's in indexed mutual funds of various kinds including broad market, small cap, international etc. About a 1/3 is in various stocks that I or my wife have picked up over the years. Warren Buffet is handling about 8%. A little investment in Apple 21 years ago has grown to about 10%. There is a spattering of bonds and cash thrown in for good measure.

So, I watch it. Daily. And I track it. And I measure it against other indicators. I look for correlations and causes and effects. I am a scientist after all. The one thing that seems to remain fairly constant is the ratio of my net worth to the Dow. I guess it makes sense.

So the point of this story is that I was sitting at home at the computer yesterday, working at recruiting scientific reviewers as part of my part-time job and watching the stock market every once in a while. It's not been so good for the last week or two. Quite volatile and mostly down. I follow the market on the Google Finance page. Around 2:30 it was looking like another bad day with all the leading indicators pointing down. To get the latest numbers, I often hit the refresh button. Around 2:40 I hit the refresh button. Wow! It dropped from -300 to -400! I hit refresh again. Down another 100! Again. 150 more! Again. Another 150 or so. The market was in free fall! This was crazy. While this was happening, Apple was also dropping like a rock, only faster. Then I got excited. Buying Opportunity!!! Well, as the Dow hit down about a 1000 points, and Apple dropped below 200, everything basically quit working. It took forever to log into Fidelity and even the Google Finance page was refreshing real slow. And just like a rubber ball hitting pavement, all the indicators started moving up again. And unfortunately, just like a rubber ball, they never came back up to where they were dropped from. So the bottom line is that I didn't do anything. I just went along for an exciting ride.

Saturday, May 01, 2010

Bird Update

Time for a bird update. Look down to see previous posts on this subject.

There was some discussion between me and the wife about whether my new varmint barrier was far enough out on the post to deter would-be predators from getting to our new bluebird house on the swing set. We hadn't seen the original bluebird family around for a while. After a few days of inactivity, my wife ventured out and opened up the birdhouse. Inside was an empty crushed egg. After a few minutes on the web, she determined that squirrels do indeed eat bird eggs and that a squirrel was the culprit. So she removed the nest and cleaned out the house. I came out and took the hammer to the barrier to loosen it. I then moved it further out on the post so that an animal would have to be a bit more adventurous to get to the house.

And after a few days, we were back in the bluebird family business. I sneaked out and caught a few pictures. It's hard to get close enough to get a good picture of daddy bluebird before he flies away, but I finally got one this morning. Here tis:


Notice that the critter barrier is further out on the post. As I tried to get closer, he flew away but I got another shot of him in the tree.


We'll keep you posted.

note: Since I posted this, my wife told me she has seen a squirrel on top of the birdhouse since I moved the barrier. Hmmm!