Frame drop/skip on rpi4

hello :slight_smile:
i just installed osmc (2023.08-1) on my RPI4, 4GB (don’t know if this really matters). everything went fine so far however i noticed after some time (around 1-1.5h) video streams get kinda unreliable. sound and video have little stuttering, i guess it’s some kind of frame skip/drop.

stream is 720p/30fps/h.264, temperature at this point of time is around 48 degree for cpu and 50 degree for gpu (according to osmc).

is this a temperature problem? (around 50 degree should be fine imho) or any known issue with the RPI4?

any suggestions are welcome :slight_smile:
ty

Hard to say without logs but that temperature seems fine

The RPi 4 isn’t designed to start throttling till it hits 80C. Where are the files being read from? Is it all types of files or just certain codecs or containers?

it’s from internet stream. however the RPI4 is connected via gbit lan and internetconnection is 300mbit/s so it shouldn’t be an issue with a 720p stream (desktop computer consumes around 6-8mbit/s while watching same stream)

It could be a buffer issue. You could check out Kodi’s advancedsettings.xml wiki to learn how to adjust this to be a bit bigger. If it isn’t happening with locally stored files this would be the direction to follow.

i will try this, thanks :slight_smile: any recommended settings for advancedsettings.xml?

as a side note, i tryed libreelec before osmc, had the same issue there (but even worse, directly from first minute). didn’t find a solution sadly :confused:

providing a logfile after experiencing this issue would be good a start i guess? do i need to activate some kind of extended verbose output to get some useful information?

Not really. My experience has mainly been to try stuff and see what happens when it comes to playing with the cache. I’d avoid pushing the buffer rate too high or setting it to save to local storage unless you are really sure that is what you want to do.

The recommend would be to reboot twice to make the log set smaller and then enable debug logging and reproduce.

update:

i downloaded the file behind the stream and stored it locally on a ssd. playback from there work flawless so it seems to be a connection related issue (or maybe because of the use of xstream plugin?)

next i will try to adjust the advancedsettings.xml, any other suggestions?

No. If it works without issues locally then adjusting the cache settings would the thing to play with. I’d suggest to try modest settings as the cache will generally have a sweet spot such that maybe 50mb buffer will improve the situation but a 500mb one may act worse. You really just have to try stuff and try it as there is no magic set of numbers that is going to work in every situation.

seems a bit counter intuitive to me. the RPI4 comes with 4GB of ram and it only uses like 400-600mb of it. so (at least in theory) around 3,5GB are still available. wiki of advancedsettings.xml says you need 3x free ram of the selected cache so i would have started with like 500-700mb cache to achieve optimal results.

as you wrote there’s a sweet spot which seems to be individual to each installation/situation sounds a bit strange. nevertheless i will try your suggestion and see if it helps :slight_smile:

from what i understood the advancedsettings.xml needs to be created manually first as it doesn’t exist for default installation, the default value which is used for caching seems to be 20MB which might be too little for me?

sadly it didn’t change anything :frowning:

i noticed a strange behaviour:

when frames are dropped/skipped there is a green background for like 1-2 frames until the stream continues. is this a buffering issue? or codec related?

That sounds more like you need to try a different HDMI cable. Otherwise I’m not sure what would cause that.

When you say background, do you mean the whole UI?
If so – you have an HDMI PHY connectivity issue.

If it’s just the video – it sounds like an IDR has not been sent but P frames have still been sent. This would cause some green artifacting. This can be quite noticeable with UDP streams.

i’m not exactly sure what you mean. the stream runs fullscreen, so there are no visible parts of the UI while playing the stream.

i try to describe the behaviour:

it feels like the stream runs normal for like 1000 frames, then for a very brief moment (maybe 1 2 frames) the screen turns green, in this moment video and audio jumps forward for like 2-3s and everything is back to normal again. this happens every 3-5 minutes.

strange things here:

  1. when i used a local file instead of stream this didn’t happen, maybe it was a coincidence, i don’t know.

  2. this only seems to happen when the RPI4 is running for while already, cpu is running @ 900mhz and 45° at this time with around 15-25% load on one core. memoryload is around 300mb/4gb

i also connected the RPI4 to my second WQHD desktop screen, using different switch, lan and hdmi cable, the green artefacts aren’t visible there (maybe because screen is 165hz?) but the drops/skips are noticeable as well here.

from my understanding, when it’s an hardware issue with hdmi it should also happen when playing the same content as local file, right?

It should, but what you describe also doesn’t quite fit the typical behavior of a network glitch or buffer underrun either.

yes it’s really frustrating. even tryed other RPI4 and Libreelec instead of osmc and the problem occured even faster/more frequent there.

i would say it’s a general problem with RPI4 and kodi if there weren’t millions of users for whom it obviously works perfectly

Are those millions of users using that same stream?

Definitely seems to be an issue with the stream.

well the issue persists with other streams/hosters as well.

i also tryed same stream on my desktop computer running kodi, just to verify it’s not the connection or stream and it worked just fine :frowning:

below is part of kodi.log

2023-12-25 15:16:58.027 T:788      info <general>: Creating InputStream
2023-12-25 15:16:58.082 T:784      info <general>: [xStream] -> [player]: starting Playback
2023-12-25 15:16:58.118 T:788      info <general>: Creating Demuxer
2023-12-25 15:16:58.805 T:788      info <general>: Opening stream: 0 source: 256
2023-12-25 15:16:58.805 T:788      info <general>: [WHITELIST] Searching the whitelist for: width: 1328, height: 720, fps: 30.000, 3D: false
2023-12-25 15:16:58.807 T:788      info <general>: Display resolution ADJUST : 3840x2160 @ 30.000000 Hz (16) (weight: 0.000)
2023-12-25 15:16:58.852 T:788      info <general>: Creating video codec with codec id: 27
2023-12-25 15:16:58.852 T:788      info <general>: CDVDVideoCodecDRMPRIME::Open - using decoder V4L2 mem2mem H.264 decoder wrapper
2023-12-25 15:16:58.871 T:788      info <general>: Creating video thread
2023-12-25 15:16:58.871 T:796      info <general>: running thread: video_thread
2023-12-25 15:16:58.871 T:788      info <general>: Opening stream: 1 source: 256
2023-12-25 15:16:58.872 T:788      info <general>: Finding audio codec for: 86018
2023-12-25 15:16:58.873 T:788      info <general>: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder aac
2023-12-25 15:16:58.873 T:788      info <general>: OpenStream: Allowing max Out-Of-Sync Value of 10 ms
2023-12-25 15:16:58.873 T:788      info <general>: Creating audio thread
2023-12-25 15:16:58.873 T:797      info <general>: running thread: CVideoPlayerAudio::Process()
2023-12-25 15:16:58.884 T:797      info <general>: Creating audio stream (codec id: 86018, channels: 2, sample rate: 48000, no pass-through)
2023-12-25 15:16:58.902 T:550      info <general>: CActiveAESink::OpenSink - initialize sink
2023-12-25 15:16:59.101 T:550      info <general>: CAESinkALSA::Initialize - Attempting to open device "default"
2023-12-25 15:16:59.105 T:550      info <general>: CAESinkALSA::Initialize - Opened device "default"
2023-12-25 15:16:59.105 T:550      info <general>: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2023-12-25 15:16:59.105 T:550      info <general>: CAESinkALSA::InitializeHW - Using data format AE_FMT_S24NE3
2023-12-25 15:16:59.192 T:469      info <general>: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
2023-12-25 15:16:59.229 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 15:16:59.230 T:469      info <general>: [WHITELIST] Searching the whitelist for: width: 1328, height: 720, fps: 30.000, 3D: false
2023-12-25 15:16:59.231 T:469      info <general>: Display resolution ADJUST : 3840x2160 @ 30.000000 Hz (16) (weight: 0.000)
2023-12-25 15:17:28.909 T:797      info <general>: ProcessDecoderOutput: Changed max allowed Out-Of-Sync value to 70 ms due self-learning
2023-12-25 16:09:41.182 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 16:09:41.193 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:10:06.596 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 16:10:06.719 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:10:14.646 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 16:10:14.721 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:32:24.762 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:32:31.362 T:796   warning <general>: Skipped 1 duplicate messages..
2023-12-25 16:32:31.362 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 16:32:40.361 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:32:53.261 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:32:54.061 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 16:33:01.495 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:33:09.028 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 16:33:09.104 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 16:33:10.112 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 17:16:40.263 T:796   warning <general>: Skipped 1 duplicate messages..
2023-12-25 17:16:40.263 T:796   warning <general>: OutputPicture - timeout waiting for buffer
2023-12-25 17:16:40.272 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 17:16:46.075 T:469      info <general>: Loading skin file: MyVideoNav.xml, load type: KEEP_IN_MEMORY
2023-12-25 17:16:46.263 T:920     error <general>: GetDirectory - Error getting -
2023-12-25 17:16:55.033 T:469     error <general>: Window Translator: Can't find window True
2023-12-25 17:16:55.033 T:469      info <general>: [WHITELIST] Searching the whitelist for: width: 1328, height: 720, fps: 30.000, 3D: false
2023-12-25 17:16:55.039 T:469      info <general>: Display resolution ADJUST : 3840x2160 @ 30.000000 Hz (16) (weight: 0.000)

Looks like a bandwidth / throughput issue.
I would try local playback of the stream first to see if it can be reproduced.