Converting FLV to MP3 using ffmpeg and the Node.js commander package

I just read this blog post saying that while Node.js has the stereotype that it's not for heavy number crunching stuff like video conversion, you can do video conversion anyway.  (see http://www.hacksparrow.com/flv-to-mp3-converter-in-node-js.html)  With the script in that blog post, converting an FLV to MP3 is as simple as this:

$ [sudo] npm install flv2mp3 -g

Then

$ flv2mp3 -f jump.flv
$ flv2mp3 -f ~/dwhelper/jump.flv -o ~/mp3s/

Intrigued I found that the source of this script used, under the covers, as expected, the ffmpeg command line tool to do the heavy lifting.  Hence, the claim that you could do heavy work like video conversion in Node wasn't proved by this.  But what was interesting was the implementation.

...
var program = require('commander');
...
program
.version('0.0.2')
.option('-f, --file ', 'FLV file path')
.option('-o, --out [path]', 'Output directory')
.parse(process.argv);
...

Commander is well worth exploring because it looks like it makes it trivial to implement command line tools.  Looking through the examples it appears straightforward to implement two sorts of command line options processing, those with "-" for options, and those where the second word on the command line is a subcommand name.