OGG Theora Converter

John Gruber today opines that there is no GUI interface for the command-line tool for converting Quicktime movies into the OGG Theora format — a very handy thing to be able to do if you want to serve video to Firefox-type browsers using HTML 5's <video> and <audio> tags.

Since this is something I do a lot — wrap command-line tools in Automator wrappers, that is — I thought I'd whip up a GUI method for doing this. So here it is.

The OGG Theora converter

It's a Finder workflow, so download it, unstuff it and put it in:

~/Library/Workflows/Applications/Finder

Placing the workflow there will add the item to the Finder's right-click contextual menu. To use the workflow, simply right-click a video you want to convert, navigate to More->Automator and choose "Convert To OGG" from the menu.

Ogg Converter Workflow

While this crunches you'll see a badge in your menubar:

Menubar Progress

Wait a few minutes and you'll see the OGG version appear right alongside your original movie.

complete

And remember, you must first install the OGG Theora converter tool, ffmpeg2theora, for all this to work.

I've made a droplet-style version of this as well. Place this version anywhere — your Desktop, the Applications folder, your Dock — and when you want to convert a video, simply drag the video onto the droplet.

Enjoy!

UPDATE:

Folks, for those of you having trouble installing the workflow version, here's a tip, as mentioned in the comments: Double-clicking the unstuffed workflow will open it in Automator. From here you can choose File->Save As Plug-in...

Installing Workflows the Easy Way

Make sure it's a Plug-in for: Finder, and hit the Save button. It should now show up as an option in the Finder's contextual menu.

And remember, there is a Droplet Version as well whose installation is drag-and-drop. To anywhere!

Hope that helps!

Drives Die

So we had yet another calamity in the Systems Boy household last week: A hard drive failure in a four year old, 15" PowerBook. Oddly, a workmate had the exact same thing happen to him within days of our catastrophe. In fact, there's been all manner of hardware failure in recent days. I know that drives are prone to dying after a number of years, but geez! It sure seems like lately there's been a steady shit stream aimed squarely at the tech fan. Makes me ponder the more cosmic aspect of this biz.

[Gazes dreamily off into space for a moment. Then abruptly snaps to.]

The trigger for this failure, ironically, was our attempt to make a backup. (Oh, technology gods, thou art a riot!) See, our original goal was to update the OS to Leopard, but with all the craziness going on these days we decided to clone the drive before we proceeded with said update. But in the course of cloning, it would appear in retrospect, we hit a bad block and triggered the first of what would be many, many disk errors. Unable to pull a backup, we began our descent into drive repair hell in our latest heroic attempt to salvage that ever-important thing contained on and lost from drives: the data.

File-Level Attempts

Our first try was with Disk Utility, which consistently reported, in all red text, that it could neither verify nor repair the file system. Right. On to attempt number two.

Disk Warrior is my go-to utility for any sort of file system damage that Disk Utility is unable to repair. I've rarely seen a disk that one of these two apps couldn't fix. Today would be one of those rare days. After mounting the drive on a known good system using Target Disk Mode, we let Disk Warrior perform its initial scan of the drive. What we found was decidedly ugly. Disk Warrior told us that it was unable to replace the borked directory with its shiny new, replacement directory because of a "disk malfunction."

That's when we knew the drive was fried.

Disk Warrior Report: Bad News

When a hard drive has problems, 99% of the time those problems are directory related. That is, the hard drive contains data about the files on disk — where they belong, how many there are, how the disk is partitioned and so on. And usually, when there is a problem with a drive, it is because this information has been corrupted somehow. These days there are numerous utilities that can easily and accurately repair these sorts of problems, Apple's included Disk Utility among them. Sometimes the damage is too extensive, though, so we turn to something a bit more drastic, like Disk Warrior. Disk Warrior forgoes the repair, and instead scans the disk and creates a brand-spankin' new directory, replacing the broken one with its new one once you've made sure everything is cool, and perhaps made a backup. Now, when Disk Warrior is unable to do this it's indicative of a much more serious problem. When this happens it is very likely that the drive hardware is beginning to fail.

Time for a new drive.

What Disk Warrior does in these instances is it shows you the best picture it can muster of the drive's contents in a read-only preview, and then advises you to backup as much as you can before total failure. So that's what we did. You're never sure how much time you have in these situations, so we went through folder by folder trying to locate and backup the most important files first. With each successive copy the drive became slower and slower. Luckily, we were able to pull the most recent, most important files. Most everything else was backed up or able to be easily reconstructed.

Block-Level Attempts

Once we had gotten the most important stuff we decided to see what else we could get. I tried running some rsync commands and got some stuff that way, but not much, and it was taking forever. Once I'd given up trying things at the file level, I decided to make my last ditch effort with a well-worn but powerful little UNIX command called, simply, dd. (No, it does not stand for "Drives Die," though maybe it should.)

The dd command reads data from a disk at the block level and copies it from standard input to standard output which can then be written to a file of your choosing. I use dd by running it on the /dev entry of the drive in question and writing the output to a disk image file (DMG):

sudo dd bs=512 if=/dev/disk3s3 of=/Volumes/Work/LastDitch-DD-01.dmg conv=noerror,sync

The good thing about dd is that you can instruct it to skip damaged sections of the disk. That's what the "noerror" option is for. The downside to dd is that it wants to read the entire disk, and that makes it very slow. In this instance I was not able to rescue any data, mainly because, as I soon discovered from my dd runs, the disk was just too far gone. I did learn some interesting strategies for using dd to recover data though.

The first thing you can try if dd is running slowly is to increase the block size. This is how much data dd will consider before moving to the next read. The default is 512 bytes. I've read upping that to 51200 will sometimes yield speedier results:

sudo dd bs=51200 if=/dev/disk3s3 of=/Volumes/Work/LastDitch-DD-02.dmg conv=noerror,sync

In my case it did not, primarily, I believe, because there was a problem in the beginning of the drive, and dd was having trouble moving past that spot. So another thing you can tell dd to do is to skip a certain portion of the drive, say the first 2 GBs:

sudo dd bs=51200 if=/dev/disk3s3 skip=2000000 of=/Volumes/Work/LastDitch-DD-03.dmg conv=noerror,sync

Finally, you can also tell dd to only write in 1 GB chunks, using the count option:

sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=2000000 of=/Volumes/Work/LastDitch-DD-03.dmg conv=noerror,sync

I was getting some good results after having skipped the first 2 GBs — apparently they were really damaged — so I decided to write a script that would skip the first 2 GBs and then begin writing out 1 GB chunks of data. It would've looked something like this:

sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=2000000 of=/Volumes/Work/LastDitch-DD-Chunck-01.dmg conv=noerror,sync

sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=3000000 of=/Volumes/Work/LastDitch-DD-Chunck-02.dmg conv=noerror,sync

sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=4000000 of=/Volumes/Work/LastDitch-DD-Chunck-03.dmg conv=noerror,sync

...

Etc, etc, up to the 40 GBs needed to scour the drive. I never got to write the script, though, because the last dd command seized up and the drive began making the clicking, knocking and whirring sounds of its agonized and tortured death. It was quickly dying. We could do no more.

At this point, mainly for my own edification, I decided to see what could be done outside the confines of my home office. I decided to get a quote from Drive Savers.

Hardware-Level Attempt

Drive Savers, perhaps wisely, does not list prices for their services on their website. To get an estimate you have to give them a call. When I called them I was greeted by a very friendly and helpful service person — yes, person — which was really nice. The last thing you want to deal with when you're having a mechanical failure is a machine. The person on the other end of the line asked me a few basic questions to gauge what state the drive was currently in, things like what attempts I had made to rescue the data, would the drive mount, and the like. After entering this info into her systems she directed me the "Tips, Techniques and Solutions" page on their website (very useful — love the drive sound audio samples), stressing above all that in order to have the best chance of recovery at this point the drive should not be powered on again. She also offered up some information about the company and what they do: For one, they started with Mac data recovery and are an all-Mac shop, which surprised me a little. She also pointed me to information on the Drive Savers clean room, a vital part of data recovery at the hardware level. She then took my email and contact info and gave me both a written and verbal estimate of how much I could expect to spend should I decide to go ahead and have Drive Savers attempt to save my data (I don't think they'll actually save the drive). All in all it was a very pleasant and informative experience. Normally I am loathe to use the phone for business, but Drive Savers really seems to know what they're doing, at least when it comes to pre-sales customer service, and that counts for a lot in my book.

This is, of course, all prep for the fact that, if you do want to make the attempt at data recovery, you'll be expected to drop a significant amount of money. This is hardly surprising. Those clean rooms don't look particularly cheap to build or maintain. And if data recovery at the hardware level is anything like it is at the software level, it is a laborious and time consuming process. I was given a range of prices ($500-$2700 dollars) and told that the cheapest I could expect to get away with — the economy plan, which isn't as fast as some of the other, more expensive plans — was $500 dollars. But it was likely I'd pay somewhere closer to the upper third of the range, more like $1500 to $2000 dollars. It all depended, of course, on how much data Drive Savers could recover.

I didn't really find these prices particularly surprising. I'd long heard how much such a recovery could cost. That it would be pricey. I was glad that I was not in a situation that required me to fork out this amount of money. I'm glad such a service exists for the odd catastrophe, though I hope never to have to use it. Drive Savers' website offers advice on keeping backups:

"Backup strategies:

* Invest in redundant backup systems

* Establish a structured backup procedure to make copies of all critical data files, using software compatible with the operating system and applications

* Periodically test the backups to verify that data, especially databases and other critical files, are being backed up properly

* Keep at least one verified copy of critical data offsite"

Sage advice, all. Take it from those who know all too well.

The Belly of the Beast

Once we'd decided not to use a hardware data recovery service the only thing left to do was spec out, buy and install a new hard drive. This wasn't terribly difficult, but as is so often the case, there was the odd snag or two.

Before we even bought a drive, I wanted to see how hard it would be to open the PowerBook for servicing. If it was going to be a bear — and some PowerBooks are certainly easier to crack than others — I'd let the fine technicians at Tekserve do the job. So I went in search of manuals and instructions for this particular model of PowerBook. Without too much trouble I was able to locate, at Apple's site, the manual for our 1.67 MHz, 15" Aluminum PowerBook. It contained no instructions for hard drive replacement, which is generally a sign that Apple would rather you not attempt the repair yourself. That got me a little worried.

Finally, however, I found instructions — great instructions, no less — at the venerable — awesome, actually iFixit.com. iFixit, for those of you who don't know, provides step-by-step, illustrated guides on taking apart and performing repairs on Apple hardware. For free. They're amazing. I feel guilty not buying anything from their site. Oh yeah, they also sell parts, tools and service as well. I love them. And from what I could see, the repair would be tedious — lots of screws — and would require a trip to the hardware store — blasted tiny hex screws! — but it would be doable. Still, taking things one step at a time, I thought I'd perform the teardown before buying the drive. Just in case.

And perform I did. Using iFixit's excellent guide, I was able to crack the PowerBook in short order. I was ready to buy a drive.

Buying a Drive

There are two things SysAdmins typically are, particularly when it comes to technology: cheap and lazy. Hunting for a replacement drive brought both of these qualities in my personality to bear. I was looking for the cheapest replacement I could find, at the location closest to my house, a SysAdmin's dream hunt. The closest proper computer tech shop to me is Tekserve, with Best Buy a close second. Tekserve doesn't list what bare drives they carry, if any. But Best Buy seems to have the goods. But Best Buy is still a good half hour train ride, so I did some physical recon at my nearest Radio Shack, which happens to be right around the corner. They informed me that, though they did not have any bare drives in stock, they did have portable USB drive on sale. Drives from which I could pull and the internal component and install it in the now drive-less PowerBook. In fact, they had a 160 GB Iomega Prestige for less than a bare drive would have run me at Best Buy — a mere $75 clams post-sales-tax. Not bad. I took it.

I'd like to pause here and see if anyone can guess why this didn't work out for me. You have pretty much all the data you need in this article to figure it out. But don't feel bad if you can't. The good lord knows I surely didn't. I'll wait a minute... Pretend there's Jeopardy countdown music playing... Aaand...

Okay. Did you guess it?

I got the drive home, popped it out of its case and went to put it in the open PowerBook. But it didn't fit. (Have you guessed it yet?) Here's the thing: PowerBooks use 2.5" ATA drives (Parallel ATA, or PATA), but drives in today's externals are all now SATA (Serial ATA) drives. Blast!

Oh well. At least it was cheap.

Another quick look at the web revealed that all the bare drives at Best Buy were SATA as well. Blast again!

The nearest ATA drive I could find was at J&R, which is all the way downtown, almost at the very tippy-tip of Manhattan — far. So that's where we went.

Once we got back, we installed the drive and — the very first thing to go right all day — it worked. Perfectly. Things were finally looking up.

Once we had installed the drive it was simply a matter of formatting it, installing the latest version of Leopard (which is all we ever wanted to do in the first place) and copying over the rescued and reconstructed data. Oh, did I mention that the reason the client wanted Leopard was for Time Machine? Yup. Backups. Great timing. So we set up Time Machine as well. All that went exceedingly smoothly and our repair is, at last, complete. Whew! What an ordeal!

But, man, did I ever learn a lot.

The Life and Death of Hard Drives

So yes, drives die. How they die, though, is almost as important as how they lived, and certainly as interesting. It's somewhat comforting to know that this drive, while quite dead indeed, did not die in vain. Rarely have I had the opportunity to learn so much about practical drive recovery. I have that PowerBook drive — specifically its death, in fact — to thank for my lesson.

Experimenting with DokuWiki

Wikis are just one more thing I've always wanted to play around with. And my job has, once again, afforded me the opportunity to do just that. We're currently using an engine called DokuWiki, so I decided to kick its tires and see what it — and wikis in general — are all about.

DokuWiki's front page describes it thusly:

"DokuWiki is a standards compliant, simple to use Wiki, mainly aimed at creating documentation of any kind. It is targeted at developer teams, workgroups and small companies. It has a simple but powerful syntax which makes sure the datafiles remain readable outside the Wiki and eases the creation of structured texts. All data is stored in plain text files – no database is required."

No Database

That last little bit — the lack of a database — is actually one of the things that makes DokuWiki unique. It is both its strength and its potential weakness, and one of its defining characteristics.

DokuWiki

If you are looking to install a documentation engine for a small to medium-sized workgroup, it's true: DokuWiki is great. It's very easy to install and only requires Apache and PHP be running on your server. This means it can be installed on any Mac OS X machine without having to install or configure much beyond Personal Web Sharing. I say, "much" because you will have to activate (not install) PHP, which isn't too hard for savvy users, but isn't exactly mom-friendly either. Still, it beats having to also install and enable a database application like MySQL, which most other wikis require. So DokuWiki is relatively easy to setup.

That lack of a database is nice, in that it makes installation quick and easy. But it's also a potential drawback, albeit a minor one. DokuWiki writes all its entries to flat files and that could affect scalability, and to some extent performance, if your wiki ever became extremely large. The merits of databases vs. flat files for storing data are debated all over the Internets, but databases usually only offer a significant advantage when dealing with complex, relational data, and that advantage is usually only seen by the developer. For small to mid-sized or even large-ish sites, DokuWiki is great. If you’re worried your wiki might need to grow very large some day (like, to the point where load balancing across multiple servers is required, for instance — we're talking big!), DokuWiki may not be for you. Otherwise, the flat file system offers additional advantages, like easy-to-parse and repair backups, to name just one.

Wherefore Wiki?

That said, once installed, DokuWiki is very easy to use. It does use its own markup for page layout, but that markup is exceedingly sensible and easy to learn. My biggest stumbling block was getting started: How do you create a page? Well, once you know, it's pretty simple, but figuring it out took me a minute. The easiest way to create a page, is to navigate to that page. If the page doesn't exist, DokuWiki allows you to create it. See? Easy! Maybe too easy!

So what's it for? Well, I'll tell you, TASB was almost a wiki rather than a blog. While both are types of Content Management Systems (CMSes), and essentially do the same thing — allow a person to easily and rapidly build and read a structured store of text and media data — the difference is intent.

Blogs — and therefore blog engines — are geared toward personal, diaristic, periodic writing. They're usually organized chronologically, like a diary, and require no special markup when creating entries. Entries, once made, are rarely revised. One of the things I enjoy about writing this blog is that it's a bit more personal. It's a record of personal experience as much as, if not more than, documentation. So I stuck with using the blog format. I like to be chatty.

Wikis, on the other hand, are made to be accessed like a reference, like an encyclopedia, for instance. They're not chronological, but are usually ordered and read alphabetically; and wiki articles are made to be maintained and updated as information changes. Wikipedia is a great example of this. There is also a blog called the Tao of Mac that uses a wiki engine for content management, showing that, in the end, the two types of engines do essentially the same thing. They simply present different capabilities to their users based largely on the purpose of the site.

Conclusion

If you're looking for a quick, easy-to-use and easy-to-maintain storehouse of information (either for yourself, or for use with others), a wiki is a great thing to have. Need to document a procedure for your workgroup? Put it on the wiki. Need to let everyone know where that essential file is? Put it on the wiki. Just want to jot down some notes for the general use? Put 'em on the wiki.

After using one for a few days I can already see just how damn handy a wiki is to have. And DokuWiki is super-easy both to install and learn. If you just need something small to document procedures or productions — or if you're just looking to dip your toe into the world of wikis — DokuWiki is very nice indeed.

UPDATE:

I've edited the article for clarity and accuracy regarding the use of flat file systems vs. relational databases. Thanks to DokuWiki's author for pointing out the error.

Voice Control Surprise

I think the Voice Control screen on my new iPhone is damn pretty. I doubt I'll use it much as it tends not to work as well in noisy areas, and I live in one of the noisiest areas on the planet. But there's one nice touch that might make the feature that much more worth trying.

Voice Control

Holding the Home button on the phone for a few seconds produces the Voice Control interface. The nice thing is, it works even when the screen is locked. So it's pretty hands-free.

This may be obvious to some, but I, for one, was pleasantly surprised.

You may now go about your regular business.

Go on now. Scoot!