PDA

View Full Version : The State of Blu-Ray on Linux


ggking7
8th December 2008, 18:20
I've spent an obscene amount of time working with Blu-Ray on Linux and I thought I'd share my findings.

Blu-Ray discs seems to fall into 4 categories as far as how easy it is to watch them on Linux.

1. a single m2ts file contains the entire main feature and the audio is not in TrueHD format

2. a single m2ts file contains the entire main feature and the audio is in TrueHD format

3. the main feature is broken up across multiple m2ts files

4. the disc is protected with MKBv9 and/or BD+ protection

#1 is easy, you can watch the decrypted m2ts file directly in mplayer.

#2 is easy enough, you can convert the audio of the decrypted m2ts file in tsremux or similar and watch it on mplayer. tsremux works well enough via 'mono tsremux.exe'.

#3 is currently impossible without determining the m2ts sequence and playing each file back separately. If the audio is TrueHD, you must also run each m2ts file through tsremux separately. To make matters worse, each m2ts file should not necessarily be watched from its beginning to end. eac3to and tsmuxer are both Windows software and both handle this problem, but neither works in Linux via wine. Portions of each program work via wine, but not well enough to solve #3.

#4. Easy BD+ support in dumphd seems to be close, but an MKBv9 disc can currently only be decrypted via AnyDVD in Windows and it does not work via wine.

I highly recommend using virtualbox or vmware-workstation to run Windows software for the purpose of Blu-Ray handling. Unfortunately, neither works on my system. I seem to be able to play about half of the Blu-Ray discs I encounter, those which fall into categories 1 and 2.

UPDATE:

I have #3 working now. I demuxed the decrypted Blu-Ray disc with eac3to via wine and then muxed it with tsmuxer. That fixes the #2 TrueHD audio problem at the same time. The Linux version of tsmuxer is 32-bit and my system is 64-bit and tsmuxer doesn't seem to work with 32-bit emulation so I'm using the Windows version via wine. Also, tsmuxergui doesn't seem to work via wine and using mkvmerge to mux the elementary streams demuxed by eac3to causes an a/v sync problem. Here is an example tsmuxer .meta file:

MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr
V_MPEG4/ISO/AVC, "H:\videos\blu-ray\00154 - 2 - h264, 1080p24.h264"
A_DTS, "H:\videos\blu-ray\00154 - 5 - DTS Master Audio, English, 5.1 channels, 24 bits, 48khz.dtsma", insertSEI, contSPS, down-to-dts, down-to-ac3

The codecs should be changed to match that of your streams, and obviously the filenames. You can see which codecs your streams use with 'wine eac3to video' where "video" is the folder of your decrypted Blu-Ray image. Here is the key to the codecs:

V_MPEG4/ISO/AVC - H264
V_MS/VFW/WVC1 - VC1
V_MPEG-2 - MPEG2
A_AC3 - DD (AC3) / DD (E-AC3) / True HD (True HD only tracks with AC3 core inside).
A_DTS - DTS / DTS-HD

UPDATE:

Some info to help with the #4 situation is being compiled here:

http://forum.doom9.org/showthread.php?t=143453

Based on current information, discs released before November 11th are not MKBv9, discs released between November 11th and December 2nd might be MKBv9, and discs released after December 2nd are MKBv9. All Blu-Ray release dates are here:

http://bluray.highdefdigest.com/releasedates_historical.html

A new version of DumpHD has been released which automatically removes BD+ protection! It is said to work on most BD+ discs at this point.

ggking7
8th December 2008, 22:42
Update above!

froggy1
8th December 2008, 23:14
The Linux version of tsmuxer is 32-bit and my system is 64-bit and tsmuxer doesn't seem to work with 32-bit emulation

It works just fine here. I run a 64-bit openSUSE system and have no problems with it. Maybe your disto 32-bit emulation on 64-bit systems is crap? or you didn't install the correct 32-bit libs?

yeye69
9th December 2008, 09:10
About a playing TrueHD format. It's strange, because a supporting the latter is already included in mplayer:

mplayer -ac help | grep mlp
ffmlp ffmpeg working FFmpeg MLP decoder [mlp]

try something like this:

mplayer -demuxer lavf -aid [1-x] -ac ffmlp -channels 6 -

ggking7
9th December 2008, 15:20
About a playing TrueHD format. It's strange, because a supporting the latter is already included in mplayer

It is strange. There is support for the codec but there is a problem with the demuxing. We discussed it some here:

http://forum.doom9.org/showthread.php?t=142934

Have you been able to play TrueHD audio from a Blu-Ray disc (not an HD-DVD)?

kkloster21
9th December 2008, 15:35
what about: a single .m2ts file contains the entire main feature and the audio is in PCM format. ?

also, i have been able to play discs with the main feature split across many files, right from the disc, smoothly, without ripping and remuxing everything. (Ratatouille for example)

ggking7
9th December 2008, 16:01
what about: a single .m2ts file contains the entire main feature and the audio is in PCM format. ?

Is that a problematic scenario?

also, i have been able to play discs with the main feature split across many files, right from the disc, smoothly, without ripping and remuxing everything.

Please tell how. Did you find the correct sequence and plug them all into a player or something? Of course, the disc must not have had TrueHD audio.

kkloster21
9th December 2008, 16:22
as far as i know, PCM (like TrueHD) tracks on blu-ray discs are not supported by ffmpeg (and therefore by mplayer). have you been able to playback any blu-ray discs with PCM tracks?

i should note here that i do not rip any of these blu-ray discs - i only play them from disc. I have not pursued any techniques for playing back blu-rays that involve ripping files from the disc to a hard drive.

i will show an example of how i played Ratatouille later today (i don't have my playback script at my current location). you are correct in assuming that the disc did not have TrueHD audio.

ggking7
9th December 2008, 16:50
Hmmm, you liken PCM to TrueHD and I wonder if eac3to or tsmuxer can convert a PCM track to something ffmpeg can play like they do with TrueHD. I'll be watching for PCM format.

kkloster21
10th December 2008, 05:37
as far as playing blu-ray discs with the main feature spread across multiple .m2ts files, i have been able to do it without ripping and remuxing anything. i'll post an example here, though it is a little verbose. this is the script i use to play Ratatouille:

/~/dumphd-0.5/dumphd.sh --infile:BDMV/STREAM/00027.m2ts --infile:BDMV/STREAM/00028.m2ts --infile:BDMV/STREAM/00000.m2ts --infile:BDMV/STREAM/00001.m2ts
--infile:BDMV/STREAM/00002.m2ts --infile:BDMV/STREAM/00005.m2ts --infile:BDMV/STREAM/00008.m2ts --infile:BDMV/STREAM/00009.m2ts --infile:BDMV/STREAM/00012.m2ts
--infile:BDMV/STREAM/00013.m2ts --infile:BDMV/STREAM/00016.m2ts --infile:BDMV/STREAM/00018.m2ts --infile:BDMV/STREAM/00021.m2ts --infile:BDMV/STREAM/00017.m2ts
--infile:BDMV/STREAM/00033.m2ts --infile:BDMV/STREAM/00034.m2ts --infile:BDMV/STREAM/00049.m2ts --infile:BDMV/STREAM/00037.m2ts --infile:BDMV/STREAM/00050.m2ts
--infile:BDMV/STREAM/00040.m2ts --infile:BDMV/STREAM/00051.m2ts --infile:BDMV/STREAM/00043.m2ts --infile:BDMV/STREAM/00052.m2ts --infile:BDMV/STREAM/00046.m2ts
--infile:BDMV/STREAM/00053.m2ts --infile:BDMV/STREAM/00056.m2ts --infile:BDMV/STREAM/00054.m2ts --infile:BDMV/STREAM/00059.m2ts --infile:BDMV/STREAM/00055.m2ts
--infile:BDMV/STREAM/00062.m2ts --infile:BDMV/STREAM/00065.m2ts /media/cdrom1/ | mplayer -cache 8192 -lavdopts threads=4 -aid 4353 -fps 24000/1001 -vo xv -ao alsa
-channels 6 -

ggking7
10th December 2008, 16:28
Thanks kkloster21, I'm glad that command works for you. For me, I'd rather rip, demux, and mux via an automated process and end up with a .ts file on the hard disk without TrueHD audio. Did you hear about this:


Playlist entries are not required to start at the beginning of an m2ts and end at the end. To properly splice together a video, you may need to seek to a certain timestamp (in_time) and play to a certain timestamp (out_time) for each m2ts.


http://forum.doom9.org/showthread.php?t=142953

JohnAStebbins
11th December 2008, 02:02
ggking7, I've been enhancing those tools.

There's now a regular autoconf build system. A library is built (libbd.a) that
contains the parsing functions. I separated out the portions that dumped the
information in pseudo-human readable form into separate programs that use
the lib (mpls_dump & clpi_dump). And I added a new tool (bdsplice) that will
splice the clips of a movie together into a single m2ts file. It can also send the
output to stdout (handy for playback piped through mplayer). Note that this is
not simply the same thing as concatenating the m2ts files together. Clips don't
start at the beginning and end at the end of these files. I found an mt2s file in
Spider-Man 2 that crashes ffmpeg when played, but plays through fine when
properly clipped.

http://www.stebbins.biz/source/bdtools.tgz

So a workflow might look like:


# mpls_dump /path/to/bluray/BDMV/PLAYLIST/*


look at the durations and make a guess which is the title you want. Lets say its 00048.mpls.


# bdsplice -t 48 /path/to/bluray movie.m2ts



Now the whole movie is in one nice convenient package. Transcoding with handbrake could then be done like:


# HandBrakeCLI -i movie.m2ts -o movie.mp4 -v -e x264 -q 21 -5 -9 -P -E ac3 \
-x ref=2:mixed-refs:bframes=3:b-pyramid:weightb:8x8dct:me=umh:subme=7:b-adapt=2


HandBrake doesn't yet handle TrueHD or DTS-HD. But TrueHD and DTS-HD are optional codecs and are required to be multiplexed with regular ac3 or dts. So handbrake finds those and uses them.

ggking7
11th December 2008, 03:50
Oh my, I do believe that is awesome. Does it really work? How is a/v sync? Can it strip TrueHD to DTS or AC3? Which distro do you use?

JohnAStebbins
11th December 2008, 05:46
I'm not sure I follow all your questions. I'll assume the "it" you're referring to is handbrake. Handbrake is primarily a transcoder. It can do ac-3 passthrough, so the original ac-3 track is preserved. It doesn't do dts passthrough (yet). So dts tracks must be transcoded to one of the supported audio codecs (faac, mp3, vorbis). Blu-ray does a funny thing with TrueHD and DTS-HD tracks (that doesn't follow the mpeg spec very well). The track that contains TrueHD (or DTS-HD) really contains 2 audio sub-tracks. One is TrueHD and the other is one of the required audio codecs. Handbrake sees both sub-tracks, but currently ignores the TrueHD (or DTS-HD) portion. The current released version of handbrake also can't handle an m2ts that is the result of splicing together multiple m2ts files. It doesn't calculate the duration of the whole file correctly. This is fixed in svn. Handbrake is very good at maintaining a/v sync. I'm not sure what distro I use has to do with anything, but I mostly use Fedora 10 for development. The last release of handbrake has been packaged for Ubuntu however. I created packages for ubuntu 8.10 that are available from http://handbrake.fr. There's also jdong's packages. He is attempting to get them into an official ubuntu repo. they are currently available in a PPA. Add "deb http://ppa.launchpad.net/handbrake-ubuntu/ubuntu intrepid main" to your repo sources and you can apt-get it. Thread on this here: http://ubuntuforums.org/showthread.php?t=992997&page=6
We also make developement snapshot releases periodically that are only announced in the handbrake forums. We're due for another one of these any day now.

yeye69
11th December 2008, 11:58
... but I mostly use Fedora 10 for development... We also make developement snapshot releases periodically that are only announced in the handbrake forums. We're due for another one of these any day now.

If your are hadbrake's developer and using Fedora 10, do you build a rpm-package for yourself or only make svn-snapshot?

UPDATE: Moreover, you promised to do that on handbrake's forum ;)

ggking7
11th December 2008, 17:36
By "it" I meant your bdtools. Can it reduce TrueHD/DTS-HD to AC3/DTS?

Right now I use a combination of eac3to and tsmuxer to splice m2ts files together and strip TrueHD/DTS-HD. I'm wondering if I can use bdtools as a full replacement.

As for your distro, I was hoping you used Gentoo so you might write an ebuild for bdtools.

JohnAStebbins
11th December 2008, 23:55
yeye69, I haven't made any rpm's. I'm undecided whether I'm going to or not. The number of builds I would have to do to satisfy even a reasonably small number of distros is just crazy. I was kind of hoping that others would volunteer for the job of creating packages.

ggking7, bdsplice doesn't look at what is inside the m2ts files. It only uses metadata from the playlists and clipinfo files to put clips together. That is why I also mentioned handbrake, since it looks inside those files. I'm not really all that interested in writing a remuxer. But I would be glad to provide information to anyone who is interested in the task. m2ts files are pretty much regular transport stream files with 4 extra bytes of header (so 192 byte packets) and weirdly multiplexed audio streams. Parsing them, and rewriting the audio PES packets wouldn't be that difficult.

I haven't used eac3to, so I'm not sure what all it does. The name implies that it transcodes eac3 streams. Nothing I've done addresses eac3.

Ranguvar
12th December 2008, 03:27
eac3to does a lot more than transcoding - it's a complete *muxing, audio encoding, splitting/merging tool. The author has already said that they won't be providing Linux tools, or open sourcing it..... sadly.

As for packages, I agree. Just provide sources and build instructions. Building packages isn't usually that hard, provided you have a sane distro - IMO all 'serious' power users will be fine learning how to do that, and by the time that the package is more friendly to all users, it will probably be included in most distros. Besides, it only takes one person per distro (less, due to compatible package formats) to maintain packages. I will provide Arch Linux packages once I am a little more confident with my PKGBUILD-writing skills.

Thanks to everyone who worked on quality Blu-ray support under Linux!

ggking7
12th December 2008, 17:37
Added info on the tsmuxer .meta file in the original post.

ggking7
14th December 2008, 16:26
Added info on determining whether or not a Blu-Ray disc is protected with MKBv9 or BD+ before buying/renting it to the original post.

ggking7
15th December 2008, 01:05
Added news about the new DumpHD 0.6 version which supports automatic BD+ removal.

froggy1
9th January 2009, 16:14
Greetings Folk -
have just been in the process of dual-booting Xp and Fedora 6 - according to the wise ones - one should install Xp first then load Linux care of GRUB not on MBR but create a /boot partition that can be mounted by the NT Bootloader itself - using Bootpart.exe a freeware programme that came with Y2K - this I have tried to do - have not loaded GRUB on MBR - Xp treats it as a virus - but I cant get to Linux GUI - can anybody help ??

And how is this relevant to Bluray support for Linux? Please start a new thread about your problem!