Playing DVDs in Ubuntu is a nightmare, especially the many commercial DVDs that are encrypted. It is hard to find a clear guide that covers all the different problems and how to solve them. This guide is your solution.
1. Open the Terminal by Applications -> Accessories -> Terminal. Type in: sudo -s [Enter]
At the prompt give your administrator password. This logs you into terminal as the Administrator, giving you all the permissions you will need.
2. Type: wget http://www.medibuntu.org/sources.list.d/karmic.list –output-document=/etc/apt/sources.list.d/medibuntu.list [Enter]
(Replace “karmic” with the code-name of the distribution you are using.) This adds the medibuntu packages to your sources, allowing you to install the packages using apt-get. This technique may work with other Linux Distributions by leaving the Ubuntu code-name in but I have not tested that.
3. Type: apt-get update && apt-get install medibuntu-keyring && apt-get update [Enter]
This file contains the software keys which tell your computer that the medibuntu packages are legitimate.
4. Type: apt-get install libdvdcss-dev non-free-codecs vlc [Enter]
The above code installs the packages above and their dependencies, which include many important files such as libdvdcss2 and w32codecs. It also installs VLC Media Player.
Here is a full list of all the packages that the above command installs:
- libc6 (>= 2.4)
- libstdc++5 (>= 1:3.3.4-1)
- gstreamer0.10-pitfdll [i386]
- icedtea6-plugin [amd64]
- libdvdread3 libmp3lame0
- msttcorefonts sun-java6-jre [amd64]
- sun-java6-plugin [i386]
After this, your Encrypted DVDs should play faultlessly on VLC Media Player.
Enabling Direct Memory Access (DMA)
Jerky, jumpy or halted playback can occur. There is a bug in Totem Movie Player. Before trying anything else, switch to VLC Media Player and see if this solves the DVD playback.
If jerky video persits, it may be because DMA is not enabled for your DVD drive. DMA is enabled by default in most cases. The instructions below show how to check and, if necessary enable DMA.
Open Terminal by Applications -> Accessories -> Terminal.
Type in: sudo -s [Enter] followed by your Administrator password.
Next put a DVD in the drive and type in
: mount | egrep ‘udf|iso9660′ [Enter]
You should see a line like: /dev/scd0 on /media/cdrom0 type udf (ro,nosuid,nodev,utf8,user=you)
The important part of this is the first bit: /dev/scd0. This tells you the mount point (the label) your computer gives to your DVD drive. scd or sda indicates that your DVD drive is treated as a SCSI drive. Something like hda indicates your drive is IDE.
First check the speed of your drive by typing:
sudo hdparm -tT /dev/sda [Enter] (Change sda to your drive location as determined in the previous step.)
Speeds of more than 3MB/s for the buffered disk indicate that DMA is not the problem. Any lower and you should try to enable DMA. For IDE Drives, follow the instructions for using hdparm to enable DMA.
For SCSI Drives skip to the section for enabling DMA with a SCSI Drive Enabling DMA with `hdparm` for IDE Drives To enable DMA, you need to use the hdparm command and the configuration file hdparm.conf. These instructions assume that your DVD drive is hdc.
1. See the what the settings are on /dev/hdc sudo hdparm /dev/hdc
2. If you get a line like using_dma = 1 (on), DMA is already enabled. Skip to step 4 to see if it has been enabled at boot time.
3. Enable DMA on /dev/hdc sudo hdparm -d1 /dev/hdc
4. You have now enabled DMA for the drive. However, in order for the settings to be automatically applied at boot there you need to edit the /etc/hdparm.conf script. To do this use this command:
gksudo gedit /etc/hdparm.conf
Add the following three lines to the end of your hdparm.conf
dma = on
(Another way of avoiding editing of the hdparm.conf file is to simply run sudo hdparm -d1 -k1 /dev/hdc to keep the DMA flag.)
A common problem when you try to enable DMA is getting an error like
HDIO_SET_DMA failed: Inappropriate ioctl for device
HDIO_GET_DMA failed: Inappropriate ioctl for device
This is a known bug in hdparm to which there is no solution or workaround. You will not be able to control DMA and if your drive is too slow (very unlikely with modern drives) you may need to replace your drive.
Enabling DMA with SCSI DVD drives
DMA is generally turned on by default, but sometimes the generic ATA module doesn’t work. Find out if this is the case by typing:
dmesg | grep ata [Enter]
A line like this below would show DMA disabled.
ata2.00: simplex DMA is claimed by other device, disabling DMA
If this is the case type the following:
sudo gedit /etc/modprobe.d/aliases [Enter]
And add the following three lines to the bottom of the file:
## Turn on DMA for DVD ############################
alias ata_generic off
alias pata_atiixp on
Reboot and DMA should work. You can verify this by typing:
dmesg | grep ata [Enter]
Two of the lines will resemble this:
[ 23.937141] ata2.00: ATAPI: MATSHITAUJ-845D, D100, max UDMA/33
[ 24.108846] ata2.00: configured for UDMA/33
If your drives are configured in [Cable Select] mode and while running hdparm commands you receive errors related to timeouts or drive not ready, try changing the drive to be a master or slave device depending on your system configuration. This does require opening the case and as far as I know most drives are set to Cable Select from the manufacturer.
Sometimes step 3 above can fail with an “Operation Not Permitted” message. You can fix this by editing the file /etc/modules.
In Terminal, type:
sudo gedit /etc/modules
For an Intel CPU put the two lines
above the line ide-cd
For an AMD CPU put the line amd74xx above ide-cd
For a VIA Chipset put via82cxxx above ide-cd
Then reboot and try steps 3-4 again….
If the problem still persists, and you’re using a SATA hard drive, then the SATA module has to be loaded first before the ide-cd. Add sata_sil to the beginning of your /etc/modules file then reboot.
DMA should now work on your drive and playback should be less jerky.