Plex: Guide to Moving Transcoding to RAM


Recommended Posts

11 hours ago, BillyPrefect said:

I just created an account to say thanks for the /tmp to /transcode translation.  I was banging my head against the monitor trying to figure out why Plex wasn't working anymore.  I tried making a separate directory, making a specific sized dataset, making it part of a config file, all sorts of things.  Found this blog entry and thought, why not, I've tried everything else... now running like it was when it was it's own machine again.  Thanks much.

 

There has been a lot of changes made to the Plex transcoder since this thread was started.

I assume you a running Plex in a Docker container, then the easiest way to get it to work is to transcode to disk and then preferably an SSD. You need to setup the Plex container with a mapping to a folder and also specify the mount point to this folder in the Plex app.

Plex does a lot of logging so it might be worth to check the Plex Media Server log for errors (not the container log).

Suggest you also look at the Plex forum, there as a lot of questions about transcoding there.

Link to comment

I browed the thread and tried to figure out the significance of /tmp.
I couldn't really find anythning obvious, so just as a quick recap for the technically inclined

On my unraid setup, /tmp is not obviously backed by a ramdisk or anything too fancy:

root@nasbox:~# mountpoint /tmp/
/tmp/ is not a mountpoint

It's just a regular old folder on the 'root' filesystem. On unraid however, the root filesystem is running in RAM itself:
 

root@nasbox:~# df -h | egrep "/$"
rootfs           16G  887M   15G   6% /

That would indeed help a bit with performance.

In this case, mounting /tmp would basically do the same as mounting /dev/shm to /transcode

I prefer /dev/shm/ since /tmp has a bunch of other things that I don't think Plex needs to have access to :)

Edited by rb2k
Link to comment
  • 1 month later...
On 3/8/2017 at 7:21 AM, uaeproz said:

 

 

I tried it but it didn't work:

 

root@Tower:/ramdisk# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           16G  389M   16G   3% /
tmpfs            16G  316K   16G   1% /run
devtmpfs         16G     0   16G   0% /dev
cgroup_root      16G     0   16G   0% /sys/fs/cgroup
tmpfs           128M  2.6M  126M   3% /var/log
/dev/sda1       7.5G  421M  7.1G   6% /boot
/dev/md1        7.3T  4.2T  3.1T  58% /mnt/disk1
/dev/md2        9.1T  4.9T  4.3T  53% /mnt/disk2
/dev/md3        7.3T  4.2T  3.2T  58% /mnt/disk3
/dev/md4        3.7T  2.7T  992G  74% /mnt/disk4
/dev/md5        3.7T  3.5T  211G  95% /mnt/disk5
/dev/md6        3.7T  2.6T  1.1T  70% /mnt/disk6
/dev/md7        3.7T  3.1T  646G  83% /mnt/disk7
/dev/md8        7.3T  5.2T  2.2T  71% /mnt/disk8
/dev/md9        3.7T  3.1T  565G  85% /mnt/disk9
/dev/md10       7.3T  5.0T  2.4T  69% /mnt/disk10
/dev/md11       7.3T  6.7T  634G  92% /mnt/disk11
/dev/md12       7.3T  4.8T  2.6T  66% /mnt/disk12
/dev/md13       3.7T   33M  3.7T   1% /mnt/disk13
/dev/md14       7.3T  2.8T  4.6T  38% /mnt/disk14
/dev/md16       3.7T   33M  3.7T   1% /mnt/disk16
/dev/md18       3.7T   33M  3.7T   1% /mnt/disk18
/dev/sdf1       943G   34G  896G   4% /mnt/cache
shfs             90T   53T   38T  59% /mnt/user0
shfs             91T   53T   38T  58% /mnt/user
/dev/loop0       10G  3.0G  6.1G  33% /var/lib/docker
tmpfs            16G     0   16G   0% /ramdisk
shm              64M  4.0K   64M   1% /var/lib/docker/containers/805bc16f4bbb9e448c9f29a3949db212b0575f66ec224946c32eaa08feca5a48/shm
 


This is really odd, I have been using this for a long time, did you try running the commands manually? Any errors?

Like:
mkdir /ramdisk
mount -t tmpfs -o size=2048m tmpfs /ramdisk

 

This is my go file and the output of df -h which shows the /ramdisk of 2GB:

# cat /boot/config/go
#!/bin/bash
# Start the Management Utility
#ethtool -K eth0 tx off sg off tso off
/usr/local/sbin/emhttp &
mkdir /ramdisk
mount -t tmpfs -o size=2048m tmpfs /ramdisk

# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           12G  396M   12G   4% /
tmpfs            12G  248K   12G   1% /run
devtmpfs         12G   16K   12G   1% /dev
cgroup_root      12G     0   12G   0% /sys/fs/cgroup
tmpfs           128M  2.4M  126M   2% /var/log
/dev/sdd1       7.6G  587M  7.1G   8% /boot
tmpfs           2.0G     0  2.0G   0% /ramdisk
/dev/md1        2.8T  1.4T  1.4T  51% /mnt/disk1
/dev/md2        2.8T  279G  2.5T  10% /mnt/disk2
/dev/md3        2.8T   17M  2.8T   1% /mnt/disk3
/dev/md4        2.8T  748G  2.0T  27% /mnt/disk4
/dev/md5        2.8T  218G  2.6T   8% /mnt/disk5
/dev/sdc1       233G  121G  111G  53% /mnt/cache
shfs             14T  2.6T   12T  19% /mnt/user
/dev/loop0       30G 1018M   28G   4% /var/lib/docker
shm              64M     0   64M   0% /var/lib/docker/containers/dfc268df8c41735b6868324017ee4856f1dd9f1d6d78521101b81b126411eb03/shm
shm              64M  8.0K   64M   1% /var/lib/docker/containers/508dfe59ead3611622afde93e85ad50f77f796511ff80c2bc4e07a814c6ea626/shm
/dev/loop1      5.0G   18M  4.9G   1% /etc/libvirt

Link to comment
  • 4 months later...
2 hours ago, bombz said:

should my plex container look like this?

Temp directory = /transcode to /tmp 

 

 

 

Capture-plex.PNG

Capture-plex2.PNG

 

You are not running a container. You are using a plug in. What the OP said was to make a volume mount that maps /transcode on the container side to /tmp on the host side. But since you use a plugin it doesn't apply to you. 

Simply put /tmp in the temp directory to use RAM as the temporary storage. 

Link to comment

OK, right on!
You can say I am kind of not overly familiar with some aspect of this, I wanted to ask to clarify. I really appreciate the response, and hope to see how it works going forward. Going to change it up now.

Love the community. Thank you again (big time)!

 

to reconfirm I posted my current changes below

 

 

Capture-transcode2.PNG

Capture-transcode.PNG

Edited by bombz
Link to comment

Don't know how the plugin works, but you should most likely just add /tmp in the plex settings as it sees your filesystem directly. It's not like in docker containers where you have to map volumes for it to see the filesystem.

I have no idea actually what they mean with temp folder for the plugin. I'm not sure if they support the plugin anymore either.

Link to comment
23 minutes ago, bombz said:

Ah OK
I appreciate the heads up. Hopefully I am on the right path here, or at least have my settings correct (as above). Perhaps someone will fill in the gaps to the posted screenshots. Maybe in the PLEX settings, I set that to /tmp as well? Guess we shall see 

 

Set the transcode path in the Plex settings to /tmp. I did say that in my previous post ;)

Link to comment
On 9/29/2017 at 11:52 AM, bombz said:

OK 
Temp Directory = /tmp
Plex Transcoder DIR = /tmp

 

I shall see how she runs. Not sure how to confirm if it is using RAM, fingers crossed. 

Thank you again

 

Login to your unRAID box via ssh and then do a directory listing (ls) on the /tmp directory when you see a transcode happening on plex. You should see a randomized plex folder be created in the /tmp directory.

Link to comment
  • 4 weeks later...
8 hours ago, superderpbro said:

This guide is kinda old. Does the OP's method still work? 

 

And if so is this correct?

 

7dwqqqw.png

 

Depends on which docker container you use. For Plex docker from LinuxServer.io, you can simply add

-v /tmp:/transcode

under Extra Parameters. You will need to toggle the Basic View to Advance View to get to Extra Parameters.

Link to comment
3 minutes ago, Katherine said:

 

Depends on which docker container you use. For Plex docker from LinuxServer.io, you can simply add


-v /tmp:/transcode

under Extra Parameters. You will need to toggle the Basic View to Advance View to get to Extra Parameters.

 

Those "extra parameters" do exactly the same thing as the "Add Configuration" box shown. They both map a volume from /tmp to /transcode.

Link to comment
  • 4 weeks later...
On 31/10/2017 at 11:00 PM, superderpbro said:

I already tried with the extra parameters and it seems to work. Not that i know a sure fire way to tell. The directory shows up in MC with plex temp files in it. NFI how to tell if that is in RAM or not heh.

Everything of the Unraid system, after boot, lives in RAM, including /tmp, as far as I know.

I have set my Plex to transcode to RAM.

I have also set a max on how much ram the plex container can use.

Since the /transcode mapping to /tmp maps outside the docker contatiner, the max ram setting most likely has zero impact on the transcodes, only on the Plex server itself.

 

Transcoding to ram only seems like a good idea if you have a lot of ram in the server and much of it is always free.

I have 12GB and usually only 25% is in use, according to unraid.

Then converting a move, it moves up to max 30%

 

 

Link to comment

I had my UNRAID server freeze up a bit while using this. Was watching a football game for about 2 hours and the transcoding must have filled the ram up till there was no memory left. I have 32 GB of RAM but I had a VM running at the same time. unRAID started killing off Dockers till it finally killed Plex. Works great for movies, TV shows etc but be careful with the DVR.

Sent from my SM-G955U using Tapatalk

  • Upvote 1
Link to comment
On 10/31/2017 at 8:24 AM, Katherine said:

 

Depends on which docker container you use. For Plex docker from LinuxServer.io, you can simply add


-v /tmp:/transcode

under Extra Parameters. You will need to toggle the Basic View to Advance View to get to Extra Parameters.

 

Sorry. Newbie question. I've added the parameter and plex "applied" successfully. Where using MC should I find this directory (I'd like to verify that's where the transcoding is going)? I show a /tmp under the root directory and a /var/tmp as well.

Edited by manorfan
Link to comment
1 hour ago, manorfan said:

 

Sorry. Newbie question. I've added the parameter and plex "applied" successfully. Where using MC should I find this directory (I'd like to verify that's where the transcoding is going)? I show a /tmp under the root directory and a /var/tmp as well.

The mapping specifies /tmp so that is what is used.

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.

Guest
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.