Plex library optimize - Gdrive


Sounds great but I cant find out what it does or can do?

Can you please explain so idiots like me can understand what your system do? :slight_smile:

Ex step by step? :slight_smile:


I tried using the plex optimizer and still ended up with a lot people transcoding. I optimize parts of my library using the mp4 automator, but it’s a pain because you need to perform some analysis.

  • What are all the devices connecting ( gotta knew what the clients can do )
  • What profile and level do all devices have in common ( Can everything support high 4.1 )
  • What do the audio configurations look like ( do you need to add aac stereo )
  • What does the bandwith of your users look like ( this impacts bit rate )

Usually I would say start by reaching out to users and make sure that Direct Play is enable and video as well as audio are both set at play at original. I think Andriod devices hide this under network, make sure they’re set at original. Once that’s done see who’s transcoding at that point. I suspect android and Roku devices will be fine and apple will be a thorn in your side.


I do this as well. I have tautulli stats so whenever I see someone transcoding I burn their ass publicly and tell them to switch quality to maximum, that works most of the time.


but in theory,if you were to do it … you’d probably want to get a preemptible nvidia tesla 100 ( should be about 3,000 cores and runs about .50 per hour ) and compile ffmpeg to use that card. This use case would be only used if you’re truly re-encoding and not just copying and or adding an audio track.

The bottleneck would be trying to write the converted file back to the cloud drive


I use this as a CPU:

model name	: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz

I also have hardware encoding setup on my server and you’ll see the HW on the end of the item playing.

At that point, I barely ever crack 15% CPU usage with many streams transcoding so I haven’t ever felt the need to convert my media as the effort to do that isn’t needed in my current setup.


I made the list and then tried to encode but had an error, what could it be?

plexus encode -l list.txt --verbole
Downloading: MOVIE_NAME.mkv
/usr/bin/plexus: line 414: /usr/bin/rclone: No such file or directory


This should be plexus encode -l list.txt --verbose

What operating system are you using? RClone’s install script installs the binary to /usr/bin/rclone (same as Plexus), however, yours must be somewhere else (most likely due to your OS/system architecture).

Admittedly I do need to add better handling of external applications. Due to how Shell handles certain types of loops, you have to include the full path of the desired program. The new Go rewrite doesn’t have this issue :slight_smile:


I’m using ubuntu 16.04

About rclone i didn’t use install script but just copied rclone bin and made my own configuration.


Ah, I see. I’ll add a config option for custom setups then :slight_smile: Should be done soon. Once it’s updated, just run the update command from plexus install and then run plexus config to specify your locations :slight_smile:


@fbrassin I’ve just released an update :slight_smile: I had to rewrite a few things to get things to work. To update, either do follow the install instructions on the repo again or just run plexus install, 2.

You’ll need to specify your RClone binary location by running plexus config, 2, 3, then your absolute path. The encode function now supports local directories by default, so to use RClone you’ll need to specify the -r flag like this: plexus encode -l list.txt -r YourRemote:. Let me know if you run into any issues!


OK, worked 'till 100% but then an error:

2018/11/22 10:28:50 NOTICE:
Transferred: 2.551G / 2.551 GBytes, 100%, 10.869 MBytes/s, ETA 0s
Errors: 0
Checks: 0 / 0, -
Transferred: 1 / 1, 100%
Elapsed time: 4m0.3s

File downloaded./usr/bin/plexus: line 514: -v: command not found


Looks like that was caused by the change in binary handling. I’ve just released an update which should resolve the issue :slight_smile:



Now the error has changed

/usr/bin/plexus: line 557: ffmpeg_error\nAn unknown error occurred with FFmpeg.\nConsider installing the custom build of FFmpeg via the install command.\n: command not found


Since I have a custom build of FFmpeg on my machine, I missed the lack of a equals operator for that variable declaration. Fixed, updated :slight_smile: Sorry about the hassle!


OK, now it worked fine.

I see that program is overwriting original file. Isn’t it better to let user choose if keep original file or overwrite it?
Maybe with a config option


Glad to hear that it worked!

I agree that an option should exist. I’ll add a config option and flag.


I’ve just implemented a -f flag (which doesn’t require an input) which sets the new force_overwrite variable to true. You can set this to false via the config function or by manually modifying the config file directly. I’ve also added a --bwlimit flag (bandwidth limit flag), reorganised the config function and rewritten the primary component of the encode function to be technically more efficient but primarily easier to maintain.

Let me know if you have any other requests or feedback :slight_smile:


I’ve just found out that my converted movie is beening transcoded from my ATV4, so i think i set something wrong in plexus.
Can you please help me to understand how should i set plexus to work fine with ATV4.
In think container should be mp4, not mkv.


MKV shouldn’t be the issue, but I was planning on adding extended container support in the future anyway so I’ve just implemented it. You can can configure it the same way as everything else :slight_smile: There’s no flag for it as it wouldn’t make much sense.

Are the media clients set to play remote files at original quality? And do they actually have direct play enabled? It’s not necessarily the server’s fault for the transcode.


I set original quality.
On reddit i found this:

When I transcode videos for max direct play compatibility, I usually do something along these lines:

H.264 video

2 channel AAC audio (although audio transcoding isn’t so bad so I sometimes opt to keep the DTS audio for surround systems, or add it as a second audio track)

MP4 container

Level 4.1 or lower (ATV4 supports level 4.2, but many of the devices I use max out at 4.1) More on levels here

Same frame rate as the source

Around 10Mbps bit rate. This is a personal preference, you can choose the quality that you think looks best. Going higher than the source will just waste disk space.

I’d say there is a decent chance many of your videos are in H.264. If they are H.264, but in a different container, you can remux the file into an MP4 container without transcoding. This will save you a lot of time (it’s insanely faster than transcoding the video) and prevent the quality loss that can come with transcoding. I don’t know if Handbrake can do this; I haven’t used it in a while.

As for what formats the ATV4 can direct play, the ATV4 has hardware decoding for H.264 video up to 1080p at 60 fps, level 4.2 or lower, in an MP4 container. Audio should be AAC at 160 kbps per channel. Here’s Apple’s official info on this.

It’s possible in the future the Plex app will be able to leverage the ATV4’s CPU to play other formats, but for now this is what works for direct playback.

NOTE: Plex can “Direct Stream” video in a different container, effectively negating the difference between streaming an MKV and MP4, as long as the video stream in the container is able to be played on the device. You mentioned this in your post, I’m including it here for completion’s sake only.

Maybe it can help.