Plex: Guide to Moving Transcoding to RAM

Recommended Posts

5 hours ago, SPOautos said:

Since Kodi can direct play them all

Kodi uses the Client's CPU to decode any audio and video stream. Instead Plex uses mainly the media decoding API of the Client. By that Plex works on any low power hardware while Kodi does not.


Finally it would be easy. Plex only needs to include different players or allow using external player softwares. There are different feature requests in the forums pointing to this:


I think Plex ignores them because Plex can't guarantee judder-free playback as it depends on resolution, hdr/sdr, bitrate, etc if the clients CPU has enough power to play a stream. Instead, the client's API guarantees it and everything that is not supported by the client, will be transcoded. Another reason could be, that they don't want users leaving the Plex UI and including open source players is a problem as Plex is making money with their software which could be disallowed by the open source players.


But finally you still have options. You could use Plex as your server and still use Kodi, Infuse, etc as your Player. Those softwares have Plex plugins for that.


Or you transcode all your content, so it can be played directly. This is how Netflix & Co solves it.


Or you consider using Emby / Jellyfin. They support external playback as far as I know.

Link to comment
On 1/2/2021 at 4:46 AM, mgutt said:

That's the reason why you should limit the RAM path to 4 or 8GB. Even your server can crash.


Plex uses as much space for the temporary transcoding files as available. This has nothing to do with 4K. The same would happen if multiple clients transcode 1080p streams. Plex preserves so much files so the user is able to jump back on the timeline without the need to re-transcode. But as this is a rare case, you can limit the RAM usage without problems. Plex starts cleaning when there is no space left. In theory you could even limit it to 100MB (don't do it, causes juddering ;) ).


I’ve created a 4GB Ramdisk folder for Plex transcoding and it’s working perfectly.  It fills up and then Plex clears it out seamlessly. Thanks again for the reply. 

  • Like 1
Link to comment
On 12/14/2020 at 1:03 PM, UnraidDuck said:

Thanks to @Hoopster Reminder to RTFM, I now have Plex transcoding to the RAM disk.


So I also use Binhex PlexPass container so this image is super helpful! What I am curious about is which script did you end up using as I see two different ones posted in the comments.


There's this one...


mkdir /tmp/PlexRamScratch

chmod -R 777 /tmp/PlexRamScratch

mount -t tmpfs -o size=4g tmpfs /tmp/PlexRamScratch


And also this one...


mkdir /tmp/PlexRamScratch

mount -t tmpfs -o size=4g tmpfs /tmp/PlexRamScratch

Link to comment
  • 3 weeks later...
On 9/19/2020 at 1:22 PM, mgutt said:

New Guide which uses only a limited size of your RAM

I currently came across this and don't know if this was already mentioned here but this would be also achievable with a entry in the template at 'Extra Parameters':


--mount type=tmpfs,destination=/tmp,tmpfs-size=4000000000



In the above example a RAMdisk is created with a limit of 4GB (the size has to be defined in bytes).

Link to comment
8 minutes ago, ich777 said:

--mount type=tmpfs


It should be:

--mount type=tmpfs,destination=/transcode,tmpfs-size=4000000000


As /transcode is the default transcode path of Plex:



This is really nice as it makes it even easier as this tmpfs path only exists inside of the Plex Container. I will update my Guide. Thank you!


  • Like 2
Link to comment
1 hour ago, UnraidDuck said:

The screenshot has the destination down as /transcoding, is that a typo in the text with


Sorry my bad... :P


EDIT: Corrected it in my post but that shouldn't matter this describes only the path in the container itself whether it's '/transc', '/transcode', '/transcoding', '/mnt/transcoding' or whatever you want. Just be sure to set the transcoding path in your App (Plex, Emby, Jellyfin,...) to the corresponding path that you defined in the 'Extra Parameters'.

Link to comment

ok, well, here it falls back and writes then into /tmp/transcode inside docker which ends up in filling up docker image, nevermind, was just taking a look if it simply works (as i expected too) but fails here.


ok, reverted and now it works ... dont ask me why

Edited by alturismo
Link to comment
12 minutes ago, alturismo said:

ok, reverted and now it works ... dont ask me why

If the transcode dir physically exists in the container, then this can happen. One user accidentally mapped his movies to /transcode/Movies and since then he was not able to map /transcode as a tmpfs path. Even after he corrected the wrong mapping, he was still not able to use /transcode. I think a fresh Plex installation would solve it (or an update?!). Not sure. But the solution was to use /transcode2 as the tmpfs path and changing this path in the Plex settings accordingly. 

Link to comment

yes, confirmed, as i use a script to fix hevc tone mapping for hw transcoding on plex which will end up restarting the docker, after a restart the permissions are messed ... chmod /transcode and its good again


so it works when u dont restart the docker .... at least thats my current state


and as plex also only needs a restart on updates its not the best choice (yet)

Edited by alturismo
Link to comment


50 minutes ago, ich777 said:

this sets to permissions:


Tested this. After setting it the first time it works. But after stopping / starting the container it writes to /tmp/Transcode.


Then changed to 700. Same game.


Then changed to 0770. Same game.


Result after setting 0770 and first start:

755 drwxr-xr-x   3 plex users   60 Feb  1 14:36 transcode


Result after stop / start:

755 drwxr-xr-x   2 root root    40 Feb  1 14:37 transcode


Executing this inside the container and it works again:

chown 99:100 /transcode


Another solution:

Edit the container, change nothing and hit apply (which re-creates the container). 


So stop / start and restart does not set the owner. And now?


EDIT: Seems to be a bug:




Link to comment

yes, but not really a solution when u need to run a script after docker run ;) and restart, but im glad im not alone ...


same goes for any docker like emby too it seems ... at least after tests here


and i would say, this would also hit in when u just restart the server (which in the end restarts dockers too)

Link to comment

@ich777 in emby, ffmpeg transcode logs before and after restarting docker



-segment_list "/transcode/transcoding-temp/95499A.m3u8"

after restarting docker

-segment_list "/config/transcoding-temp/BDAC04.m3u8"


of course the segmented files also come in there ...

Edited by alturismo
wrong copy / paste ;)
Link to comment

@alturismo & @mgutt


I now have a working solution.

Put this into your 'Extra Parameters':

--mount type=tmpfs,destination=/tmp,tmpfs-size=4000000000


Then go to your Plex transcoding settings and set the path to '/tmp':



Tested this after 5 restarts and the permissions for '/tmp' are always:


After the first start:

drwxrwxrwt   4 root root    80 Feb  1 15:36 tmp


After a restart:

drwxrwxrwt   3 root root    60 Feb  1 15:37 tmp


After the fifth restart:

drwxrwxrwt   3 root root    60 Feb  1 15:39 tmp



Hope that helps ;)

  • Like 1
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.