XBMC Community Forum
[Linux] HOW-TO playback Blu-ray Disc in XBMC for Linux with MakeMKV (Plugin Addon) - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Announcements, Info, and General Discussion (/forumdisplay.php?fid=85)
+--- Forum: Tips, tricks, and step by step guides (/forumdisplay.php?fid=110)
+--- Thread: [Linux] HOW-TO playback Blu-ray Disc in XBMC for Linux with MakeMKV (Plugin Addon) (/showthread.php?tid=67420)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35


HOW-TO playback Blu-ray Disc in XBMC for Linux with MakeMKV (Plugin Addon) - magnetism - 2010-01-15 16:20

Now also available as an addon

http://www.bultsblog.com/plugin.makemkvbluray.zip

Install from zip. Follow all other steps to get makemkv etc...

===========

I am updating this first post as a placeholder for the current state of development of the plugin. The original script I've now abandoned as a development platform, I'll keep the script location up for a while though until we know that the plugin is fully functional.

Ok, now for the new: I've released a version of the BluRay video plugin. Please be aware that this is still somewhat a development version. I've tested as well as I could on vista and did play a disc on Linux so I'm reasonably comfortable that it will work. However, until you've tested for your self I would urge you to keep a copy of the original script around so you can switch back to that.

If you have any feedback, suggestions or bugreports please use this thread so we can all share, thanks!


Requirements

* A working install of MakeMKV. If you're installing under Linux, make sure you install both the source and the binary package, otherwise the commandline tool won't be there.
* A BluRay source, either a disc or iso's or something.. (What's the point otherwise...)


Install the plugin

* Download the current version of the plugin here
* Unzip/Install the plugin in your plugin/video path to make it act as a video plugin


Use the plugin
Browse to your video plugins and if all went well with the installation a BluRay plugin should now be selectable. Enter it and play some BluRay's.. Initially there are 3 sources options and a selection to go to the plugin settings. Source options are:

* Disc, play a disc insterted into your BluRay drive (can also be a DVD if you really want to..)
* Filelocation, browse for a filelocation in your video sources and use it as a BluRay source. Selections can be either and ISO image or an index.bdmv file if the dir has been extracted. Note: Since the actual streaming of the image is delegated to the makemkvcon executable only files accessible at the filesystem level can be used. If you've used an XBMC selected samba source, iso files from this location won't work.
* Remote, you can let it connect to a remote machine with the stream setup already.


All three source options have both a 'play' and 'browse' selection. If you choose 'play' the plugin will automatically determine the longest running feature on the disc and start playback of that. Handy if the bluray has only one main feature (ie movies). If you choose 'browse' the plugin will display a selection of chapters on the disc and let's you select the one you want to play. Handy if you're looking at a series BluRay with multiple episode.
Unfortunately there is not a lot of information available on the streams when selection browse. This is because the MakeMKV streamer doesn't supply any more info unfortunately.

Explanation of the settings:
Settings are divided into three sections

* General Settings

o MakeMKV location. -> Point to your makemkvcon executable. If it is on your path the default should be fine, otherwise just browse to the correct location and select it.
o Seconds to wait for stream -> Tell the script how long it should wait for makemkv to finish parsing the disc/iso before calling it quits and exiting. Default is 2 minutes.
o Local portnumber -> If running makemkvcon locally this is the portnumber that the script will listen to. Default should be fine

* Browseable Options

o Enable disc support -> Turn on or off disc support
o Enable File location support -> Turn on or off support for browsing to ISOs and directory structures for playback
o Enable Remote location support -> Turn on or off support for streaming from a remote location

* Remote Setup
This section will only show up if you've enabled remote location support. Enter the ip address and portnumber of the remote makemkv stream location.


Changelog

0.1a

* Fixed code issue with exception handling causing real error to be 'forgotten'
* Fixed issue with logging code which preventen discs from streaming (oops, already!)


0.1

* Initial release of the plugin, based on the script code that has gone before
* Main feature selection now more 'intelligent' by selecting longest stream
* Changed settings around to make more sense by allowing source categories


===== OLD Script:

Location to get the old script: http://www.bultsblog.com/BluRay-script.zip


==== OLD first post starts here

Just a heads up that I've succeeded in playing back an original Blu Ray disk in the blu ray drive using XBMC. It's not as user friendly as is could be yet, but at least it's now possible.

Steps:
- Install MakeMKV
- Insert Blu ray
- makemkvcon stream disc:0
- Get a browser somewhere and point it to:
Code:
http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=PlayFile(http://192.168.0.103:51000/stream/title0.m2ts;1)
Assuming of course you're xbmc is at that IP.
- Watch the movie....

You can browse the Blu Ray index by pointing to http://192.168.0.103:51000/ By the way.

Now to figure out how to pour this into a plugin somehow...

I apologise if this was already widely known, but it was new to me.


- magnetism - 2010-01-15 23:11

Right, to answer my own post, I've hacked a script together that should work. I'm running it now on my linux box and I'm watching 10,000 BC Blu Ray as we speak.

I'm including the source code here, perhaps it's of interest to someone
Code:
import xbmc, xbmcgui, subprocess, os, time, sys, urllib, urllib2
  
class BluRayStarter:
  def __init__(self):
    timeSlept = 0
    self.pDialog = xbmcgui.DialogProgress()
    ret = self.pDialog.create('XBMC', 'Waiting for Disc to be prepared', 'killing previous makemkvcon')
    self.pDialog.update(0 )
    try :
      subprocess.call('killall -9 makemkvcon')
    except:
      pass
    self.pDialog.update(2, 'XBMC', 'Waiting for Disc to be prepared', 'killing previous makemkvcon')
    try :
      tst = subprocess.Popen('makemkvcon stream disc:0 > ~/startupstream.log', shell=True)
      ret = self.pDialog.update(2, 'XBMC', 'Waiting for Disc to be prepared', 'waiting for stream')
      m2tsTried = False
      while True:  
        try:
          urllib.urlretrieve('http://localhost:51000')
          if (m2tsTried) :
            xbmc.Player().play('http://localhost:51000/stream/title0.vob')
          else :
            m2tsTried = True
            opener = urllib.URLopener()
            opener.open('http://localhost:51000/stream/title0.m2ts')
            del opener
            xbmc.Player().play('http://localhost:51000/stream/title0.m2ts')
          break;
        except IOError:
          pass
    if self.pDialog.iscanceled():
        break
        time.sleep(1)
        timeSlept = timeSlept + 1
        self.pDialog.update(timeSlept)
        if timeSlept > 120 :
          break
          
    except :
      self.message('Error trying to open makemkv stream ')
      self.pDialog.close()
      raise
    else :
      self.pDialog.close()

  def message(self, messageText):
    dialog = xbmcgui.Dialog()
    dialog.ok("Info", messageText + " Test")

mydisplay = BluRayStarter()
del mydisplay

Tested on linux only, makemkvcon must be on your path.

-- Edit: 10000 BC is pretty bad by the way...


- jonassw - 2010-01-16 00:48

Oh thats cool. I'm going to borrow a Blu Ray from a friend tomorrow and check it out.


- Bahndit - 2010-01-16 09:37

That is pretty cool man. Keep up the good work.


- rodercot - 2010-01-16 15:32

Great Work on this.

I just tried this on my windows machine (only one with a bd drive currently and the stream function works) Then I tried to play it on my linux desktop as a url stream on both latest Mplayer SVN with vdpau and or VLC, terrible chop pretty much unwatchable and I am not getting into playing around with mplayer command line settings. I get an sps 1 error as soon as I open the file and VLC will only pass stereo no matter what settings I change.

Cool program though and I am sure locally it will play things just fine.

OK scratch all the above, I loaded up makemkv and streamed gone in 60 seconds in windows and then launched xbmc on my linux test machine hit / to put it in window mode - loaded up firefox and pasted your command line to include the localhost address of xbmc and then ip address of my windows machine to play the file and that works perfectly. It plays beautifully across my network. makemkv will ask you to unblock the windows firewall when you install it and make sure you have enable the webserver in xbmc to use this.

Code:
http://local.xbmc.address:8080/xbmcCmds/xbmcHttp?command=PlayFile(http://windows.machine.address:51000/stream/title0.m2ts;1)

just hit \ to put it back in FS mode and it will resync - goes green for a second and then resumes play perfectly. 16-18 MB/s no drops 10% CPU usage.

2% Network usage on my windows machine 1Gb network cat6 cabling. This is awesome for loading up a friday night movie this way and takes no time to set it up.

So I think I will head out and pick up a bd reader today for my main ion machine. Questions

How do you launch that script? and where did you launch it from. I guess we could use launcher to do it inside xbmc but it needs to be more WAF friendly then that.


Regards,

Dave


- magnetism - 2010-01-16 21:04

It's a standard XBMC script, I just didn't package it yet. I'm pretty sure it won't work in windows, but I can't be sure. If you want to use it, create a directory in your scripts directory (BluRay for instance) and put the contents of the scripts in a default.py file. That way it would be accessible from the local XBMC installation and launch makemkvcon on the localhost. Once it's started it will launch the player (or should anyway...).
Doesn't work over the network though, the makemkv connection is hardcoded atm.


- magnetism - 2010-01-16 21:39

Ok, download this zip file with the packaged script:

http://www.bultsblog.com/BluRay-script.zip
  • Unzip the contents to your script dir
  • Load a blu ray
  • Browse to the script in XBMC and start it (BluRay)
  • Wait for it.... The script will
    [INDENT]- Kill any still running makemkvcon
    - start a new makemkvcon to stream disc:0
    - Wait for max 2 minutes for the stream to become available on HTTP
    - Run the title0 stream.
    [/INDENT]
  • Hopefully, watch the movie.
Let me know if it works for you.


- Encom - 2010-01-16 22:06

Works great!


- olafvs - 2010-01-17 00:34

Three words: I love you!

Best script I have. I can finally watch Blu-rays.


- 3choTh1s - 2010-01-20 09:42

I just wanted to chime in and say thanks! I actually saw that Makemkv could stream bluray's a couple weeks ago and thought I should go ahead and do something about it. Although I have quite a bit of experience programming I had no experience in Python or the xbmc api.

So I was studying how to do all of it when you decided to grace us with this great script. Works mostly great!

I just have a small problem that when I try to play a bluray my audio craps out with a "Failed to initialize audio device." Which actually makes all the sound from linux stop not just xbmc. But I'm pretty sure that's the fault of xbmc(or linux configuration?) not this script or Makemkv. So I'll put that as a question in another thread.

Anyways thanks again!


- Gryph - 2010-01-20 12:30

Nice ... Thanks for this info.

You can also stream the movie if you have the folders, or ISO on your machine.

From the first post, instead of:
makemkvcon stream disc:0

You can do:
makemkvcon stream file:"/directory/to/BMDV/CERT/"

or:
makemkvcon stream iso:"/directory/to/filename.iso"

It would be great to be able to have this added into your script, if I had any know how to do this, I'd help out.


Audio killed when trying to play BluRay through MakeMKV? - 3choTh1s - 2010-01-20 23:47

When I try to use magnetism's great script for running bluray movies through makemkv and then streamed to xbmc, it seems to kill all audio from my system. First I see the video and then no sound with a "Failed to initialize audio device" error. After I stop the video there is no audio from anything. No system sounds, no navigation noises, and when I exit xbmc, ubuntu has no audio either. So when I say audio killed I mean totally. The only way I've found to get it back is to reboot my computer.

I'm running Ubuntu 9.04(i686) 32-bit, up to date as of 1-19-2010(yesterday). My xbmc version is SVN r27017 from the PPA. Also if this helps I've previously uninstalled pulseaudio as it was acting up whenever I put the machine to sleep and wake it up the sound would be gone. So far alsa has been working great and I can play any other video just fine audio and all.

Also to note is that I'm relying on the system to decode the audio and downmix to 2 ch, since I don't have a receiver and it's being outputed via analog.

Debug log:
http://pastebin.com/m27faf2a1

If there is anyone who could help me(maybe it's just the way I have my computer set up) I would be very much obliged.


- TeknoJnky - 2010-01-20 23:55

I have the same (or similar) issue on appletv/osx, losing all audio until reboot after playing kill bill vol 1 bluray m2ts.

http://forum.xbmc.org/showpost.php?p=488368&postcount=36


- magnetism - 2010-01-21 13:44

I'm on holiday ATM, so no access to my dev machine. I'll look in to supporting other makemkv modes once I'm back.
Some support for browsing discs etc should also be possible etc.


- hewittd - 2010-01-21 21:57

Thanks very much for making more work for me! I just pulled my Blu-Ray/HD-DVD combo drive out of my Linux HTPC box and put it in my Windows server, and I was opening BR's over a SMB share...now I have to put it back again!

Can't wait to try it out!