Error message

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 915 of /var/www/

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  With the script in that blog post, converting an FLV to MP3 is as simple as this:

$ [sudo] npm install flv2mp3 -g


$ 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');
.option('-f, --file ', 'FLV file path')
.option('-o, --out [path]', 'Output directory')

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.