Maybe you can take advantage of what others have already done.
HeyWatch is an online encoding service with a REST API. Just an idea, I haven't used it.
I've also been told that
ffmpeg (encoding) and
flvtool2 (metadata) work well together. Again, I've no first hand experience with them, but maybe they're something to get you started.
[ December 30, 2007: Message edited by: Pauline McNamara ]