RPI4 on Libreelec 9.1.502 thumbnail/pictures problems

  • As described on LibreELEC (Leia) 9.2 Beta 2 i did more tests to reproduce.

    Installed on clean sd card , enabled ssh and copied via samba share several test jpg files.

    When entering pictures viewer kodi just freeze for 2-4 minutes , some times on start sometimes after few picture viewing and using left/right to switch and then usually kodi resumes or crash and restarted.

    Also when new file arrived and libreelec picks it up for library scan , there is a freeze from time to time , My guess its the same problem as in the picture viewer

    crash log link : https://hardbin.com/ipfs/qmfkkdmcqvtv1frpglaqnpjba7hfjj6wzgfz3fwzfantux/#eersvybgttl4ibz8nipsijaq5fwenj5hwx3rnkafrmkk

    log link : https://hardbin.com/ipfs/qmby4ymkfixkmmp81vvzjtw7sqqe3shhygkvnzvtvswqfo/#bnorbtqrrzyexpoybfkmzjnxww5lirefyb199swpkuvs

    I think there is a problem with certain jpg types , because with my old jpg files i never managed to reproduce the freeze.

    each problematic jpg files i about 5-7 mb , i cant upload them here , if the logs are not enough i will upload them somewhere.

    Thanks in advance for any help.

    Edited 2 times, last by hagaygo ().

  • I just tried on a RPi4 (4G) without any issues.

    I remember seeing something similar in the past, caused by a lack of memory. There was a fix, but I cannot remember what it was but it was basically reducing picture thumbnails. Search Kodi thumbnails in your favourite search engine and you might find an answer.

    If you're still having issues.

    Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem.

    Note: Full logs only. No partial or modified logs.

    Do not post your logs directly into the forum, use pastebin.com and post the link.
  • Thanks for your feedback.

    I posted full logs.(the log clearly show the time gap while freeze)

    While in debug the memory status is on the OSD and while the freeze happens there is more than 450/500 mb free.

    Also the problem is clearly happens on pictures viewer, i think the freezes not while viewing pictures related to thumbnails creation.

  • I have RPI4 1GB. (i see the posted links not working currently here is last log i have )

    Using default config.txt which means GPU_MEM=320 which leaves about 680mb ram for libreelec.

    As i mentioned the test jpg i made are big , i uploaded them to google drive (all of them are 144mb).

    You can download the images from :


    Even on clean install put them on local storage and just use the picture viewer to watch them one by one (with luck it will freeze on the first/second picture).

    Thanks for your help so far.

  • Some more findings :

    1.Tested my setup with 9.1.502 on a RPI 3B (with rpi2 dist) , no problem with picture viewing and no freezes so far.

    I guess its indeed only problem with RPI4 dist.

    2.When enabling debug logging the memory usage on the OSD drop much more when viewing to attached jpg on the RPI4.

    On RPI4 it drops like 50-60mb and then goes back up (if its not get freezed).

    On RPI3B same pictures drops like 5-15 mb and goes back up. (and no UI freeze so far)

    Its indeed problem with certain jpg types which also cause problem with some thumb nails.

    Let me know if anything else is needed.

  • I've tried on my RPi and it works fine. Can you try gpu_mem=128 and see if that improves things.

    Your hardbin logs are unreachable (Gateway timeout).

    Can you provide URL of cat /storage/.kodi/temp/kodi.log | paste instead

  • What do you know , setting gpu_mem=256 (and of course 128) made the freeze/crash go away (so far).

    Still , i believe it just "hides" the problem rather than really solve it.

    I uploaded 3 videos of my libreelec behavior in each setup , they are available on


    rpi3b.mp4 = browsing the pictures on RPI3B running 9.1.502 , you can see the memory usage change is minimal.

    rpi41gb 320gpumem crash.mp4 = browsing the same pictures on RPI4 1G with gpu_mem=320 (default) - you can see the far more rapid change of memory usage and then finally kodi crashes.

    Rpi41gb Gpumem256.mp4 = browsing the pictures on RPI4 1G with gpu_mem=256 , you can still see the rapid memory usage changes , but no crash.

    I guess you have RPI4 with 2/4gb memory that's why there is no crash on your end , but i am pretty sure the memory usage does exists you just have plenty of it.8)

    The memory usage behavior happens only on certain jpg.

    I found that when i take picture with gcam app on my one plus 5 it generate a "problematic" jpg , but when i use oos cam it generate non problematic jpg.

    Thanks for the help so far and let me know if anything else is needed.

  • I'm not an expert but it looks like the RPi4 handles the GPU memory differently from RPi1/2/3. According to a hardware engineer in this Post "


    Therefore, allocating lots of "GPU memory" is normally a waste of memory and will hurt system performance. 128MB is probably plenty for dual 4K HDMI + camera + h.264 decode"

    So *maybe* 320MB is not required.

    ... and yes I have the 4G version, so loads of RAM.

  • 320mb is the default in libreelec , at least for 9.1.502.

    256mb worked with all my tested h.264/h.265/4k videos , the comment on config.txt states that 288mb is needed for some videos.

    128mb worked for me only for h.264 and few h.265 (no 4k no 10bit).

    Still , it seems there is an issue with some JPG decoding which causes a lot of memory usage comparing to rpi3.

    Little update : found few JPG which causes freeze/crash even with gpu_mem=256

    Edited once, last by hagaygo ().

  • Looks similar to my problem, the pi3b is working fine with the beta2 release, the pi4 not, but for me its from beginning with the pi4, after i put my advanced config on the pi and he loads the library with thumbnails he crashed sometimes after boot, or sometimes if iam navigate throug the menu

    btw.. here is something about gpu mem in pi4

    Memory options in config.txt - Raspberry Pi Documentation

  • I could reproduce the crash with the testfiles on a RPi4 with total_mem=1024 in config.txt Problem is that kodi is running out of memory.

    Keep in mind that (GPU) memory allocation on RPi4 is rather different to RPi3:

    On RPi4 the gpu_mem is needed for video decoding and the memory needed by the 3D graphics chip is allocated from system memory. The latter can be quite big (check for CmaTotal and CmaFree in /proc/meminfo), with a HD monitor I see about 35MB being used, with a 4k display about 90MB.

    It's planned to make memory allocation more dynamic, but that's not finished yet so for now the RPi4 needs more memory than the RPi3.

    1GB RAM and 4k output on the RPi4 isn't an ideal combination - for 4k output a 2GB RPi4 is recommended.

    so long,


  • Thanks for the feedback.

    Why only certain JPG causing the high cpu usage?

    Seems kinda weird (to say the least) that 1gb rpi4 can decode 4k h265 video but crash when decoding single jpg file.

    And btw my tv is 1080p only.

  • Not really sure, and I also find it a bit puzzling why kodi's picture viewer needs so much RAM. The testfiles were 15Mpix which roughly need 60MB uncompressed (when stored with 32bits per pixel).

    I'd recommend setting gpu_mem to 192 or 256 for now, this should work for the majority of video files.

    so long,


  • The picture viewer is just one of the problems and was "easy" to reproduce.

    Library scan picks up images from time to time , and some thumbnails creation causes freeze/crashes also.

    This scenario is much harder to reproduce since library scan are different each time (only runs on new episodes/shows/movies).

    There is a problem in image decoding in RPI4 at the moment , and i got some images that causes freeze/crash even on gpu_mem=128.

    The problem is still there on 4gb model , just "under the hood".

  • Can you please provide some sample images that fail with gpu_mem=128? My guess is they'd be larger than 15Mpix and thus require more (temporary) memory during display / thumbnail creation.

    I had a quick look at the Kodi code, one difference between RPi4 and RPi0-3 is that RPi4 uses the Kodi default methods (software decode, eGL textures) whereas RPi0-3 use the firmware (OMX) functions and textures. IIRC RPi0-3 are limited to max 2048x2048 textures whereas RPi4 supports 4096x4096 - so these need more system RAM as well.

    so long,


  • Thanks for checking things up.

    It seems you found the reason why RPI3 is handling the file with no problem, it uses the the GPU (and its memory) while RPI4 current code uses software and the RAM , thats why it needs much more.

    As for sample images , you are right the the pictures that wont work are shot with professional camera and are about 60mpx.

    I cant upload them (too personal, so i created "dummy" jpg and uploaded them to the previous shared link (https://drive.google.com/drive/folders/12susyfic64oqjida6va02vb6b3rj3vel)

    They are called 35mpx.jpg , which is the smallest that worked with for me with gpu_mem=128.

    The other one is 60mpx.jpg which is similar to the "real" one i have , and of course it doesn't work (might not work on 2gb also :))

    The RPI3 indeed works hard and it takes about 5-6 seconds to load the 60mpx.jpg file , but it does show it.

    My worries is that the software decode is buggy (since it not used on other RPI's) , since i got occasional crash/freeze on library scans , which don't normally use big images.

    Please let me know if you need anything else.