De-interlacing works only intermittently since new GPU
#1
A while ago I upgraded the GPU in my Windows 10 HTPC. I used to run an nVidia GTX 1650 and I replaced that with an nVidia Geforce RTX 4060. (Why these? Because they're the only powerful GPUs that come in half-height cards for my case.)

My main use for Kodi is the PVR (tvheadend). The TV channels generally need de-interlacing. My problem happens when de-interlacing either HD or SD channels, but way more often with SD channels. My TV runs 4K, so Kodi upscales everything. The problem also happens with ripped DVDs, which are also interlaced. It does not happen with non-interlaced videos. It also happens seemingly at random, I cannot reproduce it at the same times in a video, it might be earlier or later.. If I turn off de-interlacing, there is no problem - but then the video obviously looks like crap.


The problem is this:
De-interlaced videos go from smooth to choppy, and vice versa.

I have a video here: https://imgur.com/a/Y0Y9R38
It's most obvious with a rolling text like in these SD news channels. I started recording when the video was choppy, then about halfway in the vid it gets smooth again. I hope you see what I mean.

I have a debug log (a few minutes after the recording above, so not the same):
https://pastebin.com/LfxEHbdv (first half)
https://pastebin.com/XVbskH5t (second half, because of size limit)

In the log, the problem visibly appears around 20:47.40.


When I still ran the GTX 1650 there was no problem, everything was smooth. I think the 4060 should be much more powerful, but maybe something changed in the way it needs to be accessed or something?

I have tried a few different drivers from the past few months, but there was no difference. The problem is the same with Kodi 20.2 and the current nightly (which I used in the recording and the log). Changing the upscaling method to Auto or others also does not make a difference. When I try MPC-HC with de-interlaced files there is also no problem, hence my thinking that it's maybe a bug in Kodi. Or maybe I just need to change some config.


Can anyone help me?
Do you need more information?

Thanks for looking Smile
Reply
#2
That's weird. Nothing stands out in the log (you really went all out here by including all components!).

Sound issues can have weird effects in playback, and here in the video capture, you can see a very low aq% (audio buffer). It could be a buffering / network speed issue rather than something due to the rtx4060.
Looks like buffer holds about 1 s of data, which is not high. But I'm not very knowledgeable on buffering issues and even less about pvr, maybe such low values are normal for that use case.

Same deint problem on dvd rips or files on a NAS: network issues are less likely, something else may appear.

It doesn't look like you played with the cache settings newly exposed in the settings. They may help but I don't know how to tune them. The settings used to be in advancedsettings.xml, there may be some documentation in the wiki for their old location.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
Thanks for looking into it!

I should apologise, I made an error when I mentioned the time in the log. I've now corrected it in the first post.

The problem is visible in the log from 20.47.40 (instead of .20).

Does this help?


I don't think it has to do with network problems, because I have not changed anything in the network and PVR has worked well for years now (until the GPU change). I think a second of buffering seems right for live TV? The audio when watching TV is alright - no choppy playback or stuttering there. It's purely video.

Thanks for pointing me to the cache thing. I'll check it out!
Reply
#4
There is that sequence a couple times at the timestamp you mentioned;

Code:
2023-12-06 20:47:39.712 T:8132 debug <general>: CPtsTracker: pattern lost on diff 120000.000000, number of losses 1
shortly followed by a few
Code:
2023-12-06 20:47:39.753 T:8132 debug <general>: CVideoPlayerVideo::CalcDropRequirement - dropped in decoder, lateframes: 1, Bufferlevel: 5, dropped: 2

I don't really know that part of Kodi, but the logged NextFramePts initially regularly increase by 40000. Close to the problem the differences in NextFramePts start varying between 40000 and 80000.
After the glitch the pattern of +40000 is reestablished and detected by Kodi a few secs later, that's most likely when playback is smooth again.

Code:
2023-12-06 20:48:04.196 T:8132 debug <general>: CPtsTracker: detected pattern of length 1: 40000.00, frameduration: 40000.000000

So it looks like something is wrong in he stream, that other players cover up but Kodi doesn't.


I doubt this is Windows related.
Would a moderator please move to PVR addons, people there may have seen that type of thing before.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#5
Thanks for looking into it again. But I doubt that it's PVR related, because like I mentioned, it also happens with DVD ISOs. I think it really is related just to interlaced video material.

My thinking was that it's somehow related to the (Windows) video processing in combination with a new generation nVidia card. But that not many people still use PVR with a card like that, so that it just doesn't come up much? Everything in my PC seems to work well after replacing my old GPU, except interlaced video in Kodi, so that's why I'm thinking it's not the hardware or the drivers or anything like that. I just don't know what else I can test or change to fix it.
Reply
#6
Then please provide an example with DVD.
NVIDIA does "interesting" non-standard things in their dxva deinterlacer implementation, I fixed a few things to make it use the high quality algorithm earlier in the v21 cycle, you could compare with 20.2 in case it's a regression.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#7
It's seemingly exactly the same with 20.2.

Here is a log file with an interlaced DVD image: https://paste.kodi.tv/otoyohiqak.kodi
It was (visually) obvious at, for example, 20:25.32

Here is another log file: https://paste.kodi.tv/muhivovefe.kodi
See e.g. at 19:36.21.

I see the 'diff' in the log lines sometimes starts rising from on frame to the next, until after a while frames are dropped. But sometimes the diff stays the same for a minute at a time or so. I suspect that's when video playback is fine. (However, I don't know what that means.)
Reply
#8
Again no expert on pts, but the increases are irregular around the time marks you pointed to, and every time there is that "CPtsTracker: pattern lost on diff" so the glitches don't seem random.
How that could derail the NVIDIA dxva processor, I don't know with the available information. Maybe I could find out more with a short sample (30 sec is enough, centered on one of the glitches you pointed at). At least we could tell if this affects more hardware than the RTX 4xxx.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#9
I apologise for the late reply. Had my priorities somewhere else for a while.
Thanks for having looked into this. I wanted to add my findings here, because maybe someone else might have the same problem.

Anyway, this morning I tested a bit with different versions and settings. I found two solutions that work for me, but they are workarounds.


Conclusions:
In Kodi 19: the problem always occurs. (I tested it to rule out it was some regression in a later version.)

In Kodi 20.5: setting the scaler to Lanczos3 (and not Auto or DXVA), the problem no longer occurs. I think I had tried this before and that failed, but now it seems to work. Maybe something has changed in Kodi since earlier v20s or in the nVidia drivers (I've updated them a few times). Setting scaling to DXVA always causes the problem.

In Kodi 21 beta 3: setting the scaler to Lanczos3 still works well, but DXVA now also works -- but only when in Kodi the new option 'Super Resolution' is enabled. Otherwise, the same problem as in Kodi 20.

So it seems that the 'traditional' DXVA is buggy with my RTX4060, but that it can be circumvented by using Super Resolution in Kodi 21.
If this problem only occurs with RTX40x0 GPUs, then that's not really a problem, since they all have the Super Resolution function and they're all beefy enough to actually use it.



I should add that my Kodi 21 installation runs in a brand new Windows 11 install, whereas Kodi 20 ran in my existing Windows 10 installation. I used a dual boot setup to rule out something wrong in my old Windows 10. But alas, that was not it.

My other (desktop) computer has an RTX4070 Super and a monitor that can also change refresh rates. Interestingly, it does not exhibit the same problem as my 4060, but it also doesn't run via HDMI to a TV, but just a desktop monitor with DP.



I'll upload a recording later this week. But I think the stuttering does not always take place at the same moment in videos; it seems kind of random.
Reply
#10
That's "interesting" behavior.
Maybe it's due to the 8bit or 10bit rendering. VSR forces 8 bit mode.
It's possible to force 8 bit without VSR too, with "Use 10 bit SDR" never (v20 and 21) and "Use high precision processing" false (v21 only).
There is no impact for HDR, still 10 bit.

If no change it would mean that for some reason the dxva processor is not able to scale and deinterlace at the same time, except for VSR scaling.

Regardless of the outcome, there is something strange in the driver of the 4060.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply

Logout Mark Read Team Forum Stats Members Help
De-interlacing works only intermittently since new GPU0