Is it a vector image? -> Use .svg
Is it an illustration (bitmap) with transparency (i.e. a cutout of a man) -> Use .png
Is it animated? -> Use .mp4 and fallback to .gif
Is it a photo? -> Use .jpg and compress as much as possible
Is it a vector image? -> Use .svg
Is it an illustration (bitmap) with transparency (i.e. a cutout of a man) -> Use .png
Is it animated? -> Use .mp4 and fallback to .gif
Is it a photo? -> Use .jpg and compress as much as possible
if an mp4 doesn't play, a webm probably won't play either.
you can do mp4 -> webm -> gif if needed, but that's extra encoding that probably isn't needed.
So you'd want to do webm → mp4/h264 → gif.
(I agree this isn't worth the time to set up in most cases)
h.264 gives you good performance, hardware encoders/decoders, best compatibility. Most of the time just using it alone is the best value.
All that depends on how many videos you need to transcode though. If you just have a few, do all the main codecs.