system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: What are the pros and cons of mp4, webm and HTML5 video formats? When to use one over the other?

As title. Does one format has a higher quality or compression that the other? What's speed/load difference? Which one would be easier to work with (editing)?
gpt
None of them are video formats.

MP4 and WebM aren't video formats, they're "container" formats. A container is just like a box you toss multiple kinds of data into to keep them all in one place -- kind of like a zip or rar file. When you have a video file, you usually have the video stream, audio stream, chapter index, subtitles, maybe menus, maybe *multiple* video/audio/subtitles. They're all in different formats -- the subtitles can be plaintext or transparencies, the video might be MPEG-2 or AVC, the audio might be MP3 or AC3. To wrap them up together in one file, synchronise timing between them, properly interleave the audio and video so the file is accessed linearly, etc you put them inside a container -- and that container is MP4, or MKV, or AVI, or MOV. But the container tells you nothing about what type, format, or quality of video data is inside. You can take the streams out of an AVI container and put them in a WebM one in under a second without touching the actual video data.

HTML5 isn't a video format either. HTML is a markup language used to write webpages; in HTML version 5, they added support for `<video>` tags. HTML5 video is just video linked in these tags and rendered directly by the browser, as opposed to the older system of using Flash applets to display video. HTML5 says absolutely nothing about the video or container formats used.

Examples of video formats: MPEG-2 Part 2 (used on DVD and TV), MPEG-4 Part 10 (used on Blu-ray, YouTube, and some TV channels), MPEG-H Part 2 (the new format starting to appear everywhere, used for 4K and 8K TV), Theora, VP8, and VP9 (used by Imgur, Gfycat, etc), DNXHD (used for editing).

Examples of container formats: AVI, MKV, MP4, MOV, WebM.

There are a few reasons for varying video formats: some get higher quality at given bitrates (a 10Mb/s HEVC video is a lot better than a 10 Mb/s MPEG-2 Part 2 video), some are better-suited for editing (ProRes and DNxHD store complete frames, most other formats do not), some have widely-available hardware decoders (your phone probably has an H264 decoder in it but not an H265 decoder, so the former will be a lot smoother and lighter on your battery even though the latter is a better format), etc. But the container is mostly irrelevant, you can't make any decision based on container.