Plex Remote Transcoder - A distributed transcoding backend for Plex

Hi,

First of all great work. I have been looking for something like this for a while.

A few questions, as I am having a few issues.

  1. I’m running plex on a ReadyNAS which runs Debian 4.7.2-5. Plex installs to /apps/plexmediaserver under that there are the following directory structure:

    /apps/plexmediaserver/
    ├── Binaries
    │   └── Resources
    │   ├── English.lproj
    │   ├── Fonts
    │   ├── Graphics
    │   ├── locale
    │   ├── Plug-ins-cece46d
    │   ├── Profiles
    │   └── Python
    ├── MediaLibrary
    │   └── Plex Media Server
    │   ├── Cache
    │   ├── Crash Reports
    │   ├── Logs
    │   ├── Media
    │   ├── Metadata
    │   ├── Plug-ins
    │   ├── Plug-in Support
    │   ├── Scanners
    │   └── Thumbnails
    └── temp

From looking at the guides etc, your tool expects the binary and config directory to be located in /var/lib/plexmediaserver and /usr/lib/plexmediaserver. On my system, no such directories exist. I assume the binaries directory for me is /apps/plexmediaserver/Binaries.

I have modified the prt.py script to the following:

TRANSCODER_DIR = “/apps/plexmediaserver/Binaries/Resources/”
LD_LIBRARY_PATH = “/apps/plexmediaserver/Binaries/”

Is this correct?

Cheers

I have added an new log to the generated Plex New Transcoder file to sanity check if it is called. I’m not a python dev (I’m a Java dev), can someone eyeball this for me?

#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'prt==0.2.2','console_scripts','prt_remote'
__requires__ = 'prt==0.2.2'
import logging
import sys
from pkg_resources import load_entry_point

LOG_FILENAME = '/apps/plexmediaserver/Binaries/Resources/example.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)

logging.debug('This message should go to the log file')

if __name__ == '__main__':
    sys.exit(
        load_entry_point('prt==0.2.2', 'console_scripts', 'prt_remote')()
    )

No log is being created. My client apps are saying that the server is unable to transcode. Does plex just disable transcoding somewhere under the hood on certain systems?

EDIT: I can now get the script to run by manually invoking it using “python Plex New Transcoder”.

The output is as follows:

Traceback (most recent call last):
  File "/usr/local/bin/prt_local", line 9, in <module>
    load_entry_point('prt==0.2.2', 'console_scripts', 'prt_local')()
  File "build/bdist.linux-x86_64/egg/prt.py", line 209, in transcode_local
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

From looking at the prt.py script, I can see this is related to the local transcoder.

Still when I try to play a movie via an app, the transcode fails to start. No log entries are created. So it seems plex isn’t calling “Plex New Transcoder”

So, i’m looking into running virtualbox because this transcoder application is something i really want to try and get the program working. I’ve looked at the guide that was put together for setting this up on ubuntu 14.04 LTS. I was able to a lot of progress in.

I’m writing everything down as i go, to build a guide biased on what i’m doing for a setup. It uses alot of steps from the ubuntu guide, and i hope i can reference them without issue.

I have hit a snag though. i need to symbolic link the plex library from ubuntu to a shared drive location. seems it wont work for me though.

ln -s '/mnt/Media/sf_E_DRIVE' '/home/plex/Library/Application Support'

but i get ln failed to create symbolic link ‘/home/plex/Library/Application Support’: no such file or directory

any assistance with this area? i can send my current guide to anyone who wants to take a look; but at this point its incomplete.

I’ve posted additional details below, to bump this topic in the main 3rd party forum list.

I will be posting my steps when i get the first 2 virtual boxes finished; and adding it here.

@m1e1w1 said:

ln -s '/mnt/Media/sf_E_DRIVE' '/home/plex/Library/Application Support'

but i get ln failed to create symbolic link ‘/home/plex/Library/Application Support’: no such file or directory

any assistance with this area?
Linux doesn’t do names with spaces the same way as windows is the first thing that comes to mind. If i have directories with a space between words it adds a \ after the first word and then a space. Try: ln -s '/mnt/Media/sf_E_DRIVE' '/home/plex/Library/Application\ Support'

if that doesn’t work maybe create the directory before you try to symlink to it? so ‘mkdir /home/plex/Library/Application Support’

EDIT:
so i am looking to have Ubuntu plex read from a Shared Folder location, accessible in Linux from /mnt/Media/sf_E_DRIVE

i replaced:
Enviroment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support"
with
Enviroment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/mnt/Media/sf_E_DRIVE"

from the plexmediaserver.service file. but Plex Media Server is not seeing the Library there.

would this be the wrong place to point the library location?

I tried:
mkdir /home/plex/Library/Application\ Support
which worked, and i got a directory there, then i chmod 777 the directory.
when i try to make a ln -s '/mnt/Media/sf_E_DRIVE' '/home/plex/Library/Application Support'
i just get a shortcut file labeled sf_E_DRIVE.

what do i need to do, so that when i open /home/plex/Library/Application Support directory, it see’s the contents of sf_E_DRIVE? and not just make a shortcut file?

thanks for any assistance with this. Otherwise, i;m making good progress with the guide. just can’t continue until this is resolved. and anyone else who is familiar with ubuntu willing to help with this, let me know too.

Follow up…

I did manage to get a working Windows Host / VM Ubuntu working. Using openflixr I posted that info here:

http://forums.plex.tv/discussion/comment/1172972/#Comment_1172972

My next step would be to see of openflixr will run as my Master node, and some vanilla Ubuntu VM’s as Slave Nodes… ill check back in with more soon.

Does this work for macs at all? I’ve sparked a high interest in this ability as I would like to use a low power mac to handle web and have it use a beefier box to transcode when needed and have it go back to sleep afterwards.

Has anyone gotten this to work with only Windows hosts yet? If not, I can definitely try my hand, as it looks like it might be a simple drop-in replacement of SSH with POSH. I have some experience with Python, but my primary focus as far as development goes is C# and PowerShell.

Why are you trying to get this work on windows… just install a Ubuntu VM with Virtuabox. Give your VM 1 Go of Memory and a minimum of 4 Go hdd space for the slaves. If the medias are located on your windows machine just share the folders between linux and windows.

I run a highly virtualized Hyper-V/Windows/Active Directory environment and I don’t want any non-Windows production machines unless it’s an appliance as it adds to the management overhead.

Updates:

I resolved a stable connection to use NFS / CIFS (tested both types) to allow the plex library to work from outside the VM. I’ve updated my guide and will continue the setup with 1 slave node.

Is there a current Docker image with the most recent code? I can build one out but if somebody else has gone thru the process it would save me (and a lot of other people) some time.

After a bit of initial configuration it looks like this won’t be plug-and-play quite yet. The current docker-plex code relies on SSH which would mean that you’d need to expose port 22 on the containers. The best way I could see to accomplish this as well as volume sharing would be to use an overlay network and NFS. There are hundreds of ways to accomplish this and ultimately a rewrite/fork of the original code is worth a look. I recommend a separate thread for this since it’ll get noisy and I’d rather not poison this thread.

I tried just for fun to overwrite the transcorder on the beta PMS version 0.9.17.0 but it didnt work :((

Transcoder appears to have been renamed previously…checking if it’s been overwritten
Traceback (most recent call last):
File “/usr/local/bin/prt”, line 9, in
load_entry_point(‘prt==0.2.2’, ‘console_scripts’, ‘prt’)()
File “build/bdist.linux-x86_64/egg/prt.py”, line 418, in main
File “build/bdist.linux-x86_64/egg/prt.py”, line 181, in overwrite_transcoder_after_upgrade
File “/usr/lib/python2.7/filecmp.py”, line 43, in cmp
s2 = _sig(os.stat(f2))
OSError: [Errno 2] No such file or directory: ‘/usr/lib/plexmediaserver/Resources/Plex New Transcoder’

It would have to be renamed or re-pathed then right? I am running 9.17.0 on a testing platform for now.

Question here, once the forum testing phase is complete and we get a plex pass release, if needed will this program get an update? or will it wait for an official public release for an update if that would be necessary?

So question on this. The PMS transcoder is pretty all over the place in a multi-core system, so I was wondering if it would be smart to load up proxmox and make like 8 containers each with 1 cpu running this distributed transcoder. Each stream could get a dedicated single processor then, which should be plenty for a single 1080p transcode, and you would be able to fully utilize the cores of your cpu. What you guys think, or am I missing something on this?

PMS version 0.9.17.0 Warning

I’m usually pretty quick on the uptake of the latest PMS versions when they get released because I’m a geek and because I’ve been trying to help out the PRT project when I can but for whatever reason I didn’t get a notification that there was a new version until today so I jumped from 0.9.16 to 0.9.17.2 and it seems at first glance that Plex have changed the way they do things in multiple ways. First I hit the error mentioned above in the overwrite function (which is one I wrote) and from there I quickly created a workaround to find that almost all content wasn’t working right anymore with PRT in the mix along with this new version. I myself, a maintainer have disabled PRT in my own setup to allow for normal operation while we look at the new version of PMS and how its operating.
I would strongly suggest people do NOT upgrade to 0.9.17.x until we’ve had a chance to investigate however if you have already I believe you can just downgrade back to the latest version of 0.9.16 as suggested in the pre-release thread where people have had other issues with the new beta version (the downgrade was suggested by Plex support so I would guess it’s a viable option and for further information have a look in that thread or contact Plex support). Being on 0.9.16 will mean PRT keeps functioning for you.

The PRT project will attempt to find a solution asap but I have no eta on that as I know I don’t have as much time to spend on this project as if like but I’ll do my best as we all will. What makes things harder is unfortunately Plex don’t keep us informed before or after of their exact changes so a process of reverse engineering has to take place which can be a slow one. I haven’t had a chance to speak to the creator of the project as I’ve only just found out about this myself but I’ve sent him a message to ensure he’s also aware, potentially he might have more information or be able to correct any errors in this message however I felt it best to let the PRT community know of this issue and suggested actions asap.

Cheers,
Liviy

Does anyone tried to install PRT on a Ubuntu version 16.04 ?
Does it work ?

a nice feature would be if friends who have access to your libraries should also be required to help with offline transcodes

@igowas said:
Does anyone tried to install PRT on a Ubuntu version 16.04 ?
Does it work ?

I’m currently using it on Ubuntu 16.04 as both, master and slave. Two different machines, in two different countries. No problems at all!