Jump to content
jonp

Plex: Guide to Moving Transcoding to RAM

224 posts in this topic Last Reply

Recommended Posts

/config/go on your flash drive (/boot/config/go)

 

Standard bash script.  I guess you would wind up adding these commands to it

 

mkdir -p /tmp/emby
chown nobody:nobody /tmp/emby

 

 

Thank you sir. Actually all that I need is line-2; if I'm remembering what occurs correctly (it's been a month since my last reboot).

You'll need them both, because without the mkdir, when it hits the chown it will error out if the directory isn't already made (and since emhttp starts in the background and whenever it gets around to it starts up the docker apps, the odds are really against the directory existing no matter where you put the chown in the go file unless you add appropriate waits.

 

Understood, but that's what I was trying to say before, /tmp/emby had stayed on reboot but the ownership reverted back to root. Minor point - the information you provided me earlier is enough for me to get that working (regardless of the actual behavior). Thanks again for your time and post.

Share this post


Link to post

Nice! I did not know about this.

Tried it out now and tried to make my server bleed.

Total ram 16GB

Running 2VMs that uses 3GB ram each, crashplan backup, and tried 3plex streams, one to pc, one to iPad and last to htc phone.

Worked for a bit, then the phone said it lost connection, then the ipad lost connection and then the pc resumed playing :P

cpu and ram usage 99%

Share this post


Link to post

Understood, but that's what I was trying to say before, /tmp/emby had stayed on reboot but the ownership reverted back to root. Minor point - the information you provided me earlier is enough for me to get that working (regardless of the actual behavior). Thanks again for your time and post.

/tmp/emby does not stay on reboot.  Rather its recreated at the time of the emby docker restarting.  And after its created is when you'd have to do the chown.  Hence why I'm suggesting to create the folder first.  Otherwise the chown in go will do nothing, because the folder doesn't exist at that point.

Share this post


Link to post

Understood, but that's what I was trying to say before, /tmp/emby had stayed on reboot but the ownership reverted back to root. Minor point - the information you provided me earlier is enough for me to get that working (regardless of the actual behavior). Thanks again for your time and post.

/tmp/emby does not stay on reboot.  Rather its recreated at the time of the emby docker restarting.  And after its created is when you'd have to do the chown.  Hence why I'm suggesting to create the folder first.  Otherwise the chown in go will do nothing, because the folder doesn't exist at that point.

 

Ah that makes since. I think last time I tried, I started Emby got an error with transcoding. Looked back and saw /tmp/emby/ owned by root and thought, "okay it's permissions issue, I just need to do chown." You just just saved me the step of having the error one more time and going, "Ah that's why Squid mentioned both commands." 

 

Thanks for helping me skip a step, shame on you robbing me of an "Ah HA!" moment.  ;D No, seriously, thanks.

Share this post


Link to post

Just an old thread - i know - but one question: How is this working without Docker???

I dont use Docker for Plex, so how can i change the Transcoder-directory to RAM?

Share this post


Link to post

Just an old thread - i know - but one question: How is this working without Docker???

I dont use Docker for Plex, so how can i change the Transcoder-directory to RAM?

 

If you're using a plugin then Plex will have direct access to unRAID's folders. Map the transcode temp directory to /tmp

Share this post


Link to post

You need to do the following in youyr plex VM:

 

sudo mkdir /mnt/RAM_disk

 

then edit fstab:

 

sudo vi /etc/fstab

 

add the following line as last line (scroll down and to the right, press A, press ENTER):

 

tmpfs /mnt/RAM_disk tmpfs rw,size=2G,comment=x-gvfs-show     0 0

 

then close and save (ESC, ":", wq <ENTER>)

 

(2G stands for 2gigs, if you need 1, make it 1G)

 

then reload fstab:

 

sudo mount -a <ENTER>

 

Now go into plex, and change the temporary transcode directory (settings, server, transcoder).

 

 

Share this post


Link to post

Just an old thread - i know - but one question: How is this working without Docker???

I dont use Docker for Plex, so how can i change the Transcoder-directory to RAM?

 

If you're using a plugin then Plex will have direct access to unRAID's folders. Map the transcode temp directory to /tmp

 

I have the same question, using Plex without Docker. Saw your answer here, and most of the movies I stream work great on normal (lower quality) movies with 150MB in transcode directory.

But when I try higher quality movies, like Blu-Ray for example it doesn't play the movie, just stuck on loading and giving me the error down below in the log. It did work good before when I had the transcode directory on the disk.

 

I have set the transcode temp directory to /tmp in the web client and /tmp in the plex settings via unraid web client. Any clue what's wrong?  :o

 

You need to do the following in youyr plex VM:

 

sudo mkdir /mnt/RAM_disk...

...Now go into plex, and change the temporary transcode directory (settings, server, transcoder).

 

*EDIT* Tried the above too, but that gave no sucess. Same error... Down below is the log. I just censored out the path to the hobbit movie.  :'(

 

May 10, 2016 20:18:08 [0x7faa5e7ff700] DEBUG - [universal] Using local file path instead of URL: /mnt/user/.../.../Hobbit/Hobbit.mkv
May 10, 2016 20:18:08 [0x7faa5e7ff700] WARN - Low disk space: 11736151856 bytes source file, 2147483648 bytes capacity, 2147483648 bytes available on /mnt/RAM_disk
May 10, 2016 20:18:08 [0x7faa5e7ff700] WARN - TranscodeSession: inadequate disk space for transcode
May 10, 2016 20:18:08 [0x7faa5e7ff700] ERROR - Failed to start session successfully.

Share this post


Link to post

Doesn't the log tell you what is going wrong ?  It is stating there is not enough diskspace available.. Should mean your ramdisk is to small... Just make it bigger..

Share this post


Link to post

I heard something about that plex no longer supports transcode in ram.

Anyone know if that is true or not?

Share this post


Link to post

I heard something about that plex no longer supports transcode in ram.

Anyone know if that is true or not?

here

Share this post


Link to post

I heard something about that plex no longer supports transcode in ram.

Anyone know if that is true or not?

here

 

Oh crap, I've been planning to purchase extra RAM since last year so that I could comfortably transcode to RAM.

 

So I've finally just purchased an extra 16GB of RAM - before reading this. Bummer

Share this post


Link to post

I heard something about that plex no longer supports transcode in ram.

Anyone know if that is true or not?

here

 

Oh crap, I've been planning to purchase extra RAM since last year so that I could comfortably transcode to RAM.

 

So I've finally just purchased an extra 16GB of RAM - before reading this. Bummer

 

not a bummer you got more ram, more power

Share this post


Link to post

I know that transcoding in RAM has apparently not worked for while. I have a docker that was set up a while ago and was reviewing the settings I had put in:

 

I noticed that I have a host path as /tmp, and a container path as /transcode

 

Within plex I have the temp directory under transcoder set to /transcode.

 

Everything continues to run fine. So if transcoding to RAM is no longer supported and yet everything works, my question is what is Plex actually using for a directory to transcode now with these mappings I have? My goal initially was to have faster transcoding and avoid using my SSD cache to transcode. What is the best practice now? Should I use an unassigned drive outside the array for transcoding?

Share this post


Link to post

I know that transcoding in RAM has apparently not worked for while. I have a docker that was set up a while ago and was reviewing the settings I had put in:

 

I noticed that I have a host path as /tmp, and a container path as /transcode

 

Within plex I have the temp directory under transcoder set to /transcode.

 

Everything continues to run fine. So if transcoding to RAM is no longer supported and yet everything works, my question is what is Plex actually using for a directory to transcode now with these mappings I have? My goal initially was to have faster transcoding and avoid using my SSD cache to transcode. What is the best practice now? Should I use an unassigned drive outside the array for transcoding?

Host path /tmp is definitely in RAM. I don't know if plex can really be aware of this or not though, so it might be working despite their claims that it won't.

Share this post


Link to post

I just set Plex back up in my environment after upgrading hardware and it is working fine just pointing the transcoding directory to /tmp.  I think the key here is the amount of Memory you have available.  From what I understand, Plex check to see if you have enough space in the /transcode directory to hold the entire file before play regardless if it is transcoding.  So if your video file was 8GB, you need that much available in /tmp.  I think the size of the /tmp location is defaulted to half of the the installed memory

 

I originally had only 16 GB of ram in my old server and I could only transcode tv shows while almost almost all my movies failed when transcode was set to /tmp.  I now have 96 GB of ram (48 available in /tmp) so it has not had a problem transcoding anything.

 

So it's really dependent on your environment (dockers, vm's, memory installed) if it will work for you.

Share this post


Link to post

Hi Guys,

 

I think the easiest way to do this and to make sure it works is:

 

1) Login using SSH to your Unraid server > ssh root@unraid(IP)

2) mkdir /ramdisk

3) mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk

4) This will create a 1G /ramdisk

5) Set Plex set to container (/transcode) host (/ramdisk)

6) Change Plex settings to /transcode

7) Be happy .. you can actually go inside the folder too: cd /ramdisk, start a movie and do a couple of ls or df -h and you will see that being used.

 

Enjoy!

-Marco

Share this post


Link to post

Hi Guys,

 

I think the easiest way to do this and to make sure it works is:

 

1) Login using SSH to your Unraid server > ssh root@unraid(IP)

2) mkdir /ramdisk

3) mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk

4) This will create a 1G /ramdisk

5) Set Plex set to container (/transcode) host (/ramdisk)

6) Change Plex settings to /transcode

7) Be happy .. you can actually go inside the folder too: cd /ramdisk, start a movie and do a couple of ls or df -h and you will see that being used.

 

Enjoy!

-Marco

 

I can't test it right now but if this works then I guess Steps 2 and 3 should be in the "Go" file to ensure it works across reboots  :)

Share this post


Link to post

...

2) mkdir /ramdisk

3) mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk

...

I don't think so.

Share this post


Link to post

Hi Guys,

 

Yes, trurl, sorry for the typo that is correct, I have also tested adding lines to the /boot/go script and it works great.

Here are the reviewed steps , including the go script change:
 

1) Login using SSH to your Unraid server > ssh root@unraid(IP)

2) mkdir /ramdisk

3) mount -t tmpfs -o size=1024m tmpfs /ramdisk

4) This will create a 1G /ramdisk

5) Set Plex set to container (/transcode) host (/ramdisk)

6) Change Plex settings to /transcode

7) Be happy .. you can actually go inside the folder too: cd /ramdisk, start a movie and do a couple of ls or df -h and you will see that being used.
8) To make it persistent, you can add the lines to the go script under /boot/config
9) Here are the lines in mine that are working:
#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &
ethtool -K eth0 tx off sg off tso off
mkdir /ramdisk
mount -t tmpfs -o size=1024m tmpfs /ramdisk

NOTE: This is my whole go script, the only lines you really need are the last two ones to be added to whatever you have setup.

Share this post


Link to post
11 hours ago, mbicca said:

Hi Guys,

 

Yes, trurl, sorry for the typo that is correct, I have also tested adding lines to the /boot/go script and it works great.

Here are the reviewed steps , including the go script change:
 

1) Login using SSH to your Unraid server > ssh root@unraid(IP)

2) mkdir /ramdisk

3) mount -t tmpfs -o size=1024m tmpfs /ramdisk

4) This will create a 1G /ramdisk

5) Set Plex set to container (/transcode) host (/ramdisk)

6) Change Plex settings to /transcode

7) Be happy .. you can actually go inside the folder too: cd /ramdisk, start a movie and do a couple of ls or df -h and you will see that being used.
8) To make it persistent, you can add the lines to the go script under /boot/config
9) Here are the lines in mine that are working:
#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &
ethtool -K eth0 tx off sg off tso off
mkdir /ramdisk
mount -t tmpfs -o size=1024m tmpfs /ramdisk

NOTE: This is my whole go script, the only lines you really need are the last two ones to be added to whatever you have setup.

 

 

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
 

Share this post


Link to post

How much ram is really needed for this? I saw a previous post that it would need more ram than the largest video file because plex stores the entire file in the transcode. I don't know if that's true or not. For me that would mean something like 40GB+. Seems excessive and my motherboard maxs out at 32GB.

Share this post


Link to post
10 hours ago, wgstarks said:

How much ram is really needed for this? I saw a previous post that it would need more ram than the largest video file because plex stores the entire file in the transcode. I don't know if that's true or not. For me that would mean something like 40GB+. Seems excessive and my motherboard maxs out at 32GB.

You can make a test and monitor the folder where Plex stores the transcoded data, play a file and see what you get. Keep in mind that if there are several users there might be more data than only yours.

Share this post


Link to post

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.