wnielson / Plex-Remote-Transcoder

A distributed transcoding backend for Plex
MIT License
645 stars 58 forks source link

Cross Platform Arch #3

Open DrEVILish opened 9 years ago

DrEVILish commented 9 years ago

Currently the way this works you can't use two different CPU Architectures in the "cluster" because of the transcoder is complied on the PlexMediaServer host.

If during the slave setup process you compile the transcoders for the slave arch from the source: http://files.plexapp.com/elan/ffmpeg/PlexNewTranscoder.tar.bz2 http://files.plexapp.com/elan/ffmpeg/PlexTranscoder.tar.bz2 load them locally instead of going back to the host for the transcoder.

This would allow cross platform architecture. i.e. Ubuntu laptop x86_64 with Plex Media Server installed. Then some RaspberryPi's as Slaves...

wnielson commented 8 years ago

That's a good point about mixed environments, but I think compiling from source is not the correct route to go. Perhaps downloading the binary that matches the host would work, but AFAIK Plex does not provide a way to easily download archived copies of PMS. We'll have to look into this...

liviynz commented 8 years ago

That's the way I tried with my Ubuntu 14.04 (master) to Fedora Core 22 (slave) and after falling down a rabbit hole of environment issues I managed to get all that cleaned up, could fire up prt_local via ssh from master with no issues, I'd get the standard usage for ffmpg but firing the full command at it just fell over with no errors. In theory you can do whatever combination you like as long as the environment on the target system and all the supporting dependencies are there. I totally get both sides of this argument...it's good to use what you have but on the flip side if you keep them all the same you don't have to worry about environment setup on the slaves as you know what you'd get. P.S. Not so sure the Pi's would have the capacity to do much good, it's not load balancing configuration across multiple systems for 1 per transcode. The transcoding for 1 single request is offloaded to a specific slave to be run, if it's someone trying to watch something then I think since plex won't use the GPU you'd be too slow to keep up with almost any live demand. Perhaps for your scheduled tasks they'd be not so bad.

P.S. You can pull down old PMS packages from their download archive : https://plex.tv/downloads/1/archive

ghost commented 8 years ago

Any news regarding this isuse?

DrEVILish commented 8 years ago

Logical steps in my mind currently: Get or Set CPU version i.e ARMv7, x86, x86_64 of the slave machines, when a transcode fires from the PMS_Host it targets the slave while telling it what version of the software it's got to use i.e (same as above) Transcode Request -> Load Balance -> slave_1(ODROID c2) -> get CPU arch (ARMv7) -> LD_LIBRARY_PATH = ARMv7 dir (/opt/plex/arch/ARMv7) -> send remote transcode operation within /opt/plex/arch (stored on the PLEX host or your file server that's just the mount point to the remote machines) there would be a dir for each CPU arch.

This would, however, require you keeping each version of the PLEX installs /usr/lib/plexmediaserver/ from Linux stored for each arch you use / require on your file server... mostly this should just be x86_64 and ARMv7

I've created a new fork that requires testing currently. - will test it later

DrEVILish commented 8 years ago

os.path.exsists and os.path.join issue otherwise feature is working...

OS = platform.system()
CPU_ARCH = platform.machine()

if OS == "Darwin":
    # OS X
    TRANSCODER_DIR  = "/Applications/Plex Media Server.app/Contents/Resources/"
    LD_LIBRARY_PATH = "/Applications/Plex Media Server.app/Contents/Frameworks/"
elif OS == ('Linux'):
    #if os.path.exists("/opt/plex/arch/" + CPU_ARCH):
        # Linux
        LD_LIBRARY_PATH = os.path.join("/opt/plex/arch/", CPU_ARCH)
        TRANSCODER_DIR  = os.path.join(LD_LIBRARY_PATH, "Resources")
#    else:
#fail back to original director if processor not recognised
#        TRANSCODER_DIR  = "/usr/lib/plexmediaserver/Resources/"
#        LD_LIBRARY_PATH = "usr/lib/plexmediaserver"
else:
    raise NotImplementedError("This platform is not yet supported")
ghost commented 8 years ago

Any news about this?

DrEVILish commented 8 years ago

The issue is that installing PMS onto a computer i.e. x86 then having say PowerPC slaves running as clients, causes an issue because the transcoder which is executed on PowerPC is the one installed with PMS, which is compiled as x86. Meaning that on each system you want the transcoder to run, you would have to store a copy of each compiled software version.

You can see my repo for current trials of this idea. I do not recommend pushing them into the master Git as I think it would be more confusing to bug fix for outstanding issues and new features but by all means try it and let me know how you get on.