Since the conversion has to happen on the server side, you can only do this after the download is complete. HTML5 works fine, but does not support video transcoding.
I would suggest taking a look at ffmpeg, it is an extremely powerful command line utility that allows you to transcode your video with maximum accuracy, because youtube uses this to convert your video.
This is a free tool, and there is more than enough documentation to get you started http://ffmpeg.org/
source share