RPI4 HEVC playback max bitrate

  • Hi,

    I have carried out a little test about the HEVC playback capability of my Raspberry PI 4 1 GB with LibreELEC 9.2.2. I used Big Buck Bunny 4K 3840x2160, 30fps, H.264 as a source (http://bbb3d.renderfarming.net) and encoded the first 60 seconds of the video to HEVC using Handbrake 1.3.2 with the following settings: MKV, 3840x2160, H.265 10 bit x265, profile main10, level 5.1, constant quality RF 20, 18, 16, 14, 13, 12, 11, 10, 9, 8, and 7 to produce HEVC video files with increasing bitrates.

    During playback KODI Adjust display refresh rate was set to Always, the video was played from a Synology NAS through wired gigabit LAN. (The network bandwith is 930 Mbps measured by iperf3 from the PI to the NAS, and the NAS is able to serve large files at ~800 Mbps speed.)

    According to my test the highest bitrate the PI4 played smoothly was RF13 with the maximum bitrate ~60 Mbps. Playing the RF12 video dropped 3 frames between 30 sec and 40 sec where the video bitrate topped ~70 Mbps. This result is somewhat similar to my experience with real life 4K HEVC UHD-BD videos: if the video bitrate is above 80 Mbps somewhere in the video, the RPI4 playback is likely to get choppy/stuttering.

    The CPU usage is usually very low (<16%) during playback (observed using SSH & top). So I think it is more likely the limitation of the HEVC decoding block of the RPI4 SoC, or some settings in KODI, or the RPI4 is sensitive to some HEVC encoding settings.

    Unfortunately I haven't found the official specification of the RPI4 HEVC playback capability so I don't know what to expect. The only info I've found is the "INSIDE RASPBERRY PI 4" by pi3g.com stating the RPI4 is capable of decoding "HEVCv2 Main 4:4:4 10 design supporting bitstreams up to profile 5.1".

    Above 120 Mbps video bitrate the entire RPI4 is likely to freeze, and above 130 Mbps (RF 7) it is for sure. The PI4 is properly cooled so I think it is not an overheating issue. When the PI4 freezes not only the KODI user interface is unresponsive, but the SSH command line as well, and only disconnecting the power helps.

    You can see the bitrates of the encoded video files by time on the attached chart. The bitrate was calculated using ffprobe.

    I also attached the log file of first playing the RF10 video (result: stuttering) and next playing the RF7 video (result: freeze).

  • Can you provide a sample file that freezes the Pi4

    While we're unlikely to be able to play very high bitrate clips smoothly, they shouldn't cause a freeze.

  • Thank you for your answer. You can download the RF7 file from here. It freezes my RPI4 at ~30 sec, where the video stream has the highest bitrate (~140 Mbps).

    What is the highest HEVC bitrate the RPI4 is expected to play smoothly?

  • Your sample does generate a "hevc @ 0x168ca90] Out of pu + coeff intermediate memory: pus=768" warning which doesn't seem to be handled well.

    I've forwarded the report to our hevc codec guy.

    The bitrate limits are complicated. Generally higher bitrates means more motion vectors which tends increase cache misses and so increase sdram bandwidth. sdram bandwidth is usually the constraint on playing harder samples.

    You can get a slight increase in sdram bandwidth with hdmi_enable4kp60=1 (even if you don't use a 4kp60 mode) as it runs the AXI bus at 550MHz rather than 500MHz.

    The GUI overlay takes some bandwidth, so subs, OSD, debug info etc will cost some additional bandwidth.

    It may also be worth monitoring the hevc clock (vcgencmd measure_clock hevc) when the video is playing. I believe it will be 500MHz when busy and 250MHz when less busy. If it's dropping to 250MHz when your stream is playing that would limit the streams you can play.

    hevc can be overclocked, or you can disable the lower frequency (force_turbo=1 in config.txt) which could help.