Video not working on some x264 files. (RPI4)

  • Hi.

    Running latest beta on a RPI4. (same thing happened on the latest stable too that's why I tried the beta)

    I have a few x264 encoded files that do not work.

    What I mean is the movie starts playing in the background somehow beacuse I can hear the audio of the respective file coming from the speakers but the video does not show up, I'm left staring at the GUI :/.

    I have tested these files on a LePotato and an Odroid N2 (both running Coreelec) and they work fine.

    Any help would be apprreciated.

  • H264 has lots of variations and the H264 codec in the Amlogic vendor kernel that CE uses handles more of the non-standard ones than the RPi4 codec. Two common examples are 4K H264 (RPi4 handles 1080p max) and 10-bit H264 (not a broadcast standard, RPi4 doesn't support it at all). RPi5 sort of solves the RPi4 issue by having no H264 hardware codec at all so ffmpeg falls back to software decode which allows a wider range of media to be played; at the expense of needing more CPU (and RPi5 generally has enough).

    NB: To confirm the theory ^ you'll need to share Kodi debug logs and/or media samples.

  • ^ I have a hunch this is trying to output 8-bit/1080p/H264 at 4K and I think this runs afoul of the RPi4's "H264 1080p max" rule so you get no video output. Have a read of https://wiki.libreelec.tv/configuration/4k-hdr and set the whitelist entries correctly. Working?

  • Ha ^^^^^^

    I fixed it myself.

    Thanks to some suggested threads below I put gpu_mem=96 in config.txt and now it's working!

    Also I noticed that disabling hardware decoding also solved the issue but that wasn't what I was looking for.

    Soooo... first thanks for the help and second, how come gpu_mem=96 isn't the default instead of 76?

  • Soooo... first thanks for the help and second, how come gpu_mem=96 isn't the default instead of 76?

    The Pi's hardware video decoder is designed for level High Profile, level 4.1 H.264 encodes, as used by Blu-Ray.

    We'll play any file encoded to that format with the default gpu_mem.

    My guess if your file has been badly encoded (possibly a large number of reference frames requiring level 5).

    You may be able to play these with increased gpu_mem (but it's not guaranteed). Best to avoid these encodes if you can.