What Are Codecs and Why Are They Important?

When diving into the photography world, one of the first things you come across is deciding whether to shoot raw or JPEG. Typically, the answer to that is very simple: shoot in raw every time you can, only shoot JPEG for specific reasons. What about when you start shooting video? Codecs were basically magic to me before I finally understood how they functioned.