Install most usefull codecs in Ubuntu 18.04 LTS and Ubuntu 22.04 LTS

Ubuntu 18.04 LTS

sudo apt install -y ubuntu-restricted-extras
sudo apt install -y gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libavcodec-extra gstreamer1.0-libav gstreamer1.0-fluendo-mp3 chromium-codecs-ffmpeg-extra libdvd-pkg

Setup DVD Playback

sudo dpkg-reconfigure libdvd-pkg
sudo reboot
sudo apt install vlc

Here you can find the Ubuntu 22.04 compatible codecs

# Add the multiverse repository
sudo add-apt-repository multiverse

# Update the package list
sudo apt-get update

# Install proprietary multimedia packages
sudo apt-get install ubuntu-restricted-extras libavcodec-extra libdvd-pkg

# Install Microsoft fonts
sudo apt-get install ttf-mscorefonts-installer

# Install VLC media player
sudo apt-get install vlc

# Install DVD playback support
sudo apt-get install libdvd-pkg

# Configure libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg

# Install Flash player
#sudo apt-get install flashplugin-installer #nope don't use flash!!! :)

# Install codecs for MP3 playback
sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-libav

# Install codecs for H.264 video
sudo apt-get install gstreamer1.0-vaapi

# Install codecs for AC3 audio
sudo apt-get install gstreamer1.0-libav

# Install restricted extras
sudo apt install -y ubuntu-restricted-extras

# Install ffmpeg
sudo apt install -y ffmpeg

# some further stuff bluray additional 
sudo apt install -y libbluray-bdj libaacs0 libbluray2 libdvdnav4 libdvdread4 handbrake-gtk handbrake-cli