Plex library optimize - Gdrive

While scanning and not encoding? I believe all input/output errors from any program tend to relate to the filesystem. I’m assuming that this is an RClone mounted directory? In which case, there may have been a temporary error. Evidently I need to add error handling with retries.

Yes it happened while trying to create the list file with this command:
plexus list -l /opt/plexus/listfile.txt -d /mnt/tdrive/MOVIES -v h264 -a ""

Script looks nice but i would be reluctant to do this on gdrive due to API / download limit of files. I convert my media to mp4 with aac audio added with sickbeard_mp4_automator as a postprocess script after download. After processing it will be handed to sonarr/radarr to be moved to the final location (locally) from there upload to gdrive and be done with it.

That’s the recommended way to handle new content, sure, but that’s not Plexus’ intended use case. Regarding concerns about hitting API limits, you’re extremely unlikely to do so (unless you’re using default RClone API keys which you shouldn’t be doing anyway). I’ve had it running on a dedicated server with a 1Gbit line and assuming that you’re able to download, encode and re-upload a 10GB movie each hour, you’re only going to hit 240GB/day out of the 750GB/day limit.

I understand it’s intended purpose but in my mind the use case is very niche in my opinion. I have tried the same when I wanted SD versions of my HD content but in the end it was easier to just redownload the media in SD and remux it from there. (Also stopped with that after 600GB as transcoding down from HD on the fly is faster) Specially if you’ve got a big library and most content is “freely available” redownloading and optimising after, takes less time and resources.

PS: more options is always better so happy there is something like this for people who need it :+1:t3:

1 Like

Indeed, more options never hurt and clearly it’s helping somebody :slight_smile: In my own use case, a lot of the content would be very hard to reobtain (not to mention how much of a pain it would be at scale) especially in a specific quality. Post-handling a download would be ideal, but redownloading all of your content just for that purpose would certainly take longer and use more resources, though this more specifically benefits larger libraries (mine is currently sitting at 40TB+) as it could be argued for smaller libraries.

Hello,

Thank you for your work! It looks really great! I was wondering if there is an option to use 2 audio streams? I would like to have an AAC and an AC3 stream (stereo and surround)?

Edit
I was trying it out but I’m stuck on creating a list.txt.: If I make an empty list.txt it asks if it may be deleted but there is no new list afterwards. Any ideas?

=== Plexus v0.9.48 - https://github.com/Wolveix/Plexus ===

Audio codec: aac
List file: /home/user/.plexus/list.txt
Media directory: /mnt/media/Films/Films/xxxxx.mkv
Mount Path:
Video codec: h264

    Scanning directory...
    Scanning: /mnt/media/Films/Films/xxxxxxxxxxxxxxxxxxxxxx.mkv
    Scan complete! Run plexus encode to process the list.

Soul

1 Like

Hi there!

Thanks for the kind words :slight_smile: While multiple audio streams work just fine, encoding them separately isn’t currently supported. Is there any particular benefit to having different codecs for each stream?

Hm, I’m not sure that I understand your question. Are you able to create a list at all? When scanning files, if a file doesn’t match your wanted codecs, then you should see a line saying Adding: /mnt/media/Films/Films/xxx.mkv. If you don’t see that line, then the file should already have the correct codecs.

Hello,

I’m probably doing something wrong then…

About question 1: how can I encode 2 audio codes in one file? aac (stereo) and ac3 (surround). Do I just put aac,ac3 or do I put a space between the two when I use plexus config?

About question 2: I use the command plexus list -d “/mnt/media/Films/Films/xxx.mkv”. It does not give me an “adding” line even though I picked mp4 as container. Any ideas?

Sorry, this isn’t currently supported. You can encode multiple audio streams into the same codec, but you can’t convert them into separate codecs as I can’t see any real benefit to being able to do so.

Ah, because the list function doesn’t look for incorrect containers, it looks for incorrect codecs. I’ve just implemented a container check (use -c mp4), hopefully, this will work for you :slight_smile: Please update to Plexus v0.9.50 (you can use the built-in plexus install function to update) for this added support.

Ok so if I want to use two streams in one file can I then choose aac and ac3? I’m a real noob about this :grin:. So then in Plex the user can choose which audio stream it wants (stereo aac or 5.1 ac3)? I have some users who watch on stereo laptops and others at a 5.1 surround.

Or can I select stereo ac3 and 5.1 ac3?

No worries :slight_smile: You can encode both streams into the same codec, and users will be able to still pick between stereo or surround. AAC supports both, as does AC3 :slight_smile:

Ok and last noob question. How do I pick both stereo and surround? I know where I can set ac3 but I’m not find the option for two streams?

You don’t need to specify this. If multiple audio streams exist, the script will automatically encode all of them :slight_smile:

Ok but if there is no stereo stream available? Can I make a stereo stream or is this not possible?

It is not possible to automatically re-encode a file to include a stereo version of a pre-existing surround sound stream, no. I can understand how this could be useful, however, audio transcoding takes very little processing power so it’s not really worth it. I’ll consider the feature implementation, but for now it is not natively possible.

Also, I would highly recommend updating to Plexus v0.9.51 as the list function has been drastically improved when checking for container differences.

ok thank you so much for the support. What do you recommend? AAC or AC3?

You’re absolutely welcome! If you have any ideas for additional features, please do open up an issue report on the repo :slight_smile:

Personally, I recommend AAC as that’s generally the most universally compatible format. AAC also produces better quality sound at more efficient bitrates than AC3 too :slight_smile:

1 Like

ok so I tried to use the tool and it changed the audio codec perfectly!

However it did something weird… I saw it was being converted to mp4. It had the right file extension in the “converted” folder. Then it started to mv the file back to the mounted rclone and suddenly it was back MKV but WITH the aac codec… Did I do something wrong? It plays perfectly as mkv. I then changed the extension to mp4 and it also worked…

frame=194670 fps=506 q=-1.0 Lsize= 4989494kB time=02:15:19.27 bitrate=5034.2kbits/s speed=21.1x
video:4499699kB audio:481773kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.161035%

File successfully converted.
Deleting original file.

Original file deleted.
Moving converted file to the correct location.

File successfully moved.
Deleting cached file and delisting it.

Operation successfully completed.

Thanks for catching that, the issue should be fixed in Plexus v0.9.53 :slight_smile: I’ve also improved the console output during the encode process.