Plex: Guide to Moving Transcoding to RAM


Recommended Posts

1 hour ago, Hoopster said:

 

Any chance you have some bad RAM?  Have you noticed any other potential RAM-related issues or is it just Plex transcoding in RAM? Perhaps you are seeing the issues because Plex is trying to move things around in RAM if some is bad.

 

Even if it is the latter, a 24-hour memtest should eliminate or confirm RAM as the problem.

 

Perhaps you are seeing the issues because Plex is trying to move things around in RAM if some is bad.

 

This is a long shot, but, there does not appear to be an issue with transcoding in RAM in general.

I admit I havent ran memtest for 24 hours on the RAM, but i have done 2 hours and it was fine. I would prefer not to run memtest any more because then I need to connect a GPU (the Ryzen 1700x has no integrated...) and the server needs to be offline, and I get upset when I can't access my Plex on the iPad before i sleep...

I've had previous experience with bad RAM and in those cases Memtest almost immediately got an error.

Also everything else seems fine (I got 45 days uptime on 6.6.1 before I updated to 6.6.5)...

 

Is there some "lighter" version of memtest I could run without taking the server offline? maybe some script that runs in /tmp/ and just moves big files around verifying their integrity to simulate Plex transcoding?

Link to comment
  • 3 weeks later...

So I've been testing more and I've come to the conclusion that it is the client one of my users are using that is the problem: Chromecast. Whenever he plays something via the Chromecast it buffers the whole movie into RAM almost immediately, he can watch for 15 mins or so and then the whole movie is in RAM and gets killed.

I had him try using the web player on his computer, and then it worked fine, it only buffered a couple of % ahead of where he was, like it should.

 

chrome_2018-12-18_19-52-18.thumb.png.5318ed35a09436f888d1b70226a179e3.png

 

This picture pretty much sums it up. Look at the buffer bars.

 

EDIT: I have narrowed it down even further, and come to the conclusion that it is the transcoding of subtitles that is causing the problem, atleast when transcoding to ASS format.

chromecast-bug.thumb.png.e97b87de635d5df50ac7cb62d741c07a.png

 

EDIT 2: And you can probably narrow it down even further to only being a issue with Chromecast users, because it transcodes to a MKV container. I tried with the web player in Chrome, which also uses ASS subtitles, but a MP4 container and then I can see the transcoder is throttled.

Edited by nadbmal
Link to comment
  • 2 weeks later...

I will be giving this a try to see how it goes. I went from my SSD to what I think is my ram. LOL. Right now the transcode path is /tmp/. I dont see any ramdisk option under any folder. I did try to play a video through Chrome and I did not see my ram usage go up or down in any way. 

Link to comment
  • 2 months later...
3 minutes ago, drawmonster said:

So is


/tmp/

still the directory we should be using? Seeing posts where people are recommending


/dev/shm/

Can a mod or someone comment on which directory is recommended by the Unraid team?

On *my* server, running 6.6.6, I have a /dev/shm tmpfs mount that is allocated 32 GB of RAM (per df). I have 64 GB total RAM, not sure why it's set to 32.

 

I do not have a /tmp mount. I do have a /tmp directory, but it's not a tmpfs "RAM drive", just a plain directory.

 

You can run cat /etc/mtab to see what your current mount situation is. I imagine it's similar.

 

I have the Plex /transcode folder mapped to /dev/shm in its Docker settings. No issues so far.

Link to comment

Yeah, I've heard from smarter people than me that /dev/shm/ should work fine. But it's hard to recommend it to people when there is an "official" way posted here. Maybe a mod/dev could update the OP with this alternate way so we can post links to here for "proof"?

Edited by drawmonster
Link to comment
9 minutes ago, drawmonster said:

Yeah, I've heard from smarter people than me that /dev/shm/ should work fine. But it's hard to recommend it to people when there is an "official" way posted here. Maybe a mod/dev could update the OP with this alternate way so we can post links to here for "proof"?

I am using /tmp and have verified several times that Plex is transcoding there,  Being an OS folder outside of /mnt it is in RAM and works fine.  I have no comment on /dev/shm as I have never used it since /tmp works for me.

  • Like 1
Link to comment

@Hoopster brings up an interesting point. Because, unlike many (most?) Linux distributions, unRAID runs completely within RAM and nothing else gets mounted over-top the default rootfs (special instance of tmpfs). I believe this is similar to any "Live" distro, but don't have experience with those.

 

So even though my /tmp isn't a tmpfs mount itself, it is *on* a tmpfs mount and exists only within RAM. Thus, either /tmp (a path on a tmpfs mount) or /dev/shm (an explicit tmpfs mount) should work exactly the same other than the fact that some of the space on / will be in use already.

Link to comment
  • 4 weeks later...
2 hours ago, Spies said:

After rebooting my server, I had to change the mapping back to the /mnt/user/transcode share and then back to /tmp/transcode in order to get anything to play.

 

Any particular reasoning for this?

I've run into that bug too. It fails because there isn't a folder called "Transcode" in /tmp/transcode after a reboot since the RAM was wiped.

So you just need to create that folder and it works. You could probably automate it by running "mkdir /tmp/transcode/Transcode" at boot. 

Link to comment
1 minute ago, nadbmal said:

I've run into that bug too. It fails because there isn't a folder called "Transcode" in /tmp/transcode after a reboot since the RAM was wiped.

So you just need to create that folder and it works. You could probably automate it by running "mkdir /tmp/transcode/Transcode" at boot. 

Why bother? Follow these instructions,

9 minutes ago, MowMdown said:

You guys are making this much more complicated than it needs to be.

 

Just set the host path to:


/tmp

then you can be assured the folder exists, no need to go through the trouble of creating a transcode folder inside of /tmp.

Link to comment
3 minutes ago, nadbmal said:

It creates the Session folder when you start a transcode. It doesn't create the parent Transcode folder, and fails. 

Not for me, it creates both. I tested it by deleting both while I was transcoding, then a second later both directories were auto-generated again and the session resumed.

 

If you map only "/tmp" that is. 

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

Not for me, it creates both. I tested it by deleting both while I was transcoding, then a second later both directories were auto-generated again and the session resumed.

 

If you map only "/tmp" that is. 

Here's how to reproduce on my end (it simulates a reboot):

 

- Have guest /transcode mapped to host /tmp/plexram

- Stop the docker

- Remove the folder /tmp/plexram

- Start the docker. /tmp/plexram will be created again.

- Try playing something that requires a transcode. It will only keep on spinning.

- Create the folder "Transcode" inside /tmp/plexram

- Now it works

 

I'm attaching a screen recording of this.

 

I don't wanna map /transcode straight to /tmp incase Plex sniffs around in there or if it ever does a "rm -rf *". Mapping it to its own subfolder is safer.

 

 

Edited by nadbmal
  • Like 1
Link to comment
  • 3 weeks later...

I'm glad I stumbled across this thread. I was originally a FreeNAS user so I have a large amounts of RAM. Since Unraid doesn't use RAM for its cache or pretty much anything other then holding Unraid itself, thig gives me a use for the RAM I have.

 

It works great using the /tmp directory with no other sub-directories as Plex will create its' own. With no errors after reboots.

 

You can verify /tmp is Used only in RAM as you play a video that transcodes you will see the RAM usage on the dashboard increase. Let it play for a while and stop (not Pause) the video and you'll see the RAM usage drop to where its always is.

 

I have been running like this for a several days with four devices (Xbox One, Xbox 360s, and Roku) transcoding off and on and all at the same time with 30+ hours watched without an issue.

Link to comment

@nadbmal that's because you're not mapping directly to /tmp you're mapping to /tmp/plexram (don't do this) Plex cannot generate /plexram once it's deleted. That's why in your situation when you delete that directory it fails to transcode. it's looking for a folder that doesn't exist (docker is creating this path not plex)

 

Just use /tmp as the transcode directory Plex will autogenerate /Transcode/Sessions every time on its own when a transcode is needed. you will never run into that issue doing it the proper way I described here: 

 

Edited by MowMdown
Link to comment
7 minutes ago, MowMdown said:

@nadbmal that's because you're not mapping directly to /tmp you're mapping to /tmp/plexram (don't do this) Plex cannot generate /plexram once it's deleted. That's why in your situation when you delete that directory it fails to transcode. it's looking for a folder that doesn't exist (docker is creating this path not plex)

 

Just use /tmp as the transcode directory Plex will autogenerate /Transcode/Sessions every time on its own when a transcode is needed. you will never run into that issue doing it the proper way I described here: 

 

I don't wanna map /transcode straight to /tmp incase Plex sniffs around in there or if it ever does a "rm -rf *". Mapping it to its own subfolder is safer.

Link to comment

Doing this completely borks my plex.  I have my plex appdata on an unassigned SSD

I'm using nvidia card for transcoding and I'm running the encode/decode user script.

 

I assume one of those things is what's breaking it. I just get spinning circle. Even when I undo the change and set everything back I can't get things to load at home. Assuming a full reboot will be needed.  Anyone else in this boat?

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.