Kodi v19 on rpi3b slow on some videos (H265?)

Hi!

I’ve upgraded to kodi v19 and all went fine, but some videos are “slow” and audio and video end up not in sync.

What I see is this: at some point the video starts rendering slowly, audio continues to go at normal speed and gets out of sync with the video and the subtitles (the subs are in sync with the video, it seems, not the audio). If click pause, then the audio stops and video and subs continue for a few seconds until they match. Then, unpause and the video resumes and gets out of sync again.

This doesn’t happen with every second of the video, but it seems with some scenes that might use more resources or something only. Some other scenes of the same video play just fine, audio and video in sync.

In settings → player → video I have these options:

  • Allow using DRM PRIME decoder: on
  • Allow hardware acceleration: on
  • Only allow acceleration for HEVC: off
  • PRIME Render Method: Direct to Plane

I’ve used one video for the following tests, but this slow thing happens with other videos too.

I’ve tried using EGL as “PRIME Render Method” (it crashed when playing this video), “only allow acceleretion for HEVC” set to off, and also turning off “Allow using DRM PRIME decoder” and “Allow hardware acceleration” but it didn’t help.

The file is an mkv, running “file” on it just shows: Matroska data. I’ve installed mediainfo (as suggested here: How to submit a useful support request - General - OSMC) on my laptop and run it with the video in question, I paste the output at the end

While the video is playing, kodi uses 200-300% of CPU.

I’ve tried watching the video on my laptop and plays just fine, just in case.

This seems related to AVIs have audio and video out of sync after upgrade to Kodi 19.1, although this happens with MKV not AVI. It might also be related to this: Pi 3B+ deinterlacing in Kodi v19. But I don’t know about video to really know if deinterlacing is what is happening. This was also not any question of the FAQs when upgrading (Kodi v19 troubleshooting FAQ)

Here are logs grabbed with grab-logs -A: https://paste.osmc.tv/umopuneron. Note the last thing I did with debug logging enabled is “the interesting” one. Before I did it a few times, but without debug logs, and just changing the settings mentioned above.

When seeing the logs, I saw the kernel cmdline contained “osmcdev=rbp2” (probably I installed this on a rpi2 and then switched to a rpi3). I tried changing /boot/cmdline.txt to rbp3, reboot, /proc/cmdline shows rbp3 now, but (as expected) this doesn’t change anything: video is still slow

I tried to follow all guidelines and best practices to report this, but let me know if I missed something.

My gut feeling is that playback on the raspberry pi 3 is probably limited to this behavior on the time being and nothing else to do. But I’ll be happy to try any ideas you have, hopefully this can work!

If indeed it is a limitation with kodi and rpi3, do you happen to know if this should affect rpi4?

Best,
Rodrigo

My Raspberry pi is this model (from /proc/cpuinfo):

Hardware	: BCM2835
Revision	: a02082
Serial		: 00000000c4ffcde4
Model		: Raspberry Pi 3 Model B Rev 1.2

Mediainfo on the video:

General
Unique ID                                : 175059804920930726292591263721055257791 (0x83B34AC2D80501B4AD86085CA7E304BF)
Complete name                            : [pseudo] Rick and Morty S01E07 Raising Gazorpazorp [BDRip] [1080p] [h.265].mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 236 MiB
Duration                                 : 22 min 1 s
Overall bit rate                         : 1 498 kb/s
Encoded date                             : UTC 2015-10-06 02:47:07
Writing application                      : mkvmerge v8.2.0 ('World of Adventure') 64bit
Writing library                          : libebml v1.3.1 + libmatroska v1.4.2 / Lavf56.0.100
Cover                                    : Yes
Attachments                              : cover.jpg

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 22 min 1 s
Bit rate                                 : 1 270 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.026
Stream size                              : 200 MiB (85%)
Title                                    : Encoded with IFME v4.9.4.0
Writing library                          : x265 1.7+509-f4c267f28487:[Windows][GCC 4.8.2][64 bit] 8bit
Encoding settings                        : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=3 / subme=3 / merange=57 / no-rect / no-amp / max-merge=2 / temporal-mvp / no-early-skip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / no-fast-intra / open-gop / no-temporal-layers / interlace=0 / keyint=1200 / min-keyint=23 / scenecut=40 / rc-lookahead=250 / lookahead-slices=0 / bframes=8 / bframe-bias=0 / b-adapt=2 / ref=3 / limit-refs=0 / weightp / weightb / aq-mode=1 / qg-size=32 / aq-strength=1.00 / cbqpoffs=0 / crqpoffs=0 / rd=3 / psy-rd=0.30 / rdoq-level=0 / psy-rdoq=0.00 / signhide / no-deblock / sao / sao-non-deblock / b-pyramid / cutree / rc=crf / crf=25.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / ipratio=1.40 / pbratio=1.30
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709

Audio #1
ID                                       : 2
Format                                   : AAC LC SBR
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name                          : HE-AAC
Format settings                          : Explicit
Codec ID                                 : A_AAC-2
Duration                                 : 22 min 1 s
Bit rate                                 : 166 kb/s
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 23.438 FPS (2048 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 31 ms
Stream size                              : 26.2 MiB (11%)
Title                                    : Track 1
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : AAC LC SBR
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name                          : HE-AAC
Format settings                          : Explicit
Codec ID                                 : A_AAC-2
Duration                                 : 22 min 1 s
Bit rate                                 : 58.4 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 23.438 FPS (2048 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 31 ms
Stream size                              : 9.20 MiB (4%)
Title                                    : Track 2
Default                                  : No
Forced                                   : No

Text #1
ID                                       : 4
Format                                   : ASS
Codec ID                                 : S_TEXT/ASS
Codec ID/Info                            : Advanced Sub Station Alpha
Duration                                 : 21 min 56 s
Bit rate                                 : 156 b/s
Count of elements                        : 532
Compression mode                         : Lossless
Stream size                              : 25.2 KiB (0%)
Writing library                          : Lavc56.0.100 ass
Language                                 : English
Default                                  : Yes
Forced                                   : No

Text #2
ID                                       : 5
Format                                   : ASS
Codec ID                                 : S_TEXT/ASS
Codec ID/Info                            : Advanced Sub Station Alpha
Duration                                 : 21 min 56 s
Bit rate                                 : 167 b/s
Count of elements                        : 574
Compression mode                         : Lossless
Stream size                              : 26.9 KiB (0%)
Title                                    : SDH
Writing library                          : Lavc56.0.100 ass
Language                                 : English
Default                                  : No
Forced                                   : No

Menu
00:00:00.000                             : :00:00:00.000
00:01:09.152                             : :00:01:09.152
00:01:41.018                             : :00:01:41.018
00:09:09.215                             : :00:09:09.215
00:20:39.572                             : :00:20:39.572
00:21:09.560                             : :00:21:09.560

1 Like

This is expected. There is no acceleration for HEVC on Pi 3 anymore.

1 Like

Thanks for the quick response! Do you happen to know if rpi4 has HVEC hw acceleration with kodi 19?

And do you know if kodi plans to improve the situation for rpi3?

Thanks again!
Rodrigo

There won’t be any improvements for Pi 3 and below. These models never supported HEVC officially.

Pi 4 supports HEVC – but there are some codec limitations.

This has been explained on the blog.

1 Like

I recall a blog entry that mentioned the loss of hardware-decoded mpeg2 and vc-1 on the Pi 3. I don’t recall one that mentioned loss of HEVC support. Which update was that?

1 Like

You’re right – I just checked and realised I omitted it because HEVC was never actually supported officially on Pi.

Only documented deprecation of officially supported codecs.

Thanks!

I have this exactly same issue in my Vero 4k+. I don’t know if the source is the same but sure the symptoms are exactly as described above. It seems that the video plays in slow motion a few seconds, then in normal speed, again in slow motion and so on.

I’ll try to upload the debug logs later today to give more information.

Thank you.

That would be a different topic as the Vero 4k+ has full hardware decoding support for h265.

Please open a new thread with Debug enabled logs

Finally it was a misconfiguration. I didn’t enable the “change refresh rate” option and the video I was trying to play was at 50fps. I suppose due to the difference between display and video fps, the video was glitching trying to adapt to the display rate.

Thank you.

I don’t know what you mean with “anymore” but I can tell you that I have 2 Pi 3, one with retropie and kernel 4.something and another with OSMC full-upgraded to latest debian and kernel 5.10.stuff… and retropie IS playing my h265 1080p stuff whereas the OSMC is failing

OSMC uses Kodi.
Kodi deprecated OMX/MMAL decode pathways which means no accelerated HEVC on Pi 3 anymore.

I outlined this clearly here in more detail: Kodi v19 Matrix is here. Here's what you need to know - OSMC

Cheers

Sam