Green and purple flicker on MP4 files with HW acceleration

I have a couple of videos which, when playing them in OSMC/Kodi, just show green and purple flickering lines superimposed over the actual image. When I stop the playback or show the OSD for a second, the picture is completely OK. This only happens for SOME videos. In general the playback of video files works without problem.

Debugging this issue lead to the solution that disabling the HW acceleration at Settings->Player->Video->Allow hardware acceleration allows for proper playback again, but at a much higher CPU load. The problem occures as well as on a RPI2 as on a PiZero2 I have for testing, and also with the latest OSMC version (2022.03-1). Disabling the “PRIME Decoder” in the same settings action (and thereby also disabling the hw acceleration) works as well.

Full logs:
https://paste.osmc.tv/siduqocuwu

I also tried the “PRIME Render Method: EGL” (instead of Direct To Plane) but this immediately gives me a “sad” face when trying to play something.

Exiftool shows me this metadata for the file with the playback problem:

ExifTool Version Number         : 11.88
File Name                       : Hairy Bikers' Best of British episode 2 - Bread.mp4
Directory                       : .
File Size                       : 557 MB
File Modification Date/Time     : 2021:08:07 22:01:48+02:00
File Access Date/Time           : 2022:04:17 23:13:51+02:00
File Inode Change Date/Time     : 2021:08:07 22:01:48+02:00
File Permissions                : rwxr-xr-x
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4  Base Media v1 [IS0 14496-12:2003]
Minor Version                   : 0.2.0
Compatible Brands               : isom, iso2, avc1, mp41
Movie Header Version            : 0
Create Date                     : 0000:00:00 00:00:00
Modify Date                     : 0000:00:00 00:00:00
Time Scale                      : 1000
Duration                        : 0:28:29
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 0000:00:00 00:00:00
Track Modify Date               : 0000:00:00 00:00:00
Track ID                        : 1
Track Duration                  : 0:28:29
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 1280
Image Height                    : 720
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1280
Source Image Height             : 720
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Pixel Aspect Ratio              : 1:1
Video Frame Rate                : 50
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 0000:00:00 00:00:00
Media Modify Date               : 0000:00:00 00:00:00
Media Time Scale                : 44100
Media Duration                  : 0:28:29
Media Language Code             : und
Handler Description             : SoundHandler
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Encoder                         : Lavf58.29.100
Media Data Size                 : 582236806
Media Data Offset               : 2192185
Image Size                      : 1280x720
Megapixels                      : 0.922
Avg Bitrate                     : 2.73 Mbps
Rotation                        : 0

Full mediainfo:

General
Complete name                            : Best of British - Bread episode 2 [x7wcyn1].mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 557 MiB
Duration                                 : 28 min 29 s
Overall bit rate                         : 2 736 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.2
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 3 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 28 min 29 s
Bit rate                                 : 2 597 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 50.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.056
Stream size                              : 529 MiB (95%)
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 28 min 29 s
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 26.1 MiB (5%)
Default                                  : Yes
Alternate group                          : 1

General
Complete name                            : Hairy Bikers' Best of British episode 2 - Bread.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 557 MiB
Duration                                 : 28 min 29 s
Overall bit rate                         : 2 736 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.2
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 3 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 28 min 29 s
Bit rate                                 : 2 597 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 50.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.056
Stream size                              : 529 MiB (95%)
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 28 min 29 s
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 26.1 MiB (5%)
Default                                  : Yes
Alternate group                          : 1

For now just play with hardware acceleration disabled.

Thanks! Can you elaborate a bit about the root cause of the flickering? I‘ve read about similar symptoms when using Dolby Vision encoded files, but those for sure arent‘t encoded like that? What’s special about this MP4, that Kodi has problems decoding it properly? Is this something we can hope to get fixed or is it inherent? Does it happen with all Pi models?

What’s the downside of disabling HW acceleration? I presume files with higher bitrate might stutter and the Pi itself will get hotter due to higher load?

Thanks!

Hi,

Unfortunately the Pi isn’t an OSMC developed device, so we don’t have access to HW VPU stack and we are not able to fix things directly. We can only do this for Vero devices.

So we refer these issues to Pi/upstream and merge any fixes they make.

Re. Dolby Vision: we are working on a solution for Vero devices.

Those are indeed the issues you could experience.
But Pi4 can comfortably play 720p of most codecs in software without an issue.

Cheers

Sam