Stuttering with certain encodes (CVideoPlayerAudio::Process - stream stalled)


#1

i’m running v8.95.7 on a Minix U9-H and i’m getting some skipping with a certain set of encodes.

when starting playback the audio seems to run ok, video pauses/stutters very bad, then after a few seconds there is a quick pause which re-syncs video/audio and then the video immediately pauses again while you here the audio run. i have not noticed this in any other files. a pastebin of the kodi debug log is available here. i have not seen this type of skipping with any other video files, nor do i see it using VLC on a desktop. the files are being served from a NAS, however i do not believe it is a network issue as i see no issues streaming the files to a desktop nor do i see issues streaming other/larger files to the Minix.

i found a similar topic here and have verified /sys/module/amvdec_h265/parameters/dynamic_buf_num_margin is 16.

any thoughts or suggestions?


#2

The problem is with the encodes you are using.
We had to revert setting buffer to 16 for 4K content, because it required to reset the whole decoder after skipping in the video. This forced a resync with the display, and made for a very bad user experience, especially with HDR video. We left this tweak on for sub 4K content, though, because it seems to be the most susceptible to this issue.


#3

thanks, i figured it was the encodes. these files are 1080p, so i’d expect the tweak to still be working on them. is the tweak available in the menu settings?

any idea what it is about the encodes themselves causing the issue?


#4

I can’t say about the encodes, never had a problem with the files I have (I don’t have any 1080P ones).
Regarding the tweak, it’s hard coded at the moment, there’s no toggle for it.


#5

Hi I have the same on a lot of my encodes I how only use H265 Software encoding and maybe once an hour the video will go at highspeed for around 10 seconds then freeze the audio will continue at normal speed once the audio catches up everything then continues normally. It only seemed to have started from around V .2 or .3 but I have just put up with it. As hlarsen said the files seem to play on VLC Windows Kodi. Also if you rewind the video to the same point the error does not repeat so knowing if its fixed is hard to say. I have loads of encodes so recoding is not an option, it would be nice to know if there is an x265-param that would cure this for my new encodes.
Also If i adjust /sys/module/amvdec_h265/parameters/dynamic_buf_num_margin should I go up or down I only have about 10 4K files so I am not bothered If I break HDR Playback.


#6

echo 16 > /sys/module/amvdec_h265/parameters/dynamic_buf_num_margin


#7

Its already set to 16 should I try 8 or 12 for 720p /1080p ?


#8

Yes, you should try those values.


#9

Hi I have added the following two files.

#autostart.sh

/storage/.config/setbuf8.sh &

AND

#/storage/.config/setbuf8.sh

while true; do echo 8 > /sys/module/amvdec_h265/parameters/dynamic_buf_num_margin ; sleep 10; done &

I will see if the wife spots any skipping over the next couple of days then try 12.

If I can figure out how to find the the resolution of the file that is currrently being played I will see if I can set the buffer dynamically by resolution


#10

For my minix u9-h (playing only 1080p x265) I no longer have the rare freezes with:
echo 12 > /sys/module/amvdec_h265/parameters/dynamic_buf_num_margin

I’m glad I saw this post :slight_smile:


#11

Hi.

I have just had this issue with a 1080p movie. It froze for a couple a seconds and later run as crazy to catch up the normal paze. I had never suffer this before.

What is causing this issue exactly? The encoder is a quite reliable one.

Thanks.


#12

Hi thats exactly what I am seeing it was introduced a few months ago I never mensioned it as I though it would get ironed out eventually. With my moded autostart.sh setting dynamic_buf_num_margin to 8 still caused the FF event but for a significantly shorter period maybee 2-3 seconds rather than 8-10 seconds. Really need the wife to test as I am not watching the screen all the time as I am usualy on the laptop.


#13

Ok I upgraded to 8.99.1 and removed my patch and havent seen a skip/ff event I will get the wife to PAT test it tommorrow and pot back if there are no events in the next couple of days.


#14

from what it sounds like there are multiple issues/causes for the skipping - my test files never play in sync, watching from the beginning or skipping through the files. the video skips/pauses while the audio plays for a bit, then there is what appears to be a resync, then the same skipping/pausing video with normal audio for a few more seconds, then a resync. from some others’ descriptions in this thread i think they may have different issues.

upgrading to 8.99.1 was no help, however i suspected it would not since it seems to be an issue with how the files were encoded and some amlogic/decoder issue, since the files play fine on VLC and Kodi on Linux.

full medainfo for my test file is here if anyone notices anything interesting that could be a cause.


#15

Sorry to have hijacked your thread with a similar problem. The problem you are seeing is because you are using H264 10Bit which as far as I am aware is not suported in the 905 SOC. see https://forum.libreelec.tv/thread/1130-solved-s805-s905-glitchy-hardware-decoding-of-h-264-main10-profile-video/ . This is why I moved over to H265. I wrongly assumed you were using H265 because in your first post you mentioned /sys/module/amvdec_h265/parameters/dynamic_buf_num_margin .This setting would have no effect on your files as it is for H265 files.
How much this content do you have ? to recode it to H265 In reasonable Quality on an i5 7400 would take about 1.5 hours / episode. Its not easy to go from 10Bit H264 to 8BIT which would be quicker. The colours end up being a little off.


#16

thanks for the info on h264 10bit - i’ll just archive these files for now and perhaps come back to them next time i get a new box for the tv.

and no big deal on the thread hijack lol, glad it seems your issue was sorted. i just wanted to make sure we all knew what our actual problems were and weren’t getting confused chasing down different things =)


#17

If you have a reasonable windows box i have a program for converting those files its a command line you just put a config file in the folder you want to compress and tell it the codecs it will then back the files up then compress them into the origonal folder. I have it in a cron job that works each evening, it scans my whole library and converts any new files to h265 at about 1000KBS it removes all the none “eng” subs and sound tracks and compesses the audio to AAC V2. I wrote it myself in VB.NET and compilled a special version of FFMPEG with an AAC V2 encoder.


#18

Hi, is that right these both lines has to add in the autostart.sh and this could fix the stuttering issue?

Have someone some feedbacks or who tried this workaround. I am not quite sure if i can handle this.
Thx 4 feedback