Jump to content


Photo

A Method to Enable Playback of Commercial Blu-ray/DVD Discs Within Emby Theater

blu-ray discs DVD discs external player Emby Theater

  • Please log in to reply
4 replies to this topic

#1 latenighter OFFLINE  

latenighter

    Member

  • Members
  • 12 posts
  • Local time: 07:15 PM
  • LocationUK

Posted 05 November 2018 - 10:48 AM

Overview

 

A lot of the details within this post are based on information I have gleaned over the last few years when I set up commercial Blu-ray disc playback within my WMC installation which I am now in the process of replacing with Emby Theater.  As such, a lot of the detail is obtained from others work that had been published on the internet.  Due to the mists of time I don’t have the original references/links to share but I’d like to doff my cap to the trailblazers and forward-thinking software developers whose original work this is based on.  Through the course of this information I’ll also include any relevant experiences of my own in case they help with troubleshooting in the event someone making use of this advice hits a problem.

 

The general recommendation from the Emby team is to have all your media “online” on your server and for media on the discs you own this means ripping to HDD in some way.  This makes it accessible to the widest selection of Emby clients.  However you may have a reason why you don’t want to do this.  You may have storage limitations.  You may find yourself repeating rips trying to identify the correct language version you want - video, audio or subtitles.  You may like watching the extra features included on your multi-disc sets and don’t relish the extra effort to organise them for the server.  Being able to play your discs directly can avoid a lot of potential concerns though it can introduce others of its own.  Of course, whether you rip or play, your PC needs to be equipped with a drive capable of reading Blu-ray discs though the approach I use will work with DVDs alone if you only have a DVD drive.  Your PC also needs to have sufficient horsepower for the processing required – though most available nowadays will have this.

 

There are 3 stages to this game:

  1. Install software to enable your PC to play your commercial Blu-ray discs.
  2. Create external player definitions within Emby Theater.
  3. Create library entries for your disc collection on your server so that the external player definitions in Emby Theater get triggered to play the discs.  Done the right way this also stops other Emby clients without an external player linkage from “circling” when they can’t make sense of/use the library entry selected.

 

Software

 

A search on the internet shows many ways this can be done.  The main challenge is dealing with the encryption usually applied to commercial discs and the fact that it is always evolving.  Personally I prefer an approach that minimises any need to maintain the capability after initial set-up and the software combination that does this for me is:

  • VLC Player (v3.0.4 at the time of writing)
  • MakeMKV (v1.12.3 at the time of writing)
  • Java Runtime Environment (version 8, update 191 at the time of writing)

VLC is what actually plays the discs.  MakeMKV is used to provide encryption handling for VLC and Java RE is required by VLC for some varieties of Blu-ray menus.  Here’s the links for the download pages from the official sites:

One important thing to match up across this software combination is whether you are using the 64- or 32-bit versions.  For VLC and Java RE you have to choose between 64- and 32-bit.  MakeMKV installs both versions.  With VLC prior to v3 I had problems with the hardware acceleration of the 64-bit version so I matched up on 32-bit.  With v3 of VLC I have not encountered any issues with 64-bit.

 

First off, download and install all 3 programs.  All 3 programs are that well known that you may already have them installed and you only need to check that you’re matched up on 64- or 32-bit.  And if you haven’t come across one or more of these programs before don’t hesitate to read up about it so you have confidence about what you are doing.

 

As above, VLC is the software that will actually play the discs and for it to be able to read encrypted discs it requires working libaacs.dll and libbdplus.dll modules in its main folder (C:\Program Files\VideoLAN\VLC is the default location for 64-bit, C:\Program Files (x86)\VideoLAN\VLC for 32-bit).  These .dll modules don’t get included automatically by VLC itself but, handily, MakeMKV has .dll modules that provide the required entry points and logic.  Look in the main folder for MakeMKV (C:\Program Files (x86)\MakeMKV is the default location) and identify libmmbd64.dll (64-bit) or libmmbd.dll (32-bit).  Copy the MakeMKV .dll module matched to your 64- or 32-bit requirements twice to the VLC main folder, renaming there to libaacs.dll and libbdplus.dll.  The more adventurous could create junction points in the VLC main folder pointing at the relevant MakeMKV .dll module.  I don’t do this but it could save an extra step if you ever had to update/re-install MakeMKV in the future.

 

When you first installed MakeMKV it would have been installed with a “beta key” that , depending on the point in the MakeMKV lifecycle, could be valid for a short period of time up to a couple of months.  If you continue to rely on the beta key then once the current value expires it is necessary to update it.  The latest beta key value is freely available via a link on the MakeMKV download page but it requires editing the Windows Registry to update it onto your PC.  Because the key value is held in the user hive of the registry you also have to edit the registry if you want to have more than one user to be able to play Blu-ray discs (eg. multiple Emby Theater instances).  Here’s a description of what to look out for in the registry and what you would need to add for an extra user:

 

Windows Registry Editor Version 5.00

 

[HKEY_USERS\S-i-j-kk-mmmmmmmmmm-nnnnnnnnnn-ppppppppp-qqqq\SOFTWARE\MakeMKV]

"app_Key"="T-... "

 

[HKEY_USERS\ S-i-j-kk-mmmmmmmmmm-nnnnnnnnnn-ppppppppp-rrrr\SOFTWARE\MakeMKV]

"app_Key"="T-... "

 

where S-...-qqqq/S-...-rrrr are examples of the internal user IDs in the Windows Registry and, once expanded to its full value, T-... is the MakeMKV beta key value.  The text above can be used as the basis to create a .reg file using NotePad or similar that can then be used to semi-automate the registry updates – once created it is only necessary to update the key value in the .reg file when it expires and then double-click the .reg file.  As always, whichever method you use to update the Windows Registry, always take a backup first in case of mistakes and you stop your PC working.

 

Please note that only when a user is logged in will their user hive be loaded in the Windows Registry and be editable.  If the user is logged on, you can check which S-...-qqqq equates to which Windows username by checking the entries under this key in the registry:

 

[HKEY_USERS\S-i-j-kk-mmmmmmmmmm-nnnnnnnnnn-ppppppppp-qqqq\Volatile Environment]

 

The same information for the active user is shown under this key:

 

[HKEY_CURRENT_USER\Volatile Environment]

 

Your other users may also have standard accounts rather than being members of the Administrators group.  In this case you’ll need to use an account that is a member of the Administrators group to make these registry changes for them.  One way, for instance, is to have the standard user log on but then employ “Switch User” to get to the account under which you’ll be making the registry changes while the standard user is still logged on in the background.

 

This short two-monthly maintenance action for the beta key value can be obviated by purchasing a “full activation key” for MakeMKV.  A link for doing this is present on the latest beta key value page.

 

At this stage you should now be able to play the commercial Blu-ray discs you own on your PC without hindrance by opening VLC.

 

 

External Player Definition

 

Emby Theater external player definitions can be set up for a number of classes of media.  Indeed they can be used to override the internal player used by Emby Theater.  Here’s the current list of options under which a definition can be set up under the “Video” category:

 

Video files

Internet streams

Blu-ray

Dvd

ISO

 

For our purposes we are going to set up a single external player definition to cover both Blu-ray and Dvd and ignore the rest of the options.  The approach I’ve adopted is to use a .bat file that initiates VLC.  It is possible to set up two separate external player definitions using direct program references to VLC - the two definition approach is forced because of how you open different media classes in VLC - but this reduces flexibility/flow.  The .bat file also tries to smooth the visual transition between Emby Theater being on your screen, VLC playing a disc and back again.  A further benefit is that it is the same .bat file used for both the Blu-ray and Dvd and so it doesn’t matter what type of disc you actually insert - as long as it’s one you want to play and compatible with your drive.  I’ve attached the .bat file I use:

 

VLC-PlayDiscforEmbyTheater.bat

Attached File  VLC-PlayDiscforEmbyTheater.txt   2.04KB   8 downloads

 

to this post though have renamed it to .txt to comply with attachment restrictions.  Feel free to create your own .bat file if you wish, using the attachment as a template as much as you want.  One tweak you may need if you use the attachment is to change the default optical drive reference to one appropriate for your PC.

 

EDIT: Please refer to the Library Entries section if you have online Blu-ray/DVD content for an alternative version of the .bat file if you wish to make use of that..

 

Looking at the attached .bat file you will notice that I make use of the NirCmd.exe utility, that has been developed by Nir Sofer, to handle some of the process interactions (eg. minimising/maximising windows, putting a user dialog on the screen).  I’ve seen other members of the Emby community use and reference this and it works for me.  This link gives some basic usage information and the download links for .zip files containing the utility are found at the very bottom of the web page:

 

https://www.nirsoft....ils/nircmd.html

 

If you use the .bat file attachment I’ve provided as-is you’ll need to unzip the download for NirCmd to a suitable location.  For my own purposes I’ve put it into C:\Program Files\NirSoft though it isn’t installed in the traditional sense.  Again, if you have any worries about unknown software, don’t hesitate to explore alternatives you are comfortable with.  For myself, looking to the future, I may see if I can create my own .exe to do the same job as the .bat file giving me the option to employ a user dialog visually more in keeping with Emby Theater.

 

As I’m migrating from WMC I have a MCE remote.  VLC seems to work with this “out the box”, at least sufficiently so for my needs.  There is a multitude of start-up parameters that can be specified for VLC to control how it interacts with a keyboard and more specialised remotes.  I haven’t explored them myself but the post linked below more than hints at what is possible:

 

https://emby.media/community/index.php?/topic/43054-considering-emby/?p=402646

 

In comparison the paltry VLC parameters used in my .bat file and why are:

 

--no-qt-bgcone

Don’t display background cone or current album art when not playing.  (Keeps the VLC window clean until the disc is playing.)

 

--fullscreen

Start video in fullscreen mode.  (Once it starts playing the disc, VLC is in full-screen mode.)

 

--play-and-exit

Exit if there are no more items in the playlist.  (The disc is the only playlist item so once you stop playing VLC exits and control returns to Emby Theater.)

 

--bluray-menu

Use blu-ray menus.  If not set the main feature will start.  (Left to its own devices VLC could start with the wrong language version - video, audio or subtitles – though you can select alternative tracks/streams to correct this while VLC is playing.)

 

It will become apparent why in the Library Entries section but the .bat file I use allows for the co-existence of offline and online library entries defined as Blu-ray or Dvd on your server.  This possibility is another drawback of using direct references to the VLC program in your external player definition as the definitions will force all entries defined as Blu-ray or Dvd to be treated throughout your library as all offline or all online.

 

I’ve also attached a screenshot of how the completed Emby Theater external player definition looks:

 

Emby Theater External Player Set-up.jpg

Attached File  Emby Theater External Player Set-up.jpg   89.05KB   8 downloads

 

Note that I’m not invoking the .bat file directly but going via cmd.exe.  Experimentation and review of external player-related posts show that it is a bit of a dark art how the command parameter element of the definitions get passed on from Emby Theater.  For instance, using the .bat file directly, I never found a way to successfully use the built-in {path} parameter value.  The definition approach presented seems to work provided the full path and name of the .bat file does not contain spaces or the special characters:

 

&()[]{}^=;!'+,`~)

 

The limitation seems to be based around how Emby Theater escapes, or doesn’t, the special characters.  Whether you use your own .bat file or not, an idea I follow is to place it in the hidden C:\ProgramData folder that all users have read access to and, if you create your own folder within it to hold the .bat file, it makes it immune to uninstalls/re-installs of other software.

 

 

Library Entries

 

The library entries you’ll set up for your commercial discs follows the recommended Emby naming conventions for movies and TV episodes.  I strongly recommend you look these up if you are not already familiar.  Links are:

 

https://github.com/M...ki/Movie-naming

 

https://github.com/M.../wiki/TV naming

 

I started this exercise using the media stub approach, thinking this was the way to go when there was no actual media file as part of the structure.  Unfortunately it seems the Emby clients just use these stub entries to display a message that the media is not available – and sometimes not too gracefully at that.  Other clients, such as Kodi via the EmbyCon or Emby for Kodi Sync add-ons, do make use of the stub entries to prompt for offline media.  Of course, that’s a whole different topic.

 

To trigger the Blu-ray and Dvd external player definitions in Emby Theater a library entry needs to follow the Blu-ray or Dvd folder structure described in the naming conventions.  In summary these are:

 

To be recognized as a Dvd structure, the folder must contain either a VIDEO_TS subfolder, or a VIDEO_TS.ifo file.  To be recognized as a Blu-ray structure, the folder must contain a BDMV subfolder.

 

If you ripped your disc to make it online in the server you’d use the same convention to store on HDD.  As a result it is possible to create Blu-ray/Dvd library entries for online media and other library entries for offline media that in the ideal world your Blu-ray/Dvd external player process needs to cope with to make all accessible.  The approach I’ve detailed in the External Player Definition section above does this.

 

As the triggering will occur purely on the presence of suitably-named folders, it is possible to set up library entries for your commercial discs without storing any form of media file within them.  However I quickly discovered that such library entries caused other Emby clients that do not have suitable external player capabilities, such as Emby for Android, to “circle” and not do anything though it was possible to escape out of this without any apparent harm.

 

As a result I created small media files of the appropriate type, with 10s duration, that would show a single frame displaying a message that the Emby client being used does not have the access/ability to play discs.  These were then placed into the folder structure of each offline disc library entry for other Emby clients to “chew” on if the library entry was selected for playback.  Here’s a .zip file attachment showing both the folder structure for a Blu-ray and Dvd example and containing the 10s media files I created:

 

Sample Folders.zip

Attached File  Sample Folders.zip   3.73MB   2 downloads

 

To generate the 10s media files, I created the initial frame using a photo editor.  Here’s what I came up with (put into .zip file to comply with attachment rules):

 

Disc Warning.tif

Attached File  Disc Warning.zip   288.16KB   3 downloads

 

I used the attached .bat file (renamed to .txt below to comply with attachment rules) to run some FFmpeg commands to create the videos in the required format:

 

Create Disc Warnings.bat

Attached File  Create Disc Warnings.txt   657bytes   2 downloads

 

A Dvd without an audio stream is not compliant, hence the intermediate step to generate a silent audio stream for the final .mpg file.  For Dvd there is an extra step from generating the final .mpg file to create a Dvd folder structure.  This can be accomplished using your favourite DVD Video burner software to provide the final version with .IFO, .BUP and .VOB files in a VIDEO_TS folder.  In reality, as it’s less work, you could set up all your disc library entries as Blu-ray but I’ve used the Dvd folder structure for situations where I only have Dvd discs.  You never know when things may change.

 

EDIT: I have created an enhanced version of the .bat file added as part of the extra player definition to automatically play any real online contents in the {path} passed by ET based on the combined size of the underlying folder structure - assuming it will be larger than the files used for the disc warning.  This takes out having to respond to a dialog to confirm if you want to play online content.  I don't have such a situation myself but carried out some sample testing that showed it worked.  If this is more appropriate for your situation and you wish to make use of this it is available in this attachment though I would recommend carrying out testing appropriate for your media collection:

 

VLC-PlayDiscforEmbyTheater.bat

Attached File  VLC-PlayDiscforEmbyTheater-new.zip   1.22KB   5 downloads

 

Up to now, if they are selected for playback, we’ve gone to the trouble of making the disc library entries compatible with Emby clients other than Emby Theater.  The ideal is to make the library entries stand out in some way to avoid selecting them in such clients in the first place.  I’ve achieved this by overlaying the original primary image for a library entry that the server metadata fetcher would obtain with the disc image that it would also obtain and using this as the new primary image for the library entry.  Thus a user seeing a primary image overlaid with a disc image knows the entry is for an offline disc.

 

I’ve set up my server so that I don’t keep the artwork with the media folders.  As a result I had to define a new temporary library where artwork would be stored with media and copied all my disc library entry folders to this temporary library location.  You can tailor this temporary library to just pull back primary and disc images.  This gave me the source of images to use.  I then used this attached .bat file (.bat renamed to .txt...):

 

Image Manipulation.bat

Attached File  Image Manipulation.txt   425bytes   2 downloads

 

to generate the alternative primary images across all the entries in the temporary library.  Again I’ve used FFmpeg.  Note that the original disc image and the alternative primary image are .png files.  This is so that appropriate transparency is retained for when the library entries are shown within clients so that the disc “notches” the image displayed.  The overlay process in the .bat file also starts with a fully transparent .png file of the appropriate dimensions for a primary image:

 

Transparent 1000x1500.png

Attached File  Transparent 1000x1500.png   5.8KB   3 downloads

 

For reference, here’s the alternative primary images for the sample entries in the Sample Folders.zip attachment above:

 

Early Man – poster.png

Attached File  poster.png   2.92MB   4 downloads

 

Shrek – poster.png

Attached File  poster.png   3.12MB   8 downloads

 

If the server metadata fetcher doesn’t pull back a primary or disc image for a library entry, you have the option to scan your disc and/or case insert to create the starting point.  I had to do this myself for some discs.  In this situation you’ll need a photo editor that supports manipulating/generating the disc image with transparency or use an approach based on the Image Manipulation.bat file above.  If it’s a help, here’s a base image with the typical dimensions of a disc image returned by the server metadata fetcher that can be overlaid with a suitably cropped non-transparent disc image:

 

Transparent 500x500.png

Attached File  Transparent 500x500.png   994.49KB   4 downloads

 

Having generated the alternative primary images, it is a manual job within the server metadata manager to replace the originals.  Hopefully you’ll think the final result is worth it.  I’d also recommend keeping separate copies of the alternative primary images in case they get accidentally overwritten, or lock the metadata entries they are linked to.

 

As alluded to at the beginning of this section, a parallel approach can also be used for discs associated with TV episodes rather than movies.  The main challenge here is the name to give to the folder to reflect the episodes on the disc, particularly when the disc may not hold consecutive episodes and may even hold episodes from multiple seasons.  In this situation the approach I’ve used is to create the folders for the discs in the Specials/Season 0 folder structure for the TV show and give it a name such as S00E999 that will never actually be used by a real special.  This then requires manual effort to update the metadata to reflect the true content as you deem appropriate.


Edited by latenighter, 13 December 2018 - 06:42 AM.


#2 latenighter OFFLINE  

latenighter

    Member

  • Members
  • 12 posts
  • Local time: 07:15 PM
  • LocationUK

Posted 07 November 2018 - 03:08 PM

The information is now complete.



#3 Deathsquirrel OFFLINE  

Deathsquirrel

    Advanced Member

  • Members
  • 1943 posts
  • Local time: 12:15 PM

Posted 08 November 2018 - 08:36 PM

Clearly you worked really hard on this and I applaud the effort and desire to share it with the community.  I just can't help feeling you've crafted a very fine buggy whip.



#4 latenighter OFFLINE  

latenighter

    Member

  • Members
  • 12 posts
  • Local time: 07:15 PM
  • LocationUK

Posted 13 December 2018 - 06:56 AM

@Deathsquirrel, many thanks for taking the time to review my primary post.  If you think there are any particular vulnerabilities don't hesitate to share them with me and I'll see what I can address for myself even if no one else makes use of this method.

 

I've allowed some time to pass before replying to give an opportunity for things to bed in here - as I started off the post I noted this was part of a conversion process from WMC to ET.  The family seem to have got along with the changes OK so far and have not reported any issues with playing discs.  However, bearing in mind what you've implied about creating extra work for myself supporting this, I will report that I have been performing some minor tinkering that I've added to the primary post now in the vein of creating a "better mousetrap".  The enhancement is not for the benefit of how my media library is set up but would slightly improve the user experience of those with a combined online/offline disc collection.  Maybe I have to keep an eye on following a "if it ain't broke, don't fix it" approach.



#5 Deathsquirrel OFFLINE  

Deathsquirrel

    Advanced Member

  • Members
  • 1943 posts
  • Local time: 12:15 PM

Posted 13 December 2018 - 02:12 PM

@latenighter glad to hear it's working well for you!

 

When I first started I did a number of things to replicate the disc experience for my family to make it familiar to them.  Ultimately though what they wanted was netflix with my media.

 

The most common complaint I get these days is that I can't enable a 'skip intro' function like Netflix recently added.







Also tagged with one or more of these keywords: blu-ray discs, DVD discs, external player, Emby Theater

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users