Plex library optimize - Gdrive

I would like to optimize my library and make more user friendly. Wanted to ask if any of you have experience with it. Do I use the Plex Optimizer or the MP4automator script?

My library at Gdrive is now a bit bigger, about 40TB. Download everything, google compute or something, or leave it at Google? Or would I run into problems with a ban if I left it at google?

What’s the best way to do that? Has anyone ever done this to you before?

What do you mean by more user friendly? I just hit play and it plays :slight_smile:

Yes unfortunately not at all, some can’t play MKV like the AppleTV. MP4 is simply better supported by the clients… I want to minimize transcoding

Plex Direct Streams those as it’s almost a 0 CPU hit so I don’t even bother with making any changes for that.

It just puts it into a different container and the streams direct play.

Why do you feel that’s an issue?

Okay, how do I best put all of them in a new container?^^

Like a docker or something? I just run everything on a home server so I don’t use dockers/containers as it’s a layer of complexity I don’t feel gives me any added benefit.

I think he probably he meant changing the media container, not the docker containers.

Using ffmpeg. There must be something online if you search.

I build a tool to re-encode my entire library on GDrive, with native RClone support. It’s still under development, but you can check it out here. The default codecs are H.264 and AAC as these are the most universally supported, but you can change these on runtime or change the defaults via plexus config.

Essentially, mount your GDrive account to a local directory, then run plexus list -d /path/to/media -l listfile.txt. Once the list file exists, modify it to remove the trailing path from the beginning of each entry (if you’ve mounted to /mnt/drive/, then you’ll need to remove the /mnt/drive/ from the beginning of each line using something like Notepad++, I’m working on removing this). Fixed.

Once you’ve got the list, run plexus encode -l listfile.txt -r YourGDriveRemote:. For extended support, you can install a custom build of FFmpeg using plexus install.

That sounds neat @Wolveix! I assume this requires a full download of all files, does it not? Does the tool detect files that are already using those codecs and leaves them alone? Also, I assume it’s probably better to mount this elsewhere with a second api client / secret so it doesn’t interfere with the one used by plex?


1 Like

Thanks :slight_smile: The mount is only needed while you build the list. Once it’s built, you can just unmount it if nothing else requires it. Realistically, you probably won’t hit the API request limit before hitting the daily download limit, so you’ll probably be fine. It’s highly recommended that you use your own client ID and secret anyway though, as you’ll see a huge increase in performance :slight_smile: The program also has a mount function with the best settings that I’ve personally found.

The list function only adds a file to the list if either of the codecs are incorrect. A file does not get added if both codecs are correct.

When running the encode process, each file’s codecs are double checked once downloaded to determine how it should be encoded. For example, if it’s just the audio codec that needs changing, then the encode process will just copy the video codec rather than pointlessly re-encoding. This cuts down the encode time massively!

Awesome! What container do you use, mkv or mp4?

MKV by default as it has better support for multiple audio tracks, but you can change this by modifying the code yourself. I will add an option to modify this via the config function soon :slight_smile: I’m currently in the process of rewriting the application from Shell to Go due to huge feature updates planned for v1.1+ :wink:

Very nice, I’ll give it a shot, interested in seeing how much of my library would need changing :slight_smile:

1 Like

Great! Message me if you have any issues :slight_smile: It’s still under active development, so bugs are inevitable. In my use, I haven’t had many issues, and any that I have I’ve patched. I can’t recommend installing the custom build of FFmpeg enough as it provides much better codec support for AAC audio :slight_smile: Rather than having to go through the hassle of building it yourself, you can just run the plexus install function to automate the process (it does take a good 10+ minutes though).

I’m still not sure what the bang for the buck is there. I rather take the 1% CPU hit for playback using Direct Streams than spend the time converting my library.

If i really wanted to direct play it all, I’d just flip over and use Infuse as it direct plays it all.

1 Like

That looks awesome!

Thanks for sharing.

1 Like

@Wolveix when I tried installing dependencies it brought me to the list of dependencies to install but then the script died:

root@plexy:~# plexus install
What would you like to do?

1 - Install missing dependencies
2 - Reinstall/Update Plexus
0 - Exit

Which dependency?
1 - All
2 - FFmpeg
3 - Fuse
4 - RClone
0 - Exit

Please enter a valid menu option. Enter 0 to exit.

I installed it manually by getting the commands out of the script and compiling manually but thought you should know :slight_smile:

Did you happen to press enter after typing the 1? The script automatically accepts the input, so pressing enter basically invalidates the next menu option. Just press 1 and it’ll take you through to the next menu :slight_smile: I’ll add a handler for pressing enter though as I could see how that could be an oversight! Thanks!

Nope, I didn’t press anything, tried a few times too in case I was doing something stupid. Maybe my terminal sends something I’m not. In any case, I’m already testing it out with 1 file, re-encoding as I speak :slight_smile:

EDIT: It worked! I think I have a perfect use case for this: assisted subtitles not being supported along with mkv container. This happens all the time with Anime. I’ll play around with it some more.

1 Like

Weird. I’ve just released an update which should resolve the issue for you :slight_smile: I’ve also added a -m flag and mount_dir variable to resolve the workaround mentioned earlier.

That’s great to hear! If you find any other bugs or have any requests, either message me or create an issue on the GitHub repository :slight_smile: