Plex library optimize - Gdrive


You don’t need to; that was the point.
MKV (Matroska) and MP4 are simply “containers” for the video/audio/subtitle/etc.
The codec that the video and audio are encoded in is what matters.
Assuming all your files are encoded using AVC/h.264/MPEG-4* then whether they are in an MKV container or an MP4 container means Plex can convert them to a file format your player can use with almost zero CPU overhead.

Converting them prior to watching gains almost no speed advantage - as even Atom processors can do real-time conversion from an MKV with MPEG-4/h.264 to the mp4 container - and wastes hard drive space at best if you keep both copies, or reduces quality if you only keep the new copy.

*Note - NOT the same as MP4 which is a container, although almost all MP4 containers are either AVC, h.264 or MPEG-4. The MP4 container can use HEVC/h.265 encoded video as well h.263 but you’ll likely never see that


Thank you for the information!

I have one last question: can I encode embed subtitles in mp4 or is this not possible?

Thank you,



I believe MP4 supports one subtitle track. Plexus should automatically encode subtitles that already exist within the file, but it won’t look for external subtitle files to encode into the file, though this could be a great feature to implement.


Do I have to use a certain command to encode existing subtitle files? I just tried it but he didn’t encode the subtitles (PSG).


Ah, PGS subtitles aren’t supported, so that would be why. MKVs should support PGS subtitles just fine, but I’ve always had issues with FFmpeg whenever trying to handle them. I’ll do some more testing with newer revisions of FFmpeg and get back to you.


Ok, but it also did not work with normal subtitles… is this because of the mp4 container?


Hmm, shouldn’t be. Normal subtitle tracks should encode just fine, though admittedly I haven’t tested this with an MP4 container.


I just did the test. With mkv it workes perfectly but with mp4 it failed.


Thank you for testing this, I’ll do some research and hopefully work on a fix :slight_smile: Remember that MP4’s only support a single subtitle stream. Could you try encoding to MP4 again with the --verbose flag, please?


So if I understand it correctly it doesn’t matter for plex if the container is mkv or mp4. I just have to select h.264 as coded and AAC for audio? Even if it will have to transcode? I sometimes have 4 people watching on apple devices and then I see “transcoding”. I’m a bit allergic to it :).


Correct. The container doesn’t matter that much in regards to transcoding with Plex. MKV supports more than MP4 does. The video, audio, and subtitle codecs matter more, but primarily the video codec.


Ok, I just tried using the verbose tag (plexus encode --verbose) but I don’t really see any additional data? Is there a log file anywhere?

Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Output #0, mp4, to ‘/home/user/.plexus/encode/converted/xxxxxx.mp4’:
encoder : Lavf58.20.100
Chapter #0:0: start 0.000000, end 281.907000
title : 00:00:00.000
Chapter #0:1: start 281.907000, end 688.313000
title : 00:04:41.907
Chapter #0:2: start 688.313000, end 934.642000
title : 00:11:28.313
Chapter #0:3: start 934.642000, end 1257.047000
title : 00:15:34.642
Chapter #0:4: start 1257.047000, end 1551.049000
title : 00:20:57.047
Chapter #0:5: start 1551.049000, end 1929.302000
title : 00:25:51.049
Chapter #0:6: start 1929.302000, end 2262.260000
title : 00:32:09.302
Chapter #0:7: start 2262.260000, end 2612.360000
title : 00:37:42.260
Chapter #0:8: start 2612.360000, end 2813.227000
title : 00:43:32.360
Chapter #0:9: start 2813.227000, end 3214.253000
title : 00:46:53.227
Chapter #0:10: start 3214.253000, end 3411.450000
title : 00:53:34.253
Chapter #0:11: start 3411.450000, end 3823.945000
title : 00:56:51.450
Chapter #0:12: start 3823.945000, end 4142.180000
title : 01:03:43.945
Chapter #0:13: start 4142.180000, end 4444.440000
title : 01:09:02.180
Chapter #0:14: start 4444.440000, end 4660.698000
title : 01:14:04.440
Chapter #0:15: start 4660.698000, end 5122.166000
title : 01:17:40.698
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1440x1080 [SAR 1:1 DAR 4:3], q=2-31, 23.98 fps, 23.98 tbr, 16k tbn, 1k tbc (default)
DURATION : 01:25:22.201000000
Stream #0:1(eng): Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 48000 Hz, 5.1, s16, 488 kb/s (default)
DURATION : 01:25:22.208000000
encoder : Lavc58.35.100 libfdk_aac
frame= 8758 fps=276 q=-1.0 size= 473088kB time=00:06:05.19 bitrate=10612.1kbits/s speed=11.5x 428.2kbits/s speed=12.2x


That is the verbose output. By default, you should just see an FFmpeg progress bar, whereas --verbose shows FFmpeg’s output in it’s entirety.


Right on.
I prefer MKV because it allows for multiple audio and subtitle streams/formats.
I.E. I can include a 7.1 DTS file for when I’m watching on a home theater and a 2.0 AAC for cell or stereo device, as well as add subtitles (which don’t require transcoding from Plex, unlike some subtitle formats.)

The problem with Plex remains that even if you store multiple files of different resolutions or types, by default it will play the highest quality file and transcode it. Say you have a 4K, 1080p and 720p version of a video, and the user wants 720p. You’d think it would just stream the 720p right? WRONG. It will play the 4K file - which is often also 10bit color - and transcode it to 720p (and 8bit color making it look washed out).)


Likewise, this is why MKV is the default for Plexus.

This is by far my biggest gripe with Plex. I wish they would implement better support for multiple versions of the same media.


I was using the Plex Optmizer and in my testing, if I had a lower version and hit play, it would pick the lower version all by itself.

I tested with a 4k movie and having a 1080p version.


This would be awesome. I’ll have to wait a bit until this feature is implemented because I have some shows which use PSG and I don’t want to lose the subtitles…


Likewise, I have quite a few files that annoyingly use PGS. I can’t find a reasonable way to encode PGS into MKV files using FFmpeg, however, I should be able to export the subtitles into the media directory, which Plex should support.


The subtitle extracting functionality is working, but for some reason, the end phase of the encode command (move or upload the newly encoded files) is failing when trying to upload the subtitles via RClone. Weird. Hopefully, I’ll figure out the issue soon.


That is a bit weird. Is there already an update so I can try it out?