Cant play 4K MKV files without crashing

  • Hi,

    I have a Raspberry Pi 4 with 8gb RAM and I'm trying to use it as a 4K media server for my own collection ripped from disc. I am new to this so I have scoured the internet and tried a few things to get it to work but it still wont play properly.

    I did a fresh install of LibreELEC-RPi4.arm-9.95.5.img.gz and it keeps crashing after about 20 minutes. I am using full 4K rips from a 4k disc using MakeMKV so the files are very large. The last logs I have are below. The Pi doesn't always crash in the same place so I have uploaded the old and new logs.

    hastebin - new

    hastebin - old

    I have so far tried everything I can find to get these to work including :

    Increasing GPU ram to 128, 256 and 512

    Increasing CMA ram to 768, 1024 and even 2048

    I have created a advancedsettings.xml and created a 2GB buffer

    I have created a swapfile

    I have tried switching to from v4d-kms-v3d to v4d-kms-v3d-Pi4

    Nothing I have done helps and in fact makes it worse as most of the time after I alter something the Pi wont boot or if it does the file wont play at all.

    Details of the source I'm using are in the attachments. The only difference between the two i can see is one is HDR10 and the other HDR10+.

    Any help will be greatly appreciated.

  • Keep GPU, CMA and buffer settings as they are, changing those is quite dangerous, rarely helps and most often results in non-working or unstable systems.

    If kodi crashed you should have a kodi_crash.log file in /storage/.kodi/temp/ - please upload that (or just use the crash log upload function in LE settings).

    The "new" log doesn't show you playing a video file, the "old" one shows you played a file with TrueHD audio. There are a couple of known issues with TrueHD in kodi, so try selecting a different audio stream (eg the AC3 one) and see if this works.

    so long,

    Hias

  • Hi Hias,

    Thanks for the reply. I didn't know LE had a built in log updater. I tried the one from the Kodi repository but that kept failing.

    Here are the logs I got from the LE upload

    http://ix.io/3rtg

    http://ix.io/3rth

    and this log is from playing a file with DTS-HD Master audio. Does that have the same issues as TrueHD?

    hastebin


    All the logs I have sent were run from a stock install. I didn't change anything when I created these.

    I will try running the film with just the Dolby Digital audio track and see what happens.

    Thanks

  • Hmm, journal shows that the out-of-memory-killer killed kodi, but there wasn't a kodi crash log file created. Very odd and also hard to tell what was happening there.

    Can you try the latest nightly build (currently 20210630) from here Index of / ?

    so long,

    Hias

  • Hi Hias,

    I tried the nightly build as you suggested. With 9.95.5 the film would play for about 20 minutes, then start to stutter and then the Pi would crash and reboot.

    With the nightly version after about 5 minutes the audio would drop out and the amp would not display TrueHD anymore so it wasn't getting a signal. It would come back but was dropping out frequently. The film was stuttering badly with the FPS dropping to 1.

    It then started to show the buffering circle which I haven't seen on the 9.95.5 build, the film just carried on jumping and mostly with no sound. During the buffering it would sometimes bring up the time bar at the top.

    Around 40 minutes into the film the frame rate was below 1 and the screen started to show blocks, shortly after that it crashed and rebooted.


    Here is the log :

    http://ix.io/3rDg

    and the crash log :

    http://ix.io/3rDh

    When I tried to get the log the Pi rebooted the first time so hopefully the crash log is from when the film crashed.


    I then tried the same film but used the second audio track which was AC-3 Dolby Digital

    It started stuttering from around 2 minutes and buffering so it seemed worse with the AC-3 track. The CPU usage was higher also.

    Here is the log:

    http://ix.io/3rDP

    and the crash log :

    http://ix.io/3rDQ

    Again it crashed and rebooted when I tried to get the log so hopefully these logs will be of use to you.

    I noticed in the log - WARNING <general>: Pulseaudio module module-allow-passthrough not loaded - opening PT devices might fail

    so I disabled audio passthrough..

    I still got frequent frame drops/stuttering (between 20 and 24fps) and occasional sound drop but no buffering. After 30 minutes the frame rate dropped to between 5 and 15 and the sound was cutting out frequently along with buffering.

    Memory never seemed to drop below 7550000/8085128 in any scenario.

    Hope this helps

    Thanks

  • Unfortunately the kodi crash logs are again empty and the other ones don't show you playing a file.

    It looks though that mount.ntfs triggered the OOM killer - which makes me guess you played the video from an NTFS formatted USB drive. Can you try if copying the video to SD card and playing from there works?

    so long,

    Hias

  • Hi Hias,

    Yes the USB drive was NTFS this time. I tried exFat as well and that gave the same problem.

    Shall I try formatting it to Ext4.

    I will also do as you suggested and move the file to the SD Card.

    Thanks

  • Hi Hias,

    I formatted my 2T eternal hard drive to Ext4 and put the films on there. The film played ok, a few stutters, until about 30 minutes and then it crashed and rebooted.

    This time I got the log files from the rootpath just in case it rebooted when I tried extracting them with the LibreELEC tool. I don't think the new one is of much use but the old one does show the film.

    hastebin - New

    hastebin - Old


    I couldn't find the crash log in the rootpath so I used the LibreELEC tool and it did not restart this time.

    http://ix.io/3s46


    Thanks

  • I got this with the 9.2.7 build as well which is kernel 4.19 but I didn't try it with a ext4 formatted hard drive. I will try it tonight and see if the same thing happens.

    The problem with the 9.2.7 build is it doesn't support HD Audio and that was my main reason for buying a Pi4 as I wanted a dedicated true 4K media player.

  • Well I gave up on trying to play 4K films so I installed RetroPie instead. I installed Kodi on top and I managed to play a 4K film all the way through, there were a few skips and audio sync errors but no crash. Whatever config RetroPie uses seems to work.

    I couldn't use HD audio as the Raspbian repository only has Kodi 18.7 for some reason but I guess it will come in time.

  • Parf can you please test this build? LibreELEC-RPi4.arm-10.0-devel-20210713215127-5ac3ead.img.gz - just copy it to the "Update" samba share (or to /storage/.update/ folder) and reboot.

    It contains a 64bit kernel instead of the standard 32bit LPAE one which should hopefully fix the OOM issues (I suspect 32bit LPAE and HIGHMEM are causing the OOM issues as lowmem is rather small on these kernels).

    so long,

    Hias

    for me , things seems to be more stable, still testing but so far it is solid, usuallly it crash in 20 minutes and so far it is holding up nicely

    by the way , are you going to keep making 64bit kernels from now on or this is just a quick test ?

  • for me , things seems to be more stable, still testing but so far it is solid, usuallly it crash in 20 minutes and so far it is holding up nicely

    by the way , are you going to keep making 64bit kernels from now on or this is just a quick test ?

    Thanks for testing and reporting back!

    It would be great if you - and other people with OOM issues - could do some extensive testing with this build, keeping an eye on issues (also seemingly unrelated ones), and tell us about the results.

    For now it's only a quick test, but if the OOM issues are indeed resolved by the 64bit kernel and LE runs fine with it then we will consider switching official LE RPi4 builds to it in the future.

    so long,

    Hias

  • Thanks for testing and reporting back!

    It would be great if you - and other people with OOM issues - could do some extensive testing with this build, keeping an eye on issues (also seemingly unrelated ones), and tell us about the results.

    For now it's only a quick test, but if the OOM issues are indeed resolved by the 64bit kernel and LE runs fine with it then we will consider switching official LE RPi4 builds to it in the future.

    so long,

    Hias

    I am not the original author but I suffer from the same issue with downloading torrents to external HDD , with this one I did not see the problem yet , there is also other activities going on with RPi 4B, USB attached HDD fails with the message "xhci_hcd 0000:01:00.0: WARN Cannot submit Set TR Deq Ptr" in dmesg · Issue #3981 · raspberrypi/linux · GitHub where it seems they are getting close to find out what is going wrong

  • I'm happy to do some testing.

    The files I am trying to play aren't torrent files they are full 4K rips. I think that may contribute to the problem as some films are 72mbps so the skipping may be caused by it not being able to buffer quick enough.

    I have switched to a USB power supply and a Y splitter cable for the power so it should be able to supply 6A if needed. I have also switched to an external HDD instead of a USB flash drive as its read rate is higher. This is powered from the Pi but again with a Y splitter so it has power from both the USB3 ports.

    My TV can play the files ok from a flash drive so I don't think this is the case but I'm trying to eliminate all possibilities.

    I wasn't happy about doing it as one of my logs said the mount.ntfs triggered the OOM, but I have had to format the HDD to NTFS. When I formatted it to ext4 using disk genius the Pi or Windows wouldn't recognize the file system sometimes and the drive wouldn't mount. When I tried to manually mount it I got an error saying the fs unrecognised.

    Do I need to install NTFS-3g or is it build into this built in already.

    Code
    sudo apt-get install ntfs-3g

    Thanks