Akrai
4 March 2021 17:53
1
So like a month ago or so, there was a kernel update in my raspberry pi 4, and since then i was unable to play any hevc video on it.
I’ll leave here my research,
https://forum.kodi.tv/showthread.php?tid=360345
opened 03:06PM - 02 Feb 21 UTC
Now that the kernel 5.10 has been set to default, I would like to point out that… with Kodi v18 playback of HEVC videos with Raspberry Pi3 is no longer possible.
Used a kernel 5.10.10 with default settings (bcm2709_defconfig). A Raspberry Pi4 on the other hand plays them and the 5.4.x kernel also shows no problems.
Most of the time the playback starts, but the picture is much darker than usual, the sound is normal. but after a few seconds the playback stops and kodi restarts
The playback problem has already started with 5.7 or 5.8 kernel and has not improved until now.
This can be found in the log. Seems that there is some memory allocation problem with MMAL
```
Feb 2 15:51:20 kmxbilr2 2 15:51:20.088 T:1415569632 DEBUG: VideoPlayer::Sync - Audio - pts: 288000.000000, cache: 509577.709119, totalcache: 800000.011921
Feb 2 15:51:20 kmxbilr2 2 15:51:20.088 T:1415569632 DEBUG: VideoPlayer::Sync - Video - pts: 5000.000000, cache: 50000.000000, totalcache: 100000.000000
Feb 2 15:51:20 kmxbilr2 2 15:51:20.088 T:1423962336 DEBUG: CVideoPlayerVideo - CDVDMsg::GENERAL_RESYNC(-221577.709119)
Feb 2 15:51:20 kmxbilr2 2 15:51:20.089 T:1753329888 DEBUG: OnAVStarted: CApplication::OnAVStarted
Feb 2 15:51:20 kmxbilr2 2 15:51:20.089 T:1283715296 DEBUG: CVideoPlayerAudio - CDVDMsg::GENERAL_RESYNC(-221577.709119), level: 96, cache: 501168.959119
Feb 2 15:51:20 kmxbilr2 2 15:51:20.089 T:1283715296 DEBUG: CDVDAudio::Resume - resume audio stream
Feb 2 15:51:20 kmxbilr2 2 15:51:20.090 T:1423962336 ERROR: CMMALPool::GetBuffer - failed pool:0x56b18ca0 omvb:(nil) mmal:0x56bf9650 timeout:500
Feb 2 15:51:20 kmxbilr2 2 15:51:20.090 T:1423962336 ERROR: CDecoder::FFGetBuffer Failed to allocated buffer in time
Feb 2 15:51:20 kmxbilr2 2 15:51:20.090 T:1423962336 ERROR: ffmpeg[54DFF0E0]: [hevc_rpi] get_buffer() failed
Feb 2 15:51:20 kmxbilr2 2 15:51:20.091 T:1874850016 DEBUG: CRBP::AdjustHDMIClock(1.00000) = 1.00000
Feb 2 15:51:20 kmxbilr2 2 15:51:20.091 T:1874850016 DEBUG: ActiveAE - start sync of audio stream
Feb 2 15:51:20 kmxbilr2 2 15:51:20.091 T:1342464224 ERROR: ffmpeg[500460E0]: [hevc_rpi] thread_get_buffer() failed
Feb 2 15:51:20 kmxbilr2 2 15:51:20.091 T:1342464224 DEBUG: ffmpeg[500460E0]: [hevc_rpi] Error parsing NAL unit #0.
Feb 2 15:51:20 kmxbilr2 2 15:51:20.095 T:1423962336 ERROR: CMMALPool::GetBuffer - failed pool:0x56b18ca0 omvb:(nil) mmal:0x56bf9828 timeout:500
Feb 2 15:51:20 kmxbilr2 2 15:51:20.095 T:1423962336 ERROR: CDecoder::FFGetBuffer Failed to allocated buffer in time
Feb 2 15:51:20 kmxbilr2 2 15:51:20.095 T:1423962336 ERROR: ffmpeg[54DFF0E0]: [hevc_rpi] get_buffer() failed
Feb 2 15:51:20 kmxbilr2 2 15:51:20.096 T:1334071520 ERROR: ffmpeg[4F8450E0]: [hevc_rpi] thread_get_buffer() failed
Feb 2 15:51:20 kmxbilr2 2 15:51:20.096 T:1334071520 DEBUG: ffmpeg[4F8450E0]: [hevc_rpi] Error parsing NAL unit #0.
Feb 2 15:51:20 kmxbilr2 2 15:51:20.098 T:1423962336 ERROR: CMMALPool::GetBuffer - failed pool:0x56b18ca0 omvb:(nil) mmal:0x56bf9a00 timeout:500
Feb 2 15:51:20 kmxbilr2 2 15:51:20.098 T:1423962336 ERROR: CDecoder::FFGetBuffer Failed to allocated buffer in time
Feb 2 15:51:20 kmxbilr2 2 15:51:20.099 T:1423962336 ERROR: ffmpeg[54DFF0E0]: [hevc_rpi] get_buffer() failed
Feb 2 15:51:20 kmxbilr2 2 15:51:20.100 T:1325678816 ERROR: ffmpeg[4F0440E0]: [hevc_rpi] thread_get_buffer() failed
Feb 2 15:51:20 kmxbilr2 2 15:51:20.100 T:1325678816 DEBUG: ffmpeg[4F0440E0]: [hevc_rpi] Error parsing NAL unit #0.
```
Used firmware:
```
vcgencmd version
Jan 7 2021 18:34:00
Copyright (c) 2012 Broadcom
version fb345a0c2d5544957f4ba1a2b9e968970e3312c4 (clean) (release) (start_x)
```
Tried `gpu_mem=192/384/512` without any difference
Maybe I missed something?
But long story short, the kernel changed some memory allocation settings. Now, the dev says that in RPi 4 it should still work by changing a setting. And before trying it out, I was wondering if anybody else here tried, and I searched but I couldn’t find anybody with the same issue, which surprises me as playing HEVC on a raspberry pi 4 is, i think, very common…
So anyway I just wanted to know if any other person out there with a RPi 4 has run into this trouble and how did you fixed it, and also to know if this solution proposed by the dev:
hevc should still work on Pi4. You may need to increase cma memory allocation.
e.g. remove the gpu_mem setting from config.txt and add a cma setting to the fkms overlay. e.g.
dtoverlay=vc4-fkms-v3d,cma-256
>
Should work or if, as it seems this is gonna be a permanent situation, if the dietpi devs should make some aditional settings in the scripts to take this into account for this distro
Thanks!
Hi,
yesterday there was a new kernel 5.10.17 released by Raspberry OS devs. Maybe you can try it out
We had a similar report on this post, https://dietpi.com/forum/t/nfs-issues-blocky-choppy-playback-from-kodi-and-others/4959/6
There it was already find to downgrade kernel to 5.10.10
For the vc4-fkms-v3d this can be set using dietpi-config. However cma-256 would need to be added manually.
Akrai
4 March 2021 21:43
3
Hi, I just upgraded and tested it and it still crashes, so it looks like for now this situation is somewhat permanent in the short term… If I add the cma-256 parameter, which value should i give it? And also, could it conflict with dietpi scripts which handles this file?
did you tried to downgrade kernel to 5.10.10
Usually updating config.txt should be fine. I’m not sure on the value to be used for cma. Maybe RPi dev could give a hint.