Some codecs like libdvdcss2 are restricted due to its proprietary nature. These are required to play DVDs. To install them in Ubuntu, we can add the medibuntu repository and do an apt-get.

1. Add the repository

sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get -q update
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring
sudo apt-get -q update
sudo apt-get --yes install app-install-data-medibuntu apport-hooks-medibuntu

2. Install the necessary codecs.

sudo apt-get install w64codecs libdvdcss2

We can install w32codecs as well.

Also we can install the mplayer essential codecs package

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2  # download the codecs
tar -xvjf all-20110131.tar.bz2    # decompress (expand)
sudo mkdir -p /usr/lib/win32    # make win32 directory under /usr/lib
cp -R all-20110131/* /usr/lib/win32    # copy the contents to it