September 3, 2017

How to Play DVDs and Blu-rays on Linux

Commercial DVDs and Blu-ray discs are encrypted. The Digital Rights Management (DRM) is designed to prevent you from ripping them, copying them, and watching them on unsupported players. You can get around this protection to watch DVDs and Blu-rays on Linux, but it’ll take some tweaking.
DVD discs work well, and all DVDs should work after you install a single library. Blu-rays are much more hit-and-miss, and only some will work–particularly older Blu-ray discs. Also, both of these require that you have the right disc drive in your PC–a DVD drive if you’re looking to just play DVDs, and a Blu-ray drive if you’re looking to play DVDs and Blu-ray discs.

How to Play DVDs on Linux with VLC

The free VLC media player can play DVDs on Linux, but it requires a special library known as libdvdcss. This library effectively breaks the CSS encryption on DVDs, allowing you to watch them. The status of this library is legally unclear–it’s potentially illegal under the DMCA in the USA–so Linux distributions don’t generally include it in their software repositories.
But this is actually the same method many Windows users use. Windows 8 and 10 no longer include DVD playback functionality, and the standard advice is to download and install VLC. The Windows builds of VLC have libdvdcss built-in, so you just need to download, install, and start watching. Linux is a tad more complicated.
NOTE: You can also buy a licensed copy of Fluendo DVD Player for $25 on Ubuntu’s Software Center, but most people won’t want to bother. You can get DVDs for free if you’re willing to take just a few extra steps.
On Ubuntu 12.04 to Ubuntu 15.04, you can install libdvdcss by opening a terminal window and running the following commands:


sudo apt-get install libdvdread4
sudo /usr/share/doc/libdvdread4/install-css.sh


On Ubuntu 15.10 and up, run the following command instead. Follow the instructions that appear in the terminal to install libdvdcss:


sudo apt-get install libdvd-pkg


For other Linux distributions, perform a web search for “install libdvdcss” and the name of your Linux distribution. You’ll find instructions and third-party repositories that should make the process easy.





You can then install VLC from the Software Center if it isn’t installed already. (Alternatively, you can run sudo apt-get install vlc to install it from the command line.)
Once installed, insert your DVD and launch VLC. Click the “Media” menu in VLC, select “Open Disc,” and select the “DVD” option. VLC should automatically find a DVD disc you’ve inserted and play it back. If that doesn’t work, you may need to specify the device path of your DVD drive here.
If it doesn’t appear to work, try restarting your computer. That should ensure VLC is correctly using libdvdcss.



How to Play (Some) Blu-rays on Linux with VLC

Blu-rays are a bit more complicated. While there are technically paid DVD players you can purchase for Linux, there’s no officially licensed way to play back Blu-rays on Linux.
The older your Blu-ray disc is, the more likely it will work. Newer Blu-ray discs use BD+ disc encryption, while older ones used the more easily bypassed AACS encryption. Newer Blu-ray discs also blacklist some of the known keys used to play older Blu-ray discs in this way. If you have a very new disc, you may not get it to play at all.
To install VLC and its Blu-ray support on Ubuntu, open a terminal window and run the following commands in order. You can copy and paste them into a terminal window using your mouse.


sudo apt-get install vlc libaacs0 libbluray-bdj libbluray1
mkdir -p ~/.config/aacs/
cd ~/.config/aacs/ && wget http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg
 
 
If you’re using another Linux distribution, you’ll want to install VLC and the appropriate libaacs0, libbluray-bdj, libbluray1 libraries. You can then run the second two commands to download the KEYDB.cfg file into the configuration directory.





You can now open VLC and attempt to open a Blu-ray disc like you would a DVD. Click the “Media” menu, select “Open Disc,” and select “Blu-ray.” Leave the “No disc menus” option checked.
If you see a message saying the disc isn’t decrypted and you need a key, or a message saying the AACS host certificate has been revoked, your Blu-ray disc is too new and isn’t supported.



 

How to Play Blu-rays on Linux with MakeMKV and VLC

If you need to play a wider variety of Blu-ray discs, there’s another method that people report more success with: you can use MakeMKV to decode the Blu-ray and VLC to play it as it’s being decoded.
MakeMKV isn’t an open-source tool. It’s proprietary software with a free 30-day trial, and will theoretically cost $50 to continue using after that. However, MakeMKV is free to use while in beta, and it’s been in beta for three years. You’ll just have to check this forum post every month and refresh the beta key to continue using MakeMKV, assuming it stays in beta.
Another forum post provides instructions for installing MakeMKV on Linux. However, Ubuntu users can install MakeMKV using the much easier apt-get command. Currently, the most up-to-date PPA we’ve found for this is the makemkv-beta PPA. To install MakeMKV from this repository, open a terminal and run the following commands:


sudo add-apt-repository ppa:heyarje/makemkv-beta
sudo apt-get update
sudo apt-get install makemkv-bin makemkv-oss
 
 
You’ll also need VLC installed, as described above. Once you have both programs, open the MakeMKV application from your menu, select your Blu-ray disc drive, and click the “Stream” icon on the toolbar. You’ll be given a local address.





Open VLC, click the “Media” menu, click “Open Network Stream,” and provide that address. It will look similar to the following address:


http://localhost:51000/stream/title0.ts


The main movie is usually either “title0” or “title1”–choose the one that looks larger in MakeMKV.





MakeMKV will decode the Blu-ray video and stream it to VLC. Despite the word “stream,” this all happens on your computer, no internet required. VLC plays the video, but MakeMKV is doing the heavy lifting in the background.

Playing Blu-ray discs is both unreliable and a hassle. Only people who have actual commercial Blu-ray discs in their hands will have to go through this trouble–if you’ve ripped the Blu-ray discs on another computer, or downloaded the ripped files, you should be able to play them in VLC just like any other video.
In an age where you can get Netflix to work on Linux just by downloading Chrome, or use a quick tweak to make Hulu or Amazon Instant Video work, this is a lot of work to play a legitimate disc. It’s possible, but you’re better off getting your media in other ways on Linux, or using another device to play Blu-rays if you must use those physical discs.

Source: https://www.howtogeek.com/240487/how-to-play-dvds-and-blu-rays-on-linux/