There's also VP9 and AV1, which are more modern, royalty-free options that you can consider as well.
And containers are not patented - you can still use MP4 as long as you're not using a proprietary codec. But MKV is indeed superior, and WEBM is also nice as it only supports royalty-free codecs.