This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Blu-ray

From Gentoo Wiki (test)
Jump to:navigation Jump to:search

Blu-ray is the optical media successor to DVD. As a medium, it is designed to hold more storage. For multimedia, it is intended to store higher quality content than DVDs, such as movies and shows in 720p, 1080p video resolution and higher, plus audio tracks with higher bitrates and number of channels, such as DTS-HD Master.

Similar to DVDs, the file storage format for blu-ray discs is UDF. The content on the discs is also protected with DRM, namely AACS (Advanced Access Content System).

There are a number of applications in portage that can be used to access Blu-ray discs and media, including ones to bypass the encryption.

Device Access

Important
Your user must be added to the cdrom group to access a hardware Blu-ray disc drive.

Check if your user is already in the cdrom group:

user $groups
users cdrom

Add your user to the cdrom group if needed:

root #gpasswd -a user cdrom

As with any time a user is added to a new group, they must either log out and back in as that user, or switch using su to gain new abilities.

user $su - user
user $groups
users cdrom

DRM

media-libs/libbluray will use media-libs/libaacs to bypass AACS encryption. It requires a KEYDB.cfg text file that has all the current set of keys necessary. You can find the list you need in various places online.

Save the file to ~/.config/aacs/KEYDB.cfg

Disc Information

Blu-ray discs have both "titles" or "tracks", similar to DVD tracks, but also "playlists" as well. This can make it a bit confusing when trying to get information or rip media from a disc. Generally speaking, ripping a playlist will cover a common use case.

libbluray

The package media-libs/libbluray contains a few programs to help out.

Use bd_info to list details of a disc:

user $bd_info /dev/sr0
Using libbluray version 1.0.2
Volume Identifier   : GENTOO_ROCKS
BluRay detected     : yes
First Play supported: yes
Top menu supported  : yes
HDMV titles         : 4
BD-J titles         : 5
UNSUPPORTED titles  : 5

BD-J detected       : yes
Java VM found       : no
BD-J handled        : no
BD-J organization ID: 7fff8123
BD-J disc ID        : b484515373b51940820b165b97212b5a


AACS detected       : yes
libaacs detected    : yes
Disc ID             : 1460B1469A66481964B3023486A1945806653567
AACS MKB version    : 7
AACS handled        : yes

BD+ detected        : no

Application info:
  initial mode preference : 2D
  3D content exists       : No
  video format            : ignored (0x0)
  frame rate              : ignored (0x0)
  provider data           : '                           ZNURT'

No disc library metadata

Use list_titles to get details of each title / track as well as the playlists:

user $list_titles /dev/sr0
Main title: 6
index:   1 duration: 00:01:57 chapters:   2 angles:  1 clips:   1 (playlist: 00000.mpls) V:1 A:1  PG:6  IG:0  SV:0 SA:0
index:   2 duration: 00:01:06 chapters:   2 angles:  1 clips:   1 (playlist: 00001.mpls) V:1 A:1  PG:6  IG:0  SV:0 SA:0
index:   3 duration: 00:02:29 chapters:   2 angles:  1 clips:   1 (playlist: 00002.mpls) V:1 A:1  PG:6  IG:0  SV:0 SA:0
index:   4 duration: 00:01:13 chapters:   2 angles:  1 clips:   1 (playlist: 00003.mpls) V:1 A:1  PG:1  IG:0  SV:0 SA:0
index:   5 duration: 00:05:12 chapters:   2 angles:  1 clips:   1 (playlist: 00004.mpls) V:1 A:1  PG:6  IG:0  SV:0 SA:0
index:   6 duration: 00:14:16 chapters:   2 angles:  1 clips:   1 (playlist: 00005.mpls) V:1 A:1  PG:6  IG:0  SV:0 SA:0
index:   7 duration: 00:00:23 chapters:   2 angles:  1 clips:   1 (playlist: 00009.mpls) V:1 A:0  PG:0  IG:0  SV:0 SA:0
index:   8 duration: 00:00:11 chapters:   2 angles:  1 clips:   1 (playlist: 00010.mpls) V:1 A:1  PG:0  IG:0  SV:0 SA:0
index:   9 duration: 00:00:11 chapters:   2 angles:  1 clips:   1 (playlist: 00014.mpls) V:1 A:0  PG:0  IG:0  SV:0 SA:0

bluray_info

The package media-video/bluray_info displays details about the disc as well, with syntax and output format similar to the old media-video/lsdvd program.

user $bluray_info /dev/sr0
Disc Title: GENTOO_ROCKS
Title: 001, Playlist: 0000, Length: 00:01:57.11, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 06, Filesize: 00091 MB
Title: 002, Playlist: 0001, Length: 00:01:06.56, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 06, Filesize: 00053 MB
Title: 003, Playlist: 0002, Length: 00:02:29.98, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 06, Filesize: 00121 MB
Title: 004, Playlist: 0003, Length: 00:01:13.10, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 01, Filesize: 00057 MB
Title: 005, Playlist: 0004, Length: 00:05:12.81, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 06, Filesize: 00251 MB
Title: 006, Playlist: 0005, Length: 00:14:16.85, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 06, Filesize: 00791 MB
Title: 007, Playlist: 0009, Length: 00:00:23.27, Chapters: 002, Video streams: 01, Audio streams: 00, Subtitles: 00, Filesize: 00014 MB
Title: 008, Playlist: 0010, Length: 00:00:11.92, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Filesize: 00010 MB
Title: 009, Playlist: 0014, Length: 00:00:11.97, Chapters: 002, Video streams: 01, Audio streams: 00, Subtitles: 00, Filesize: 00006 MB
Main title: 6

Ripping Blu-rays

Two programs in portage can be used to copy Blu-ray titles and playlists to disc: namely, media-libs/libbluray again, which is open source and command line only, and media-video/makemkv which is partially open source and has both command line and GUI applications.

libbluray

With media-libs/libbluray, you can use bdsplice to copy a title or playlist to disk. You will have to get the index number from above, using as examples list_titles or bluray_info for references.

The container for multimedia files are MPEG2 transport streams, so we will save it with an m2ts extension.

user $bdsplice -t 6 /dev/sr0 bluray_title_06.m2ts

MakeMKV

MakeMKV is a partially-closed source program, and does not require a KEYDB.cfg file to decrypt disc access. It has both a command-line application, makemkvcon and a Qt application MakeMKV.

Note
The title and playlist indexes displayed by MakeMKV and the ones from libbluray will not necessarily match. Also, the titles are zero-indexed. So title 1 one libbluray, would be title 0 with MakeMKV.

Command Line

makemkvcon, the command line application, can rip content from three sources: a disc in your Blu-ray drive (a character device on your system, such as /dev/sr0), a mounted Blu-ray filesytem, and a copied Blu-ray image.

Copy the first title from the disc (remember that they are zero indexed) to the current directory:

user $makemkvcon --minlength=0 mkv dev:/dev/sr0 0 .

Copy the first title from a mounted directory:

user $makemkvcon --minlength=0 mkv file:/mnt/bluray 0 .

Copy the first title from an image:

user $makemkvcon --minlength=0 mkv iso:bluray_movie.iso 0 .

GUI

The program MakeMKV is a Qt application, and quite self-explanatory once started.

Playback

Packages in portage that can playback Blu-rays include media-video/vlc, media-video/mplayer, and media-video/mpv.

Addendum for Region B Blu-ray

Many Blu-rays are localized. That is, the main feature is in at least three parts:

  • The opening credits (in several languages).
  • The closing credits (in several languages).
  • The feature, less the opening and closing credits.

list_titles and bluray_info may not guess the title needed to rip for the current locale.

Audition the longest/largest titles before making the rip.