Kodi Community Forum

Full Version: VDPAU deinterlacing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a couple questions related to deinterlacing in Kodi 18 alpha 3, one of which is specific to VDPAU.  I am using an arch based 64-bit linux on kernel 4.9.  My GPU is a Geforce GT 710 running driver 390.67.  Primarily this system has been used for mythtv.  To the questions, which I am specifically thinking about MPEG-2 video playback as I write this, but if it differs with MPEG-4, then that would be interesting to know as well:
  1. When deinterlacing video, does kodi differentiate between progressive and interlaced?  I am used to mythtv's frontend which auto-detects whether it is progressive or interlaced and does not deinterlace progressive video.
  2. If I am playing back video with VDPAU, are all of the deinterlacing options hardware?  I ask because with mythtv, I would get smooth playback with full temporal/spatial deinterlacing, however, if I select even just temporal in kodi, the playback will have moments every 30-60 seconds where playback is not smooth.  I am not sure what the technical term is.  Audio continues and it is essentially like video frames are dropped or the framerate is slowing down and then catching back up.  If I use temporal/spatial, it is essentially unwatchable due to this happening in real-time.  "VDPAU Bob" is the best result I can achieve.

Is item 2 related to the power of the gpu or could it be an issue resulting from my build of alpha 3?  I'm surprised at the difference in playback quality between mythtv and kodi with the better deinterlacers.
1.) yes
2.) Kodi uses more numbers of forward and backward reference frames for vdpau as mythtv, kodi does 3 past 2 forward [1]. Though that should not matter at all for your GT710. Start with your Debug Log.

[1]https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp#L2650
Thanks for the response.  I thought this was a totally repeatable occurrence, however, now that I am trying to log it, I can't get it to happen.  I am playing back with temporal/spatial deinterlacing without issues.  It must be related to some sequence of events and once I determine that, I will produce a log.

I am typically playing back video on the PVR mythtv addon and I also have mythtv frontend on this machine.  I am wondering if someone normally watches TV playback with a VDPAU profile in mythfrontend before launching kodi, which I did not do today.  Is it possible that something related to the nvidia driver is not being cleared out by mythtv or re-initialized by kodi?  It might be a bit of a stretch, but there are times when mythfrontend will lockup due to something within the nvidia driver and I basically have to reboot in order to get video to playback in either kodi or mythfrontend after that.  That is actually the key reason I am trying to get the best possible playback out of kodi.  Kodi has never experienced this driver issue.  When it happens in mythfrontend the error is related to the decoder timing out waiting for free buffers.
@fritsch I have found a way to replicate an issue, and I wonder if it may be related to the issue I was seeing.  If I pause, skip, then resume playback I get a lot of dropped packets trying to get the audio and video back in sync.  I wonder if something similar was happening when selecting different deinterlacers on the fly.  I can do temporal/spatial, but playback is still not always smooth.  It is most noticeable when there is text scrolling across a screen, such as when watching news.  I primarily watch MPEG2 with pvr.mythtv and most everything else in kodi is MPEG4/h.264 which always plays back smoothly.

Here is a debug log:
https://pastebin.com/LLShXVws

You will know better than I, but line 1906 is when I unpaused playback.  After this is where I see buffering/sync issues.
Can you please reproduce with recordings that you play via "File" menu? Make sure myth is recording raw ts. Faulty PTS have to be ruled out first.
@fritsch, I am recording OTA with an HDHomerun Connect.  This may sound dense, but how do I know if it is recording raw TS and what is PTS?.  I will see if I can replicate playing back a recording from the file menu.
The log was too big to post into pastebin, so I split it into 2:
1 of 2: https://pastebin.com/TAeC22tV
2 of 2: https://pastebin.com/n6FkUQ25

I think the pertinent information is on the 2nd log.  It looks like line 984 is the issue when it starts trying to resync with mythtv playback.  Around 2557 appears to be where it went crazy with the file playback.
@fritsch, my initial post was due to me not being able to get smooth mpeg2 playback.  I initially thought it was a deinterlacing issue, however, upon further investigation, I think it may have been a display frequency issue.  I am in the US and 1080i is typically referred to as 60 Hz and 720p as 30 Hz.  My display output was set to 60 Hz.  I was looking at the playback info of a video and it was 59.94 fps.  If I use 59.94 Hz and temporal deinterlacing, the playback is quite smooth.  720p is actually 29.97 fps so naturally the 59.94 Hz is twice that speed.  I'm surprised that this has caused an issue with MPEG-2 videos but not h.264 but I thought I would share my experience to see if you would expect that and to potentially help others who may have similar difficulties.  I haven't tried the pause/skip issue to see if it might be unrelated.
Thank you so much for this thread.  I've been struggling with the exact same issue with my HDHomerun Connect and jittery playback with MPEG2.  I am running an Intel NUC 8i7BEH with an Iris 650 GPU.  I had to totally disable interlacing in the Kodi player to get smooth playback.  With HW decoding and deinterlacing enabled I am seeing intermittent skipping on the HDHomerun content (either live streaming or recorded).  With SW decoding and deinterlacing enabled I don't get the skipping but the playback is jittery when there is quick motion like panning.  With deinterlacing disabled and HW or SW decoding enabled playback is much smoother.  Changing the refresh rating makes little difference in playback quality.
@jbinkley60 I'm sorry, but I do not have much more to contribute on the issue I reported.  At first I thought it was a de-interlacing issue, but it turned out to be something with MPEG2 videos (even progressive) that didn't match the screen refresh rate.  I don't remember the logs shedding any light on it, and I've not heard any similar issues from anybody, so perhaps it is specific to my setup.  Just to confirm, what is the refresh rate of your screen and what is the refresh rate of the videos?  What do you have whitelisted in kodi and can you confirm if it is updating correctly?

You might consider creating a new thread with a debug log in your case and hopefully someone will get back to you.  If you think it is limited to mpeg2 videos, you could try to transcode one to MPEG4 and see if playback improves.  SiliconDust has an HDHomerun tuner called the Extend which will transcode to MPEG4 on the fly instead of recording MPEG2.
I've got an Extend on order.  The issue is definitely limited to certain MPEG2 streams and 4K upscaling.  The 720P @60fps streams play fine when upscaling.  It is the 1080i streams @30fps which have the issue.  I just upgraded to the latest LibreElec code which has the Kodi 18 RC2 build.  I need to do some more testing but disabling deintercaling in Kodi has improved things quite a bit.  Once I have more data I'll start a new thread and post some logs.
I forgot to add, my refresh rate is 30fps due to me being limited to HDMI 1.4.  I did change my connections to a temporary HDMI 2.0 configuration and ran 4K upscaling @60fps and didn't see the issue.   On my other Kodi instances running Raspberry Pis with an output of 1080P @60fps I don't see the issue either.
To follow-up on this I've narrowed down the issue to be the micro-stuttering (as others are calling it) due to interlaced source content on the Intel NUC platform.  It is likely more broadly with the generic software and what it runs on.  The RC2 update fixed the larger skipping and other issues with interlaced content but the micro-stuttering remains and is especially prevalent with fast motion or sideways panning.  To test this I used both source content that was MPEG2 and H.264 interlaced and then using both formats in progressive mode.  This was accomplished using both software to convert from interlaced to progressive and an HDHomeRun Extend unit.  All progressive formats including a mix of 720P and 1080P and using both 30 and 60 fps play with no stuttering.  All interlaced files have some form of micro-stuttering.  I've tried with and without hardware offload as well as turning on/off Kodi deinterlacing with all of the delinertalcing options.  Certain configurations provide smoother playback than others but all have some level of micro-stuttering.  I don't see it on my Raspberry PIs running Kodi.  I did the same level of testing with the same source content.  I am seeing some other threads on the micro-stuttering issue on some other platforms.
I've come up with a way to move my video connection to HDMI 2.0 which allows me to do 4K @ 60fps vs. 4k @ 30 fps to my TV.  This seems to have eliminated the micro-stuttering for interlaced sources.  I'll need to watch it a few days but so far it seems to be the solution.