As a general rule RAM size and I/O performance don't make a difference for video decoding performance or cause stuttering. RPi5 has the CPU grunt to software-decode most formats to 4K30 (only HEVC is hardware decoded and supported above that) so media format can be important. Kodi config also needs to be right, see: https://wiki.libreelec.tv/configuration/4k-hdr