TS file skipping

Hi,

Latest Coreelec 8.95.2 on 905X

I have a HDMI to DVB converter feeding into TVHeadend.

When playing channel on CoreELEC I get a stutter every 2 seconds or so. Playing in LibreELEC on a nVidia card playback of file is smooth. Playback from HMDI converter direct into TV is smooth.

Attached clip of Sky News with the news ticker clearly showing the stutter

http://www.mediafire.com/file/uxm5b6e5s1kvq2h/SKY-SKY2018-09-22.ts/file

Log file

http://www.mediafire.com/file/3sxpwqcm93hm7t9/kodi.log/file

I see in log, the decoder is skipping frames. The video stream is non standard encoded (e.g. frame duration is 0 msec, pts and dts have same value) and hw decoder has issue to decode it. In kernel log are reported following errors:

[84538.463246@0] codec:detect vout mode change!!!
[84538.463307@0] codec:[video4osd] first picture {1920,1080} pts:0,
[84538.503269@0] DI: recycle_keep_buffer recycle keep cur di_buf 1 (
[84538.503280@0] DI: 6 DI: 7
[84538.503288@0] DI: )
[84538.503374@0] codec:VsyncEnableVideoLayer
[84538.543346@0] codec:[video4osd] first picture {1920,1080} pts:1c4d0,
[84538.583504@0] codec:VsyncEnableVideoLayer
[84539.025155@0] vidioc_qbuf skip: index:1166984:1166983
[84539.064100@0] vidioc_qbuf skip: index:1166986:1166985
[84539.104129@0] vidioc_qbuf skip: index:1166989:1166988
[84539.116926@0] codec:finished correct frame dur
[84539.116947@0] codec: new=3840,old_duration=3840,cnt=25
[84539.144373@0] vidioc_qbuf skip: index:1166991:1166990
[84539.184388@0] vidioc_qbuf skip: index:1166993:1166992
[84539.223975@0] vidioc_qbuf skip: index:1166996:1166995
[84539.263948@0] vidioc_qbuf skip: index:1166998:1166997
[84539.303936@0] vidioc_qbuf skip: index:1167000:1166999
[84539.344116@0] vidioc_qbuf skip: index:1167003:1167002
[84539.504061@0] vidioc_qbuf skip: index:1167008:1167007
[84539.544934@0] vidioc_qbuf skip: index:1167010:1167009
[84539.584320@0] vidioc_qbuf skip: index:1167013:1167012
[84539.623960@0] vidioc_qbuf skip: index:1167015:1167014
[84539.663938@0] vidioc_qbuf skip: index:1167017:1167016
[84539.704084@0] vidioc_qbuf skip: index:1167020:1167019
[84539.744154@0] vidioc_qbuf skip: index:1167022:1167021
[84539.784158@0] vidioc_qbuf skip: index:1167024:1167023
[84539.824017@0] vidioc_qbuf skip: index:1167027:1167026
[84539.983927@0] vidioc_qbuf skip: index:1167032:1167031
[84540.023946@0] vidioc_qbuf skip: index:1167034:1167033
[84540.064253@0] vidioc_qbuf skip: index:1167037:1167036
[84540.103943@0] vidioc_qbuf skip: index:1167039:1167038
[84540.144559@0] vidioc_qbuf skip: index:1167041:1167040
[84540.184594@0] vidioc_qbuf skip: index:1167044:1167043

Thanks for checking. Do you think it is just luck it plays perfect in Windows 10 and LibreELEC?

I think I have the same issue.

Im running TVHeadend on a server with PCIe DVB-S cards.
In CoreELEC I have stuttering/skipping frames. With LibreELEC not (but color banding issues with other files).
I tried several settings (disable hardware acceleration, disable deinterlace, allowed resulutions…) but nothing helped.

I agree with chakobsa, that these frames skips only with CoreELEC are strange.

I was very happy when I first used CoreELEC because this was the first time HDR movies run smooth and without color banding issues. But these (new) issues with all ts files are so Bad, that I couldnt use CoreELEC… :frowning:

720p Transport Stream

Hi,

I’ve made some further research. I’ve recorded a tv show for a few seconds and played it with the current LibreELEC (v8.95.1 BETA), CoreEELE (8.95.6) and other video players in Windows 10 (VLC, Windows Media Player, Win10 Media Player).

You can find all files (log, screenshots, ts sample file) here: My Files

With LibreELEC and other media players everything runs smooth. With CoreELEC, I (and others) have stuttering media playback (frame skipping) when playing ts files.

What I also did/tried:

  • I found an old recording I made with MediaPortal Server before I moved to TVHeadend → Same stuttering with CoreElec, smooth playback with others => TVHeadend seems not be the issue

  • I tested ffmpeg instead of amlogic decoder → Same issue

  • It doesn’t matter if I play it via the tv plugin or via the video plugin (choosing ts file from server)

  • Changing allowed resolutions had no impact


I want to reply to this post from @afl1 :

You’re right, but this seems to be only the case for the very first second(s). After that, neither LibreELEC nor CoreELEC is logging this error anymore (ERROR: ffmpeg[D5334370]: [mpeg2video] Invalid frame dimensions 0x0.)


My conclusion:
Something has to be wrong in CoreELEC. I’ve used the same hardware and the same media file.
Maybe the invalid frame size at the beginning might be the cause - but maybe this isn’t unusual for ts files in the first second and other media players don’t care?!

At the moment, I think I’m going back to LibreELEC. I watch far more TV recordings than 4k HDR videos (which are way better with CoreELEC)… :disappointed_relieved:

I hope that you create an issue for this bug. It’s a little bit sad, that this error is known for quite a time but it seems that no one cares (no reply to @chakobsa last post). Maybe ts files are not so relevant anymore, but in this case the feature should be disabled in CE.

BTW:
I really wonder why Khadas Vim / S905X devices are officially supported by LE (and CE). I was trying to get different S905X with 4k HDR support to work since months. But nothing runs smooth and without errors… Sorry, but I’m a little disappointed, spend much money and time… :disappointed:

Regards

Arne

I’m using PVR functionality with TVH on a daily basis and everything is running smooth.
And I’m extremely sensible to stuttering videos.
Therefore I wouldn’t call it a general bug in CoreELEC.

Did you properly configure your resolution/refresh rate whitelist?
This is a new feature in Kodi Leia (not included in your LE Krypton build), which caused many problems with smooth playback.
But to make it clear: This is not a CoreELEC problem, but a Kodi one instead.

The issue is only in incorrect frame rate settinngs. The skips are on regular basis every ~160 ms. It looks like you watching 50fps movies on 60fps video settings.

14:46:47.833 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:3 iter.pts:1.120 lf:1 latency:-0.065 Clock:1.152
14:46:47.833 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:4 iter.pts:1.140 lf:0 latency:-0.065 Clock:1.153
14:46:47.835 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:45ms pts:1.200 Clock:1.155 Level:2 elapsed:0.008ms
14:46:47.855 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:45ms pts:1.220 Clock:1.175 Level:3 elapsed:0.007ms
14:46:47.875 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:44ms pts:1.240 Clock:1.195 Level:3 elapsed:0.008ms
14:46:47.877 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:63ms pts:1.260 Clock:1.197 Level:4 elapsed:0.007ms
14:46:47.878 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:81ms pts:1.280 Clock:1.198 Level:5 elapsed:0.005ms
14:46:47.880 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:33.00 ttd:101ms x:0.003
14:46:47.917 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:62ms pts:1.300 Clock:1.237 Level:5 elapsed:0.007ms
14:46:47.934 T:4065272688 DEBUG: ActiveAE::SyncStream - average error 0.899358, last average error: 1109.345123
14:46:47.956 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:44ms pts:1.320 Clock:1.276 Level:4 elapsed:0.007ms
14:46:47.976 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:44ms pts:1.340 Clock:1.296 Level:4 elapsed:0.012ms
14:46:47.994 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:5 iter.pts:1.280 lf:1 latency:-0.065 Clock:1.314
14:46:47.994 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:6 iter.pts:1.300 lf:0 latency:-0.065 Clock:1.314
14:46:47.998 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:42ms pts:1.360 Clock:1.318 Level:2 elapsed:0.016ms
14:46:48.019 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:41ms pts:1.380 Clock:1.339 Level:3 elapsed:0.015ms
14:46:48.040 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:40ms pts:1.400 Clock:1.360 Level:3 elapsed:0.014ms
14:46:48.042 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:58ms pts:1.420 Clock:1.362 Level:4 elapsed:0.010ms
14:46:48.043 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:76ms pts:1.440 Clock:1.363 Level:5 elapsed:0.010ms
14:46:48.045 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:29.00 ttd:95ms x:0.003
14:46:48.045 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:30.00 ttd:95ms x:0.003
14:46:48.078 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:62ms pts:1.460 Clock:1.398 Level:5 elapsed:0.008ms
14:46:48.105 T:4065272688 DEBUG: ActiveAE::SyncStream - average error of -42.574121, start adjusting
14:46:48.105 T:4065272688 DEBUG: ActiveAE::SyncStream - average error -0.011621 below threshold of 30.000000
14:46:48.119 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:41ms pts:1.480 Clock:1.439 Level:4 elapsed:0.008ms
14:46:48.139 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:41ms pts:1.500 Clock:1.459 Level:4 elapsed:0.007ms
14:46:48.150 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:29.00 ttd:51ms x:0.002
14:46:48.152 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:7 iter.pts:1.440 lf:1 latency:-0.065 Clock:1.472
14:46:48.152 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:8 iter.pts:1.460 lf:0 latency:-0.065 Clock:1.472
14:46:48.160 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:40ms pts:1.520 Clock:1.479 Level:2 elapsed:0.008ms
14:46:48.180 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:40ms pts:1.540 Clock:1.499 Level:3 elapsed:0.007ms
14:46:48.200 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:29.00 ttd:41ms x:0.001
14:46:48.200 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:40ms pts:1.560 Clock:1.520 Level:3 elapsed:0.007ms
14:46:48.201 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:58ms pts:1.580 Clock:1.521 Level:4 elapsed:0.004ms
14:46:48.203 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:29.00 ttd:77ms x:0.003
14:46:48.203 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:76ms pts:1.600 Clock:1.523 Level:5 elapsed:0.006ms
14:46:48.205 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:30.00 ttd:96ms x:0.003
14:46:48.205 T:3505386352 DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:31.00 ttd:95ms x:0.003
14:46:48.234 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:66ms pts:1.620 Clock:1.554 Level:5 elapsed:0.008ms
14:46:48.273 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:46ms pts:1.640 Clock:1.593 Level:5 elapsed:0.011ms
14:46:48.294 T:3505386352 DEBUG: CVideoPlayerVideo::OutputPicture - ttd:46ms pts:1.660 Clock:1.614 Level:4 elapsed:0.010ms
14:46:48.313 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:9 iter.pts:1.600 lf:1 latency:-0.065 Clock:1.632
14:46:48.313 T:4087417232 DEBUG: CRenderManager::PrepareNextRender Frame Skip:10 iter.pts:1.620 lf:0 latency:-0.065 Clock:1.633

Hi guys,

Just registered to post reply here that I have exactly same issue.
My box is M8S Pro+ 2/16gb and TVheadend on my Linux server.
I have zero problems when using LibreELEC (8.2.3.1) and also on my Windows 10 PC.
On CoreELEC however I have very similar logs like OP and my TV broadcasting missing some audio or video frames which is not enjoyable.
What I found is that under LibreELEC 8.9 or 9.0 which are based on Kodi 18 it’s donig it also so maybe this is something with Kodi or newer kernel used in this build?
Let my know if you need any logs from me but as I said, their are identical to OP.

EDIT: also it’s looks like this only happeining on HD streams, when I play SD there is no problem at all

Did you read afl1’s or my replies?

Regarding my logs, both, CE and LE use/switch to 1080p @ 50hz when playing 576i or 720p, ts files with 25hz. 1080p @ 50Hz is also my default resolution (so no need to switch) and 50Hz is set to default in PVR settings.
I agree, in CE it looks like the refresh rate is wrong, even if logs say different.
I copied my settings from LE to CE, so they are identical.

I think yes, 1080p with 23.98, 24, 50 and 60hz. (In LE it works even without a whitelist). Die this issue it makes no difference if I define a resolution whitelist or not.

Maybe resolution switching is not working properly with Khadas VIM and ts files in CE?
Tomorrow I will disable the res. change in the settings. My default res. settings are already correct, so it should run without stutter. I’ll report If that changes anything (even if its no option for daily use)

Regards

Arne

=> Disabling resolution switching won’t fix it, still stuttering.

Which hardware do you use? @chakobsa just wrote “S905X”, I’m using Khadas Vim 1 (S905X), and @houmles has a M8S Pro+ 2/16gb (S905W, right !?).
My TV is a LG OLED 65 B7.

I don’t understand that. LibreELEC is running smooth, CoreELEC not - but it is a Kodi issue? Maybe you can explain it to me.
I’m using LE since 7 months, many different versions, different hardware (first PC, then several S905X until I bought the Khadas VIM). Stuttering playback was never an issue. Smooth playback was one of the reasons why I switched from MediaPortal (which I used over 10 years) to LE/Kodi.

Please tell me, if I can test anything more or if you need other logs or anything. It would be nice if you can fix this issue because I would like to use CE because of the color banding issues of LE with HDR movies.

Regards

Arne

I tried on my box, also all is working
One thing you can try more:

  1. Upgrade to latest 8.95.7 release, there were some refresh rate improvements in this release.
  2. Unselect all resolutions in Whitelist option
  3. Check if “Adjust display refresh rate” is “On start/stop”
  4. Try this file

If still the same situation than please try install 8.95.7 release from scratch on new sd card, don’t install nothing additional, check step 3, don’t change default refresh rate(left it 60Hz) and try this file.
Check if you have refresh rate change(TV must blink and change refresh rate)
If still have an issue - upload full logs, include also dmesg output.

I don’t know if it can help you, but you can try. We can’t repeat this issue.

Thanks @boot2k3 for your reply.

I did all this, but still frame skips. The resolution change definitively works, my tv turns black for ~ 1 sec, before the playback starts. (My tv don’t show me the current refresh rate, only the resolution (which is 1080p). So if Kodi/CE sets the wrong refresh rate (not 50Hz, like the logs say), I couldn’t check that. I only now, that it is smooth in LE, I’m very sensible for stuttering.)

You didn’t attach any file, so I tried it with my recording (My Files) again. Do you have a another test file for me?

What I didn’t do so far is trying it with a clean install. I wait for your answer regarding “your ts file”. (BTW: I didn’t restore the Kodi settings from LE to CE, only network sources, databases, plugins&settings etc.).

Regards

Arne

I mean to try your file again(as you did).
As you have still the same problem, please try clean build on new card to exclude some config issues. And try your file again.

If problem will be solved than you can configure your system again step by step and check what cause this issue.
If not solved - full logs on clean system as I said before. May be we can find something more.

But I hope clean build will solve your issue.

Got it !

The stuttering has to do with the audio offset setting. If you play a .ts file and set an offset greater +50ms (ahead), stuttering starts. I need an offset of +125ms to keep audio in sync.

Audio delays are causing no problems, just positive values.

That was quite a long way today… With the clean system everything was smooth - now I know it was because I didn’t set the audio offset. A few hours ago I was searching the error in the backup/restore procedure…

I’m happy to find this out - hope you guys can reproduce and fix it :wink:

Regards

Arne

Yeah, this is a known issue, which seems to be introduced with Kodi 18.
Does your AVR provide an auto delay function or the possibility to manually define an audio delay value?
I know, this isn’t probably the fix you was hoping for, but at the moment, this your only option.

As I wrote, I dont need an audio delay, the audio has to come earlier (kind of a video delay). I could not config that anywhere else than in the video player. I’m also not sure where the delay is been produced. For e.g. Netflix, which I watch with my Smart TV, I dont need an audio offset - that is why I could not config it anywhere else, because I dont want to change it all the time…

How could it be a Kodi issue when LE with the same Kodi version doesn’t have that issue?
I’m getting annoyed to write that again, but getting no answer. Should I post in the Kodi forum that it doesnt run with CE (but others). What do you expect will they tell me?

Regards

Arne

An audio delay can also be a negative value.
At least my AVR is providing both options (auto delay / manual audio delay) with positive and negative values.
I never had a problem with the auto setting, so I don’t need to adjust it for every possible input.

I didn’t see, that you are using the Leia version of LE.
You are right, that this can’t be a Kodi problem then.
I will talk about it in the team and I’m sure we can provide a fix for it soon.

1 Like

I think @afl1 said lateframes patch was causing the stutter with audio offset set, should be fixed in tomorrow’s nightly.

1 Like

The fix in the nightly from 2019-01-04 works - thank you very much :smile:

Regards

Arne

1 Like