Jellyfin Forum
How to setup a "RAM Disk" / transcode in RAM - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: How to setup a "RAM Disk" / transcode in RAM (/t-how-to-setup-a-ram-disk-transcode-in-ram)



How to setup a "RAM Disk" / transcode in RAM - ballen - 2023-10-17

Good morning guys,

I've seen mention (in various forum posts) of adding a RAM disk for transcoding to RAM but haven't been able to find a way to set this up?

I'm currently running Jellyfin in a Debian 12 virtual machine (on TrueNAS Scale) - Just my preferred way to run it on TrueNAS to avoid any potential upgrade issues with the TrueNAS Scale Apps in future (I experienced this in the past). I am using an NVidia Quadro P1000 (as I use an AMD CPU) which is passed through into the VM and working as expected.

So my question is: Does anyone know how I can setup a "RAM disk" (maybe link to a document explaining it?) or is it simply changing the Transcode path to /tmp or /dev/shm?

My server has a ton of RAM and so that shouldn't be an issue!

Thanks in advance!


RE: How to setup a "RAM Disk" / transcode in RAM - toytown - 2023-10-17

Depending on the quality of your collection you may find that you actually don't have enough RAM. I just opened up 1 of my 4K movies and transcoding it set to "auto" took up 81GB in the transcode folder, or in your case this would have been 81GB of ram needed and that's just for a single transcode. If you run out of RAM then the transcode will fail and the movie will stop at the position it ran out of space at.

Even one of the cheap (45$ 1TB SSD) is going to give you around 50,000 transcodes before you hit the warranty endurance level and most SSDs ive seen will hit 2x-3x that easily.


RE: How to setup a "RAM Disk" / transcode in RAM - ballen - 2023-10-17

(2023-10-17, 11:52 AM)toytown Wrote: Depending on the quality of your collection you may find that you actually don't have enough RAM.  I just opened up 1 of my 4K movies and transcoding it set to "auto" took up 81GB in the transcode folder, or in your case this would have been 81GB of ram needed and that's just for a single transcode.  If you run out of RAM then the transcode will fail and the movie will stop at the position it ran out of space at.

Even one of the cheap (45$ 1TB SSD) is going to give you around 50,000 transcodes before you hit the warranty endurance level and most SSDs ive seen will hit 2x-3x that easily.

Ah ok, so maybe best I just mount a new SSD share into the VM and use that for transcoding - RAM wise I have 128GiB of RAM on the host machine but I can see that 1x 4K transcode is already near to depleteing that Slightly-frowning-face

...I'll wait for other suggestions from the community but will otherwise look to mount an SSD (mainly just so I don't kill my expensive VM SSD during transcode - now I know Winking-face)

Thanks for your reply, I appreciate it @toytown!


RE: How to setup a "RAM Disk" / transcode in RAM - toytown - 2023-10-17

Also sorry i missed your initial question, but yes using /dev/shm works as a ramdisk. I think i initially used a tmpfs as well but that comes with a fixed size. Definitely give it a try, if your movies can generally fit in your ram then you're going to be good to go.


RE: How to setup a "RAM Disk" / transcode in RAM - TheDreadPirate - 2023-10-17

A RAM disk is only suggested if you don't have an SSD in your system. Or, if you're like me, have an ooooold SATA2 SSD with pretty slow write speeds.

If you have straight off the disc 4K HDR, 50-70Mbps, 50-75GB in size, your transcodes are going to be about that big or larger. You have to do a lot of testing to see how your system handles those transcodes. Monitor how big the transcode directory becomes.

The general wisdom with 4K HDR media is to keep it in a separate library. Pre-transcode your 4K HDR to 1080P SDR and put that 1080P copy in your main library. And for your clients/users with 4K HDR capable setups they can go to the 4K library and not have to transcode.


RE: How to setup a "RAM Disk" / transcode in RAM - Anders - 2024-06-06

How much will a 1080p x265 take in space (ram/hdd wise) in transcode?


RE: How to setup a "RAM Disk" / transcode in RAM - Efficient_Good_5784 - 2024-06-06

(2024-06-06, 11:05 AM)Anders Wrote: How much will a 1080p x265 take in space (ram/hdd wise) in transcode?
It entirely depends on the transcode's overall bitrate and duration.

If you want a quick estimate, the transcode will be about the same size as the original file as long as your transcoding from and to the same codec.

Now, if you're asking what the filesize will be from H264 to H265, that will be harder to guess, but easy to figure out if you provide the bitrate and video duration.

As an example, lets say a transcode comes out to 5Mbps and the video's duration is 20 minutes. The math is as follows:

5Mbps * 60sec = 300Mb
300Mb * 20min = 6000Mb
6000Mb / 8 = 750MB

So the transcode would come out to roughly 750MB in size.


RE: How to setup a "RAM Disk" / transcode in RAM - 5cdru1ls - 2024-06-10

(2023-10-17, 10:59 AM)ballen Wrote: Good morning guys,

I've seen mention (in various forum posts) of adding a RAM disk for transcoding to RAM but haven't been able to find a way to set this up?

I'm currently running Jellyfin in a Debian 12 virtual machine (on TrueNAS Scale) - Just my preferred way to run it on TrueNAS to avoid any potential upgrade issues with the TrueNAS Scale Apps in future (I experienced this in the past). I am using an NVidia Quadro P1000 (as I use an AMD CPU) which is passed through into the VM and working as expected.

So my question is: Does anyone know how I can setup a "RAM disk" (maybe link to a document explaining it?) or is it simply changing the Transcode path to /tmp or /dev/shm?

My server has a ton of RAM and so that shouldn't be an issue!

Thanks in advance!

Not sure what your trying to accomplish / what would your setup benefit from transcoding to ramdisk you mean?


RE: How to setup a "RAM Disk" / transcode in RAM - TheDreadPirate - 2024-06-11

Using a RAM disk reduces wear on a SSD when transcoding (which are written to disk). But modern SSDs have quite a lot of write endurance, especially larger drives.


RE: How to setup a "RAM Disk" / transcode in RAM - pcm - 2024-06-11

(2023-10-17, 10:59 AM)ballen Wrote: Good morning guys,

I've seen mention (in various forum posts) of adding a RAM disk for transcoding to RAM but haven't been able to find a way to set this up?

I'm currently running Jellyfin in a Debian 12 virtual machine (on TrueNAS Scale) - Just my preferred way to run it on TrueNAS to avoid any potential upgrade issues with the TrueNAS Scale Apps in future (I experienced this in the past). I am using an NVidia Quadro P1000 (as I use an AMD CPU) which is passed through into the VM and working as expected.

So my question is: Does anyone know how I can setup a "RAM disk" (maybe link to a document explaining it?) or is it simply changing the Transcode path to /tmp or /dev/shm?

My server has a ton of RAM and so that shouldn't be an issue!

Thanks in advance!

I have 128 GB RAM on my ubuntu workstation so I set this up as it was a no brainer thing to do... (Not just for jellyfin but for other stuff)..

On ubuntu it's pre-baked and it enabling tmp.mount service turns mounts /tmp as tmpfs. I also updated my tmp.mount script to create the necessary subdirectories when the service starts on boot.

I am not entirely sure about debian. I don't think they have tmp.mount service. But, setting up RAMdisk and enabling it to auto-mount on boot is very straightforward. Just follow the steps here- 
https://www.linuxbabe.com/command-line/create-ramdisk-linux

Once you create your ramdisk, you just need to update your jellyfin config in your dashboard to point to the RAMdisk mount point. 

In my case, I have my cache and transcode paths on my RAMdisk as separate directories.

/tmp/jellycode - for my transcodes
/tmp/jellycache - for my cache

You set your transcode path in "dashboard"->"playback"->"transcode path"
You set your cache path in "dashboard" -> "general" -> "cache path"

I guess one caveat worth mentioning is that tmpfs is not technically a pure ramdisk or ramfs ... If the linux kernel senses too much memory pressure, then it will swap-out the contents inside tmpfs onto disk. So, you gotta ensure you're not running any other memory-hog applications on the same machine hosting jellyfin.