XBMC Community Forum  

Go Back   XBMC Community Forum > Off-Topic > Hardware Discussion

Hardware Discussion Talk about HTPC (Home Theater PC) and other hardware platforms (for XBMC).
Please, add platform prefix for suggestions that are not platform-independent!:
Thread prefixes; "[LINUX]", "[LIVE]", "[MAC]", "[WINDOWS]", and so on, etc.

Reply
 
Thread Tools Search this Thread Display Modes
Old 2010-01-15, 15:20   #1
magnetism
Member
 
Join Date: Dec 2008
Posts: 57
magnetism is on a distinguished road
Thumbs up [LINUX] HOW-TO playback Blu-ray Disc in XBMC for Linux with MakeMKV

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.

Last edited by magnetism; 2010-05-07 at 10:54. Reason: fixed URL in code
magnetism is offline   Reply With Quote
Old 2010-01-15, 22:11   #2
magnetism
Member
 
Join Date: Dec 2008
Posts: 57
magnetism is on a distinguished road
Default

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...

Last edited by magnetism; 2010-01-15 at 22:19. Reason: Indicate movie quality
magnetism is offline   Reply With Quote
Old 2010-01-15, 23:48   #3
jonassw
Senior Member
 
Join Date: Oct 2009
Location: Copenhagen, Denmark
Posts: 131
jonassw is on a distinguished road
Default

Oh thats cool. I'm going to borrow a Blu Ray from a friend tomorrow and check it out.
__________________
ASRock ION 330, Karmic Koala, XBMC 9.11~alpha2
jonassw is offline   Reply With Quote
Old 2010-01-16, 08:37   #4
Bahndit
Member+ (Donator)
 
Bahndit's Avatar
 
Join Date: Jul 2008
Location: Ogden, UT
Posts: 115
Bahndit is on a distinguished road
Default

That is pretty cool man. Keep up the good work.
Bahndit is offline   Reply With Quote
Old 2010-01-16, 14:32   #5
rodercot
Member+ (Donator)
 
Join Date: Feb 2008
Location: Ottawa, Canada
Posts: 674
rodercot is on a distinguished road
Default

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

Last edited by rodercot; 2010-01-16 at 14:41.
rodercot is offline   Reply With Quote
Old 2010-01-16, 20:04   #6
magnetism
Member
 
Join Date: Dec 2008
Posts: 57
magnetism is on a distinguished road
Default

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 is offline   Reply With Quote
Old 2010-01-16, 20:39   #7
magnetism
Member
 
Join Date: Dec 2008
Posts: 57
magnetism is on a distinguished road
Default

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
    - 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.
  • Hopefully, watch the movie.
Let me know if it works for you.

Last edited by magnetism; 2010-01-16 at 20:42. Reason: Layout
magnetism is offline   Reply With Quote
Old 2010-01-16, 21:06   #8
Encom
Junior Member
 
Join Date: Nov 2009
Posts: 5
Encom is on a distinguished road
Default

Works great!
Encom is offline   Reply With Quote
Old 2010-01-16, 23:34   #9
olafvs
Junior Member
 
Join Date: Jan 2010
Posts: 12
olafvs is on a distinguished road
Default

Three words: I love you!

Best script I have. I can finally watch Blu-rays.
olafvs is offline   Reply With Quote
Old 2010-01-20, 08:42   #10
3choTh1s
Junior Member
 
Join Date: Oct 2009
Posts: 4
3choTh1s is on a distinguished road
Default

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!
3choTh1s is offline   Reply With Quote
Reply

Bookmarks

Tags
audio, blu ray, blu-ray, bluray, how to, how-to, howto, makemkv, problem


Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)
dantoine
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:23.


Protected by Akismet, We recommend WordPress blogs
Copyright © 2010, XBMC Project