Bluray Playback?

Ok so i’ve had a chance to play around with this some more. So i’ve tested the drive attached to my PC and any DVD I have tried has played reliably. I haven’t ripped a DVD as I don’t have any did ripping software setup but i’m fairly confident that the drive is ok.

I’ve now been watching some DVD’s with Kodi and i’ve written a couple of scripts which seem to (almost) guarantee reliable playback.

So the first is the “eject” script which is fairly straightforward

#!/usr/bin/python
import os

kodi_command = 'kodi-send --action=\"Stop\"'
os.system(kodi_command)
try: os.system("eject cdrom")
except: 
	try: os.system('sudo umount /dev/sr0')
	except : pass
kodi_command = 'kodi-send --action=\"ActivateWindow(Favourites)\"'
os.system(kodi_command)

So it stops anything currently playing, ejects the disc and reloads the favourites screen (so you can launch the next script when you have swapped the disc).

The next is a script i’ve called “DVD_Fix” which seems to work more often than not:

#!/usr/bin/python
import os
import shutil

kodi_command = 'kodi-send --action=\"Stop\"'
os.system(kodi_command)
os.system("eject cdrom")
os.system('sudo umount /dev/sr0')
os.system('sudo mount /dev/sr0 /mnt/DVD')

#print(os.path.ismount('/mnt/DVD'))

BDMV = ''
i = 1
while BDMV == '' or i < 5000:
    print(i)
    i = i +1
    for root, subdirs, files in os.walk('/media'):
         for d in subdirs:
             if d == "VIDEO_TS":
	        	BDMV = os.path.join(root, d)
	        	BDMV = 'DVD'
             if d == "BDMV":
	        	BDMV = os.path.join(root, d + '/index.bdmv')
    if BDMV <> '':
	    break

if BDMV == 'DVD':
	kodi_command = 'kodi-send --action=\"PlayDVD\"'
	os.system(kodi_command)
else:
	kodi_command = 'kodi-send --action=\"PlayMedia(\"' + BDMV + "\")\""
	os.system(kodi_command)

if i > 20000:
	exit()

print(BDMV)
exit()

So this script will eject the DVD (if inserted), otherwise it will stop anything playing, inject the drive tray, then test if its a DVD or Bluray inserted and play each disc with the appropriate method.

The important part for DVD seems to be launching “play disc” immediatley after the disc is inserted, before the kodi “removable drive message” pops up.
So i think udiscs is mounting it correctly as a drive but when it gets mounted as a removable drive a few seconds later this then seems to prevent it playing properly as a DVD?
But if you insert the disk and then immediately launch “Play Disc” it mostly seems to work (tested on yatse remote too with just the “Eject Disc” command and the “Play Disc” command).

So it seems to be a timing issue?

I have noticed that when it doesnt work and an inserted dvd has refused to play or played incorrectly (menus get stuck, warning messages with garbled top half of screen) the “Eject” script often needs to be run twice before the disc ejects.
If that is significant do you think?

So i can provide logs if necessary but unless there is something about DVD mounting that can be easily changed within Kodi I think i may just have to live with this.
To be fair my two scripts are a pretty acceptable workaround for me, launch the eject script from the favourites and then the Dvd_Fix script to play the disc. I had thought about maybe making an addon and maybe monitor the drive or something, but anything more automated i think is likely to be more annoying than useful as you need to swap discs anyway and apart from occasionally having to eject and reinsert the same disc this mostly works from the favourites pretty well.

And given I cant watch any newer blurays I can use Kodi for DVD/Older Bluray and just use my not very good bluray player for anything with newer encryption.

Im hoping in the future Kodi can support BD+ as there is a bluray boxset from another region i’ve had my eye on and having a fully capable multi region bluray player would be sweet.

Why not just get ripping software. MakeMKV is a good choice and it’s currently free.

Well yes I could, but where would the fun in that be? :grinning:

Ok so I attempted to build MakeMKV for osmc and it didnt work, the saga:

Ok so i attempted to build MakeMkv (and also build FFMPEG with libfdk-aac) and install it on my system to get bluray playback working in Kodi and unfortunately it didn’t work (im on an ARMHF processor)

So this is the method i followed:

#####download tarballs for makemkv-bin, makemkv-oss and ffmpeg

wget https://www.makemkv.com/download/makemkv-bin-1.14.7.tar.gz

wget https://www.makemkv.com/download/makemkv-oss-1.14.7.tar.gz

wget https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2

#####install dependencies

sudo apt-get install build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev libqt4-dev zlib1g-dev

#####extract tarballs to home directory

tar xzf makemkv-bin-1.14.7.tar.gz

tar xzf makemkv-oss-1.14.7.tar.gz

tar xjf ffmpeg-4.2.2.tar.bz2

#####dependancy needed for FFMPEG

sudo apt-get install libfdk-aac-dev

#####Build FFMPEG (took a good 1-2 hours)

cd /home/osmc/ffmpeg-4.2.2/

./configure --prefix=/tmp/ffmpeg --enable-static --disable-shared --enable-pic --enable-libfdk-aac --enable-cross-compile --arch=armel --target-os=linux

make

make install

#####Build makemkv-oss

cd /home/osmc/makemkv-oss-1.14.7/

PKG_CONFIG_PATH=/tmp/ffmpeg/lib/pkgconfig ./configure --prefix=/usr

make

sudo make install

#####GOT AN ERROR BUILDING MAKEMKV-BIN==>MakeMKV is currently not available for architecture aarch64

#cd /home/osmc/makemkv-bin-1.14.7/

#./configure --prefix=/usr

#make

#sudo make install

#####ERROR==>MakeMKV is currently not available for architecture aarch64. Stop.

rm -rf /tmp/ffmpeg

#####UPDATE SIMLINKS FOR LIBMMBD

cd /usr/lib/arm-linux-gnueabihf

sudo mv libaacs.so.0 libaacs.so.0.bak

sudo mv libbdplus.so.0 libbdplus.so.0.bak

sudo ln -s /usr/lib/libmmbd.so.0 libaacs.so.0

sudo ln -s /usr/lib/libmmbd.so.0 libbdplus.so.0

So i was able to build FFMPEG and MAKEMKV-OSS but i was unable to build MAKEMKV-BIN for ARMHF and this is actually the important part of the software so for any ARM Kodi setup MAKEMKV WILL NOT WORK.

At this point i saw that libmmbd had been installed and I attempted simlinking libaacs.so.0 and libbdplus.so.0 anyway, but all that gave me were kodi smiley face errors when it tried to play any bluray and it attempted to decrypt aacs. Either due to missing components (makemkv-bin not installed?) or just unsupported on this system.

SO if you are on a PC or PC type processor (X86_X64/AMD64 etc) the above will work and/or you can install the precompiled versions from heyarje (and some tips below if you are having trouble getting them installed from there. I got them installed on an ARM system which I would say is in no way advisable, see all the random crap i had to do before it installed, probably more straightforward if the system is actually supported)

So I was able to get makemkv-bin and makemkv-oss installed from here: Index of /heyarje/makemkv-beta/ubuntu

#####add the repo to your sources list

sudo nano /etc/apt/sources.list

deb http://ppa.launchpad.net/heyarje/makemkv-beta/ubuntu zesty main

#####add the PUBKEY for " ppa.launchpad.net/heyarje "

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8540356019F7E55B

At this point on a supported system “sudo apt-get update && sudo apt-get install makemkv-bin makemkv-oss” should work

But to get it to install on mine…

#####I needed to add the amd64 architecture as they are compiled for a different system (probably not a good idea to try this but i just wanted to see if it would work, it doesnt)

sudo dpkg --add-architecture amd64

#####I then had to install a bunch of dependencies to get it to install (again because im on ARMHF and these MakeMKV files have been compiled for amd64)

#####So the following is just a dump of my bash history - Notice all the "Fix Broken Installs" - If you absolutely want to install makemkv on an unsupported processor, FOLLOW AT YOUR PERIL!

cd ~/

wget https://launchpad.net/~heyarje/+archive/ubuntu/makemkv-beta/+files/makemkv-bin_1.14.7-1~xenial_amd64.deb

sudo dpkg -i /home/osmc/makemkv-bin_1.14.7-1~xenial_amd64.deb

sudo apt-get install makemkv-bin

sudo apt --fix-broken install

sudo dpkg -i /home/osmc/makemkv-bin_1.14.7-1~xenial_amd64.deb

wget https://launchpad.net/~heyarje/+archive/ubuntu/makemkv-beta/+files/makemkv-oss_1.14.7-1~xenial_amd64.deb

sudo dpkg -i /home/osmc/makemkv-oss_1.14.7-1~xenial_amd64.deb

sudo apt-get update && sudo apt-get install makemkv-bin makemkv-oss

sudo apt --fix-broken install

sudo apt-get update && sudo apt-get install makemkv-bin makemkv-oss

sudo apt-get install libssl1

wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb

sudo dpkg -i /home/osmc/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb

sudo apt-get update && sudo apt-get install makemkv-bin makemkv-oss

wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

sudo dpkg -i /home/osmc/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

sudo apt-get install libc6

sudo apt --fix-broken install

sudo dpkg -i /home/osmc/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

sudo apt-get update && sudo apt-get install makemkv-bin makemkv-oss

So after this attempting to play a bluray and it looks like it might work but nothing plays, presumably because it is trying to launch makemkv-bin and it wont load as it has not been compiled for ARMHF - (/usr/bin/makemkv: cannot execute binary file: Exec format error)

So i just put my simlinks back to the original libaacs.so.0.5.1 for my version of Kodi:

cd /usr/lib/arm-linux-gnueabihf

sudo rm libaacs.so.0

sudo ln -s /usr/lib/arm-linux-gnueabihf/libaacs.so.0.5.1 libaacs.so.0

So just doing the install doesnt appear to have broken anything but it doesnt work. :frowning:

So long story short - until there is a version of MakeMKV-Bin which can be compiled for ARM processors this will not work on OSMC (but does apparently work on regular versions of Kodi 18.5)

Collecting some stuff for future reference:
[ Linux - DVD Automount]
https://forum.kodi.tv/showthread.php?tid=283756&page=2

Linux HOW-TO playback Blu-ray Disc in XBMC for Linux with MakeMKV (Plugin Addon)
https://forum.kodi.tv/showthread.php?tid=67420

Use libmmbd (MakeMKV) to play Blu rays on Windows
https://forum.kodi.tv/showthread.php?tid=189402

Linux How to associate “Play disc” with the Blu-ray discs?
https://forum.kodi.tv/showthread.php?tid=134828&page=7

Linux HOW-TO playback Blu-ray Disc in XBMC for Linux with MakeMKV (Plugin Addon)
https://forum.kodi.tv/showthread.php?tid=67420&highlight=makemkv

/r/Kodi - Makemkv - Kodi add-on (bluray)?https://www.reddit.com/r/kodi/comments/ejj2ua/makemkv_kodi_addon_bluray/

Makemkv Forum - Makemkv - Kodi 18 add-on/bluray decryption + playback
https://www.makemkv.com/forum/viewtopic.php?f=3&t=21219

@henryjfry

I think you misunderstood bmillham I’m 99.99% sure he meant that you should rip your Discs on a pc using Makemkv. Not on the vero

1 Like

Yeah I got that, but my objective was to be able to watch blurays on my Kodi box not rip them on my pc and then watch them on my Kodi box.
Plus I’m not really interested in ripping my blurays just playing them. Although I get why someone might think otherwise as it is called makemkv.

I’m aware that I could easily install the makemkv beta in windows and use it to rip my blurays.

But I wanted to know could the makemkv libmmbd library be used to play bluray on osmc.

And it can’t because makemkv-bin won’t build on an armhf system.

For all the information I could find I had to spend several hours building stuff before that became apparent.
I couldn’t even see anything online which would confirm if it worked for Kodi for linux before I made a Reddit post about this and someone kindly commented back that they have just done it on lubuntu and Kodi 18.5

So I just wanted to make sure the information was available for other people to find before they would maybe attempt it themselves.

So until the osmc bdplus issues are resolved or makemkv release an arm version, it looks like only blurays without bd+ encryption can be played on osmc.

Which is fine, I do have a bluray player I’d just like to be able to play everything on osmc, because why not?

(Also the steps for compiling ffmpeg might be useful to some folk, I couldn’t get it to work myself initially and the information I was able to find isn’t as clear as the step by step commands I have provided, which do work although I’m not sure “–arch=armel” is 100% correct, maybe “–arch=armhf” for Vero?)

Hello,
this thread helped me a lot to get my blueray setup working with osmc. Thank you very much! specially to henryjfry for the code. At least for my setup there was still a problem with blueray play/eject.

I had to do some chances to the code (DVD_Fix) due to a new python version ( “<>” seems to be depreciated and “!=” is the new equivalent) and I had a problem with tab and spaces (at least i think so) to be able to use it. It may help other folks. (Comment 41)

Further I commented out a part. I dont know what it does exactly, but for me it is working. With the lines in the CD/Blueray was eject and I had to put it in again, before it started to play.

#os.system(“eject cdrom”)
#os.system(‘sudo umount /dev/sr0’)
#os.system(‘sudo mount /dev/sr0 /mnt/DVD’)

First step I did was a to make a favourite.xml in the folder /.kodi/userdata/favourites.xml

<favourites>
    <favourite name="Play Blueray">RunScript(/home/osmc/blueray.py)</favourite>
    <favourite name="Eject CD" >RunScript(/home/osmc/eject.py)</favourite>
</favourites>

than I put the two edited scripts from henryjfry in the home folder.

#!/usr/bin/python
import os
import shutil

kodi_command = 'kodi-send --action=\"Stop\"'
os.system(kodi_command)
#os.system("eject cdrom")
#os.system('sudo umount /dev/sr0')
#os.system('sudo mount /dev/sr0 /mnt/DVD')

#print(os.path.ismount('/mnt/DVD'))

BDMV = ''
i = 1
while BDMV == '' or i < 5000:
    print(i)
    i = i +1
    for root, subdirs, files in os.walk('/media'):
         for d in subdirs:
             if d == "VIDEO_TS":
                BDMV = os.path.join(root, d)
                BDMV = 'DVD'
             if d == "BDMV":
                BDMV = os.path.join(root, d + '/index.bdmv')
    if BDMV != '':
	    break

if BDMV == 'DVD':
	kodi_command = 'kodi-send --action=\"PlayDVD\"'
	os.system(kodi_command)
else:
	kodi_command = 'kodi-send --action=\"PlayMedia(\"' + BDMV + "\")\""
	os.system(kodi_command)

if i > 20000:
	exit()

print(BDMV)
exit()

The eject script is working as it is from henryjfry please see his comment 41.