I think youtube use on2 video codec, that is costly.

You can also use h264 codec, that work with ffmpeg. But again it is not completely free to use.