[Release] UnicornTranscoder, create a Plex Transcoding Cluster

Hello everyone,

Today we are releasing the UnicornTranscoder, it’s a project composed of 3 software to create a fully scalable Plex transcoding cluster. The project is written in NodeJS. The three components are:

UnicornLoadBalancer:
It is installed in front of Plex Media Server, it will catch the request and forward it to a UnicornTranscoder

UnicornTranscoder:
It is the transcoder software, it will get the transcoding parameters from Plex and start the Job.

UnicornFFMEG:
It’s a binary to replace Plex Transcoder, it will get the arguments and send them to UnicornTranscoder.

UnicornTranscoder is different from Plex Remote Transcoder in the architecture, each transcoder serve the streams by itself, this means that the Plex Media Server is not a bottle-neck anymore. Also, if the Plex Media Server is restarted, users are not kicked. Users are Load-balanced between servers depending on how many transcoding are running on each servers.

You can get all the source code here:

We are working on this project for more than 1 year, and now it’s almost bug-free. Some feature are still not finished such as media optimization or automatic quality.

30 Likes

It taked us a lot of time, we hope you will like it, some features don’t work correcly at the moment:

  • Sync fails to transcode your files
  • The media optimiser fails to convert your files
  • The auto quality feature isn’t supported
  • The plex pass kill session feature could be unstable
  • Hardware transcoding isn’t supported, please disable it.
  • Not tested with PlexDVR

Feel free to make pull requests :smirk:

1 Like

Sounds awesome! Definitely going to test with this during the upcoming weekend!

2 Likes

Hey this looks great. I have a project called https://plexguide.com that has been worked on for a year that’s a massive installer. I starred your project and bookmarked and see what I can do to work an installer. I’m currently breaking my project into modules, so this may fit somewhere down the road. Let me know if there is anything i can do :smiley:

4 Likes

This is very interesting! How do Plex clients like having their ‘custom server access urls’ responded to with a 302?

How does all of this affect initial playback start time?

I only just started looking into a way to do the load balancing that you have achieved here, ultimately for a different purpose but I think this will be very helpful. Awesome work!

Our 302 redirections are supported by all the Plex clients, this kind of redirections are used by Plex Cloud, we do exactly the same :grin:

Maybe it’s affect the duration of the first request, because you are redirected on another server. After that you download video and audio chunks directly from the transcoder without any redirection, so there are not performance issue :wink:

It’s the best way to make a load balancing for a plex server because by doing that you don’t need to increase your bandwidth when you add users, each transcoder have his own bandwidth :kissing_heart:

Is it really? Well then… That is very interesting then.

Exactly my thoughts and what I wanted to avoid!

Yeah we studied Plex Cloud and it works like that, when you start a transcode, the start endpoint return you a 302 response to be redirected on a dedicated transcoder server. Same for downloads

Oh, this is incredibly awesome. I’ve been wanting to use a cluster to support 4k transcoding so badly, to see things coming along so well is amazing!

You guys rock. Thank you so much!

1 Like

I think the cluster is there to send entire transcodes to another machine rather than splitting the transcode job between the servers. So would require all of your servers to be powerful enough to transcode 4k footage.

i.e. stream 1 goes to server one and stream two goes to server 2 and stream three goes to server 3 etc.

That’d be unfortunate, but not a showstopper. My Plex server serves 6 devices. I have a 4k tv, and my server can handle 4k transcodes, but only one and that doesn’t leave room for much else. Most devices are just consuming 1080p though.

With that said, I’d think it wouldn’t be impossible to stripe the transcoding: front end “farms out” stripes to each server which would be simultaneously transcoding say 30 second stripes and sending the results back to the front end to be put back together?

Do you guys have plans for features more than what the Plex Transcoder offers right now or it being a drop-in replacement. If HDR tonemapping to SDR devices could work then that would be really cool. FFMPEG already has implementation of various different tonemapping filters. Would it be possible to detect if the device that Plex plays on is an HDR compliant screen and if not, force tonemapping?

It could be possible but we need to change a lot of things to implement that :sob:

Could somone please prep docker images for this and orchestrate how the containers should play together as a Docker Swarm/Kubernetes configuration?

1 Like

We are working on a docker image, check our github issues for more information :grinning_face_with_smiling_eyes:

Any chance this will work with the “Live TV” that Plex has implemented?

could someone put together a guide as to what hardware/software is required to make this work. What OS is required etc… And where to download the necessary software.

1 Like

For live tv, we don’t know how it works, and we don’t use this feature for the moment, if someone have time and skills he can make a
Pull Request to support it, the goal is to reverse all the PMS endpoints, but without any official documentation it’s hard to do it.

We will work on a tutorial soon, our first goal is to create dockerfile to help you to deploy it on your own server.

1 Like

BTW if someone in the PMS team could list us transcoding endpoints and explain us how it works we could win a lot of time :grinning:

Is it possible to just replace the Plex Transcoder so that we can use the newer version of FFmpeg and use hardware encoding and decoding in linux?