Skip to content

Kernel 5.10 - RPI3 - Kodi 18.x does not play HEVC videos anymore #4112

Open

Description

@mkreisl

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?

Activity

  1. popcornmix commented on Feb 2, 2021

    @popcornmix
    Collaborator

    I think this because /dev/vcsm no longer exists and so /dev/vcsm-cma is used instead. The former allocates from gpu_mem and the latter from cma (e.g add cma=256M to cmdline.txt).
    Try reducing gpu_mem and increasing cma. I think that will get it playing.
    But there is a performance hit to memory that is allocated from cma which isn't currently arm cacheable.
    We need to decide what the best solution for that is.

  2. mkreisl commented on Feb 2, 2021

    @mkreisl
    Author

    Yes, that was the solution
    I vaguely remember the discussion with cma=256M, but I didn't have it on my mind anymore

    Thanks a lot @popcornmix

  3. mkreisl commented on Feb 2, 2021

    @mkreisl
    Author

    But there is a performance hit to memory that is allocated from cma which isn't currently arm cacheable.
    We need to decide what the best solution for that is.

    Oh yes, now I see what you mean.HEVC is currently unusable with kernel 5.10 and RPi3, so please find an acceptable solution quickly.

    Thanks

  4. Maltz42 commented on Feb 13, 2021

    @Maltz42

    I'm seeing this on a RPI4 running Kodi 18.7 as well. Since the kernel update, Kodi hangs shortly after HEVC videos begin to play.

  5. amandamana commented on Feb 13, 2021

    @amandamana

    Found a report of kernel 5.10.11 breaking h264 1080p/50 playback (and degrading 720p) on a RPI2.

  6. Maltz42 commented on Feb 25, 2021

    @Maltz42

    Ok, so I've just set up a new RPi4 from scratch and ran into this same issue again. cma=256M did not solve the issue, but rolling back to a 5.4 kernel via rpi-update did.

  7. Akrai commented on Feb 25, 2021

    @Akrai

    yeah I've been unable to play h265 videos anymore since i updated the kernel like two or three weeks ago, i hope a fix comes soon 🙏

  8. harristom commented on Mar 1, 2021

    @harristom

    Ok, so I've just set up a new RPi4 from scratch and ran into this same issue again. cma=256M did not solve the issue, but rolling back to a 5.4 kernel via rpi-update did.

    I have the same problem - how did you do this?

  9. timothyjward commented on Mar 3, 2021

    @timothyjward

    Ok, so I've just set up a new RPi4 from scratch and ran into this same issue again. cma=256M did not solve the issue, but rolling back to a 5.4 kernel via rpi-update did.

    I have the same problem - how did you do this?

    I would assume that it was

    sudo BRANCH=stable rpi-update b7c8ef64ea24435519f05c38a2238658908c038e
    

    As far as I can tell this is the last version of the stable firmware branch using a 5.4 kernel

  10. Franck-Berry commented on Mar 4, 2021

    @Franck-Berry

    FYI, I have the same problem on a Raspberry Pi 4: unable to play HEVC videos with Kodi 18.7 since the new Kernel 5.10 update. (After switching back to Kernel 5.4.83, everything works again.)

    I described the problem on the raspberrypi.org forum and provided a Kodi log (which doesn't help much):
    https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=251645&hilit=kodi&sid=73f21dfa564d8f79c05ff5d2d08fee70&start=475#p1828887
    https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=251645&hilit=kodi&sid=73f21dfa564d8f79c05ff5d2d08fee70&start=475#p1829049

  11. popcornmix commented on Mar 4, 2021

    @popcornmix
    Collaborator

    Currently the only solution to get hevc working well on Pi2/3 is to downgrade kernel to 5.4 (e.g. #4112 (comment))

  12. Maltz42 commented on Mar 4, 2021

    @Maltz42

    Is there a solution other than a kernel downgrade for Pi4? I'm wondering why you specified Pi2/3, since this is also a problem for Pi4.

  13. popcornmix commented on Mar 4, 2021

    @popcornmix
    Collaborator

    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
    
  14. 21 remaining items

  15. harristom commented on Mar 10, 2021

    @harristom

    Ok, so I've just set up a new RPi4 from scratch and ran into this same issue again. cma=256M did not solve the issue, but rolling back to a 5.4 kernel via rpi-update did.

    I have the same problem - how did you do this?

    I would assume that it was

    sudo BRANCH=stable rpi-update b7c8ef64ea24435519f05c38a2238658908c038e
    

    As far as I can tell this is the last version of the stable firmware branch using a 5.4 kernel

    Thanks, this fixed it for me on my Pi 4

  16. Akrai commented on Mar 24, 2021

    @Akrai

    So I just tried the cma options and I can confirm using it (for example cma-512) does work for some easy normal bitrate 1080p movies, but it doesn't for higher res, high bitrate ones, the system still crashes

  17. harristom commented on May 24, 2021

    @harristom

    Apt updated to the latest stable kernel and the problem still isn't fixed. Had to roll back to b7c8ef64ea24435519f05c38a2238658908c038e again.

    In case it helps troubleshooting, I am on a Pi 4. Kodi crashes on some (but not all) HEVC files. Resolution doesn't seem to make a difference and anyway they are all 1080p or lower. Attaching my config.txt and cmdline.txt (basically at defaults, with 320M GPU memory added as required by Kodi).
    config.txt
    cmdline.txt

  18. ZedeN1 commented on May 31, 2021

    @ZedeN1

    Apt updated to the latest stable kernel and the problem still isn't fixed. Had to roll back to b7c8ef64ea24435519f05c38a2238658908c038e again.

    My RPi4 would not let me downgrade after apt upgrade (latest firmware already installed message). I had to do this first:
    sudo rm /boot/.firmware_revision
    sudo BRANCH=stable rpi-update b7c8ef64ea24435519f05c38a2238658908c038e

  19. deleted a comment from skrenes on Jun 8, 2021
  20. deleted a comment from 6by9 on Jun 8, 2021
  21. deleted a comment from Maltz42 on Jun 8, 2021
  22. deleted a comment from JamesH65 on Jun 8, 2021
  23. deleted a comment from skrenes on Jun 8, 2021
  24. deleted a comment from JamesH65 on Jun 8, 2021
  25. deleted a comment from Akrai on Jun 8, 2021
  26. deleted a comment from skrenes on Jun 8, 2021
  27. deleted a comment from JamesH65 on Jun 8, 2021
  28. pelwell commented on Jun 8, 2021

    @pelwell
    Contributor

    [ Deleted off-topic comments ]

  29. Octoton commented on Oct 3, 2021

    @Octoton

    On a raspberry pi 4 with kernel 5.10 and kodi 18.4 and after lot of crash I was able to read my hevc by following popcornmix answer in https://forum.kodi.tv/showthread.php?tid=354154

    I found this after looking at the console output of kodi as the log had no info whatsoever. The console was outputing: can't open /dev/argon-hevcmem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions