A codec is the pair of algorithms that compresses video into a bitstream and decompresses it for playback — coder plus decoder. H.264, H.265, VP9 and AV1 are codecs.
The most common misunderstanding in video compression is that MP4 is a codec.
It is not: MP4 is a container, a wrapper that holds a video stream, an
audio stream, timing information and metadata. The video inside an MP4 is
usually H.264, sometimes H.265, occasionally something else. This is why two
files can both be named .mp4, both be valid, and only one of them will play
on a given device.
Practically, three things follow:
- Renaming a file cannot change its codec. Changing
.webmto.mp4changes nothing about the bytes inside and generally makes things worse. - Compatibility is a codec question, not an extension question. H.264 in MP4 plays essentially everywhere. H.265 in MP4 does not, despite being the same container.
- Changing codec means re-encoding. Every codec change is a fresh lossy pass, with the quality cost that implies.
When a tool asks you to choose an output codec, it is asking you to trade file size against how many devices can open the result. H.264 is the safe answer; H.265 and AV1 are the smaller ones.