Those who try to play videos on a fresh installed Ubuntu are likely to be confronted with the problem of missing codecs.
The good news is that, even though these are not present by default, they are still available and can be easily installed with apt or apt-get.
The codecs are part of the ubuntu.restricted-extras repository. From your favorite terminal just do the following:
sudo add-apt-repository multiverse
sudo apt update
sudo apt install ubuntu-restricted-extras
After that you should be able to play your favorite videos.
Enjoy!