Kodi Community Forum

Full Version: Mac how to play encrypted bluray discs using play disk button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This is how I was able to play encrypted blu-rays on my os x machine opening them with the play disc button in the Kodi home screen.

To play encrypted blu-rays download MakeMKV (if you like it or use it often buy it) then create symbolic links to libmmbd.dylib to simulate blu-ray libraries.

cd ~
mkdir ~/lib
ln -s /Applications/MakeMKV/Contents/lib/libmmbd.dylib ~/lib/libaacs.dylib
ln -s /Applications/MakeMKV/Contents/lib/libmmbd.dylib ~/lib/libbdplus.dylib

Make your symbolic links executable

Sudo chmod 755 ~/lib/libaacs.dylib
Sudo chmod 755 ~/lib/libbdplus.dylib

Now to associate blurays with the play disc button. I would like to thank teedubb for his solution. I borrowed heavily from it but made several alterations to make it work with os x.

We will need to edit the home.xml of your skin I use confluence and use a 720p monitor so for me it was:

sudo nano /Applications/Kodi/Contents/Resources/Kodi/addons/skin.confluence/720p/home.xml

Your file path may be different depending on your preferred skin and resolution.

Find this line in home.xml

<onclick condition=“!HasMediaDVD">PlayDVD()</onclick>

And change it to this (just change my user name "mike" with your user name. Make sure that any path where you see my user name you replace it with your user name.)

<onclick condition=“!HasMediaDVD">RunScript(/Volumes/Macintosh HD/mike/Blu-ray/kodi-play-disc.py)</onclick>

CTRL-X, Y, ENTER to save and exit

Now make a folder to be home to your blu-ray scripts
mkdir ~/Blu-ray



Create your first script (don't forget to change user names)
nano /Volumes/Macintosh HD/mike/Blu-ray/kodi-play-disc.py
And type this text:

import os

os.system('/Volumes/Macintosh\ HD/mike/Blu-ray/kodi-play-disc.sh &')


CTRL-X, Y, ENTER to save and exit

Create your second script
nano /Volumes/Macintosh HD/mike/Blu-ray/kodi-play-disc.sh (don't forget to change user names)
And type or paste this text:

#!/bin/bash
#script to play dvd/cd/bluray with kodi

BD_DISC=$(find /Volumes/*/BDMV/index.bdmv)

if [ $(find /Volumes/*/BDMV/index.bdmv) ]; then

curl --data-binary '{"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"'"$BD_DISC"'"}}}' -H 'content-type: application/json;' http://127.0.0.1:8080/jsonrpc

else

curl --data-binary '{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"dvd:\/\/1"}}}' -H 'content-type: application/json;' http://127.0.0.1:8080/jsonrpc

fi


CTRL-X, Y, ENTER to save and exit


Make both scripts executable.

Sudo chmod 755 /Volumes/Macintosh HD/mike/Blu-ray/kodi-play-disc.py
Sudo chmod 755 /Volumes/Macintosh HD/mike/Blu-ray/kodi-play-disc.sh

Everything should work for you at this point. Kodi should play encrypted blu-ray discs with the help of MakeMKV. The play disc button should work for blu-rays and dvds. I don't own a single cd so I can't verify if they play with the button or not.


If you have any problem make sure that you replaced my user name with yours (it's in nearly every file path including those in the edited xml line and scripts)
I'd like to add that you should activate "System -> Settings -> Services -> Webserver -> Allow programs on this system to control Kodi" to get this procedure to work.

Also, on the version of Kodi (14.2 March 26, 2015) that I'm running, there wasn't a line in my home.xml with "<onclick condition=“!HasMediaDVD">PlayDVD()</onclick>", however, there was one with "<onclick PlayDVD()</onclick>". I replaced "PlayDVD()" with "RunScript(/Volumes/Macintosh HD/mike/Blu-ray/kodi-play-disc.py)".

Both DVDs and Blurays play when the "Play Disc" button is clicked.

Thanks Michael.

-dgktkr
dgktkr,

Thanks for mentioning the webserver settings. I tried to post every step but this one important step slipped my mind. I'm glad this worked for you. It took me some trial and error to get it working and I wanted as many people as possible to benefit from it.

Micheal
so I was setting up my machine after upgrading and noticed i left out some important information for getting this to work.

first you need to install the command line tools. to do this without installing Xcode open a terminal window. type this command:

xcode-select --install

follow the prompts. the download is small and doesn't take much time.

then you need to install the JSON module. type this in a terminal window:

sudo cpan install JSON

i also updated my shell script. i found the original wouldn't allow cds to play. my new script lets me play blu-ray/dvd/cd
here it is:

#!/bin/bash
#script to play dvd/cd/bluray with xbmc
set -x

BD_DISC=$(find /Volumes/*/BDMV/index.bdmv)
dvd:\/\/1=$(find /Volumes/*/VIDEO_TS/VIDEO_TS.VOB)

if [ $(find /Volumes/*/BDMV/index.bdmv) ]; then

curl --data-binary '{"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"'"$BD_DISC"'"}}}' -H 'content-type: application/json;' http://127.0.0.1:8080/jsonrpc

elif [ $(find /Volumes/*/VIDEO_TS/VIDEO_TS.VOB) ]; then

curl --data-binary '{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"dvd:\/\/1"}}}' -H 'content-type: application/json;' http://127.0.0.1:8080/jsonrpc

else

curl --data-binary '{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "directory": "cdda://local/" } }, "id": 1 }' -H 'content-type: application/json;' http://127.0.0.1:8080/jsonrpc

fi
These instructions seem to have changed in 16.1 and El Capitan

The symlinks are now:

ln -s /Applications/MakeMKV.app/Contents/lib/libmmbd.dylib ~/lib/libaacs.dylib
ln -s /Applications/MakeMKV.app/Contents/lib/libmmbd.dylib ~/lib/libbdplus.dylib

/Applications/Kodi.app/Contents/Resources/Kodi/addons/skin.confluence/720p/Home.xml is now the file to edit.

In the .py file I needed to add to the start:

#!/usr/bin/env python

But when I try this from Kodi or from the command line the error I now get is:

Quote:./kodi-play-disc.sh
++ find '/Volumes/Ghostbusters II/BDMV/index.bdmv'
+ BD_DISC='/Volumes/Ghostbusters II/BDMV/index.bdmv'
++ find '/Volumes/*/VIDEO_TS/VIDEO_TS.VOB'
find: /Volumes/*/VIDEO_TS/VIDEO_TS.VOB: No such file or directory
+ dvd://1=
./kodi-play-disc.sh: line 6: dvd://1=: No such file or directory
./kodi-play-disc.sh: line 20: syntax error: unexpected end of file

What am I doing wrong? I also have nginx running on port 8080 which doesn't help!

The good new is now it works in VLC at least

When I try the original script I get:

./kodi-play-disc.sh: line 6: [: /Volumes/Ghostbusters: unary operator expected
curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused
I haven't changed my scripts or symlinks or the modifications to home.xml. I can confirm they are working for me with os x el capitan 10.11.5 and kodi 16.1 git:2016-04-24-c327c53.

the reason vlc is working for you is that it looks for libaacs.dylib and libbdplus.dylib vlc does not need the scripts we created only the .dylib from makemkv . this tells us that the symlinks are in place, executable and that makemkv is current and registered. also you tend to get this fault "curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused" when kodi is off or the service isn't activated in kodi

which means the issue is in the remote control of kodi from your computer. the scripts work for me as written in my previous posts so return them to that state then open kodi, select system, settings, services, web server make sure "Allow programs on this system to control Kodi" is selected.

kodi launches the .py script to grab the attention of your os so it needs to stay the way it was written. the shell script is then executed by your os to remotely control kodi. if you need to test the shell script it can be dragged and dropped into terminal to be executed. However kodi will need to be on and the remote service active in order for it to work.

is Xcode or command line tools installed? is the JSON module installed?
This was the first topic I came across trying to play my blurays on osx with kodi and it was very useful. I want to share my solution for the lazy ones Smile
The first step is already familiar to you - install MakeMKV and run in terminal:

cd ~
mkdir ~/lib
ln -s /Applications/MakeMKV.app/Contents/lib/libmmbd.dylib ~/lib/libaacs.dylib
ln -s /Applications/MakeMKV.app/Contents/lib/libmmbd.dylib ~/lib/libbdplus.dylib

The next step is editing your theme's Home.xml:
Find
Code:
<onclick condition=“!HasMediaDVD">PlayDVD()</onclick>
change to
Code:
<onclick condition=“!HasMediaDVD">RunScript("special://skin/rundisc.py")</onclick>

The final step is creating rundisc.py in your theme's root directory. The contents should look like:

Code:
import glob
import xbmc

BDDISC = glob.glob('/Volumes/*/BDMV/index.bdmv')

if len(BDDISC) > 0:
  xbmc.Player().play(BDDISC.pop())
else:
  xbmc.executebuiltin('XBMC.PlayDVD()')

After these three steps you should get a fully working solution playing all the BD's, DVD's and ACD's without invoking the JSONRPC and Kodi's web-server.
And thanks for the initial post! Cheers.
aimsson i have to say i do like your way better
UPDATE

Linking MakeMKV's libaacs.dylib and libbdplus.dylib into ~/lib no longer works for Kodi Krypton. Browsing for and playing the bdmv.index of a bluray disc plays the audio for 10-15 seconds, but the video is garbled into 4 bright randomly colored bands across the screen with black in between. Then Kodi crashes.

The Kodi debug file contains:

16:54:39.460 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:78: AACS/Unit_Key_RO.inf found. Disc seems to be AACS protected.
16:54:39.462 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:104: Using libaacs for AACS
16:54:39.462 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:128: Loading aacs library (0x60800018d4e0)
16:54:39.462 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:139: Loaded libaacs (0x60800018d4e0)
16:54:39.462 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:142: Registering libaacs filesystem handler 0x106fc9980 (0x60800018d4e0)
16:54:39.463 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:182: Using old aacs_open2(), no UDF support available
16:55:41.353 T:123145480142848 DEBUG: CDVDInputStreamBluray::Logger - dec.c:202: Opened libaacs
16:55:52.760 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:78: AACS/Unit_Key_RO.inf found. Disc seems to be AACS protected.
16:55:52.761 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:104: Using libaacs for AACS
16:55:52.761 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:128: Loading aacs library (0x60800018d4e0)
16:55:52.761 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:139: Loaded libaacs (0x60800018d4e0)
16:55:52.761 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:142: Registering libaacs filesystem handler 0x106fc9980 (0x60800018d4e0)
16:55:52.761 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - aacs.c:182: Using old aacs_open2(), no UDF support available
16:56:53.049 T:123145475313664 DEBUG: CDVDInputStreamBluray::Logger - dec.c:202: Opened libaacs
16:56:53.051 T:123145475313664 DEBUG: CDVDInputStreamBluray::Open - AACS detected : 1
16:56:53.051 T:123145475313664 DEBUG: CDVDInputStreamBluray::Open - libaacs detected : 1
16:56:53.051 T:123145475313664 DEBUG: CDVDInputStreamBluray::Open - AACS handled : 1


I'm looking for a solution. If someone else reading this has figured out a fix, please post it.

dgktkr
Which version of krypton are you using? I had everything working in beta 5 but just downloaded beta 6. I see the home.xml has changed between beta versions and have yet to bother with it. Getting blu ray discs to play was just something I took on to see if I could do it. I almost always make an mkv backup of my discs anyway so I just do it from the start now. I only directly play rentals and lately I haven't rented much of anything. Since Kodi is a continually improving project "hacks" that once worked may not work the same way again also the developer understandably are trying to make copyright infringement difficult. Have you tried other paths? Such as the built in streaming function of make mkv. I'm sure vlc still works with the make mkv .dylib files have you tried using vlc for videos? If you are using beta 5 I can provide for you a copy of my home.xml file otherwise I don't know when I'll get around to figuring it out. In the past I have found that when I get a program such as Kodi working the way I want to I don't upgrade it unless I can't live without one of the new features. sorry I can't be of more help to you at this time.
so i took a minute to look at it for you last night and i have it working. i made some changes to how things are accomplished. primarily because the current beta version does not have a play disc menu/button (at least with a blu ray). so my first recommendation is to make sure you are running a current version of makemkv (nothing will work properly unless you are). second create a file called rundisc.py as per aimsson. containing this code :
Code:
import glob
import xbmc

BDDISC = glob.glob('/Volumes/*/BDMV/index.bdmv')

if len(BDDISC) > 0:
  xbmc.Player().play(BDDISC.pop())
else:
  xbmc.executebuiltin('XBMC.PlayDVD()')


then in your keyboard.xml or remote.xml or custom controller.xml (whatever you are using). assign this code to key/button:
Code:
RunScript(/path/to/your/rundisc.py)

this should work anytime a disc is in your drive. this should also work with skin changes as well.
Micheal, thank you of letting us know that the procedure works well for Kodi Krypton Beta 6. I've tried it now, and things do indeed work well using the details above. I've programmed the disc to play by pressing "p" on the keyboard when the Home screen is showing. I find that more convenient that navigating to a button on the screen.

The video dysfunction I described above was cured by turning off hardware acceleration! Blu rays play beautifully now.

dgktkr
Hi all. I'm using Kodi 16.1 on a Mac min, trying to use aimsson method but it doesn't work.
Here is the log when I try to play a Bluray :
Code:
23:35:57 T:123145304526848 WARNING: CPythonInvoker(2): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
23:36:02 T:140735135481856  NOTICE: DVDPlayer: Opening: /Volumes/THE_GOOD_DINOSAUR/BDMV/index.bdmv
23:36:02 T:140735135481856 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
23:36:02 T:123145304526848  NOTICE: Creating InputStream
23:36:02 T:123145304526848   ERROR: CDVDInputStreamBluray::Open - Media stream scrambled/encrypted with AACS
23:36:02 T:123145304526848   ERROR: CDVDPlayer::OpenInputStream - error opening [/Volumes/THE_GOOD_DINOSAUR/BDMV/index.bdmv]
23:36:02 T:123145304526848  NOTICE: CDVDPlayer::OnExit()
23:36:02 T:140735135481856  NOTICE: CDVDPlayer::CloseFile()
23:36:02 T:140735135481856  NOTICE: DVDPlayer: waiting for threads to exit
23:36:02 T:140735135481856  NOTICE: DVDPlayer: finished waiting
23:36:02 T:140735135481856  NOTICE: CDVDPlayer::CloseFile()
23:36:02 T:140735135481856  NOTICE: DVDPlayer: waiting for threads to exit
23:36:02 T:140735135481856  NOTICE: DVDPlayer: finished waiting

A note : I did not symlink the dylibs but instead copied them to the ~/lib folder. Is this the cause of my problem? Thing is, i used the trial/demo version of makemkv, I don't know if this is relevant... (VLC does not work either...)

Then a minor concern : is the "WARNING: CPythonInvoker(2): Script invoked without an addon." a problem?

Thanks in advance for your help
Can you run makemkv from Launchpad?

I've got the dylibs in /usr/local/lib and things work for me (with hardware acceleration turned off).

dgktkr
Hey dgktkr!

I'm sorry, it seems my latest message was not posted : IT WORKS now. I removed the copies and placed symlinks, as originally instructed, and it worked. So, sorry, I thought I'd be clever and it appears that I've actually been dumb ;-)

This leads to another issue : the main feature on the BR plays, but no menus whatsoever. I read that's a known issue, related to the fact that BR menus are in Java, blah blah blah. It's annoying but I guess I'll just have to wait for somebody to work on that?
Pages: 1 2