You'll need FFmpeg2theora for this.
The most basic way to do the conversion is:
But you can also choose the quality of the audio and/or video track:
The first parameter (-a X) sets the audio quality and goes from -2 to 10. The second parameter (-v Y) sets the video quality and goes from 0 to 10.