CrendKing / avisynth_filter

DirectShow filters that put AviSynth and VapourSynth into video playing
MIT License
107 stars 8 forks source link

QTGMC + ApparentFPS problem (was: TDecimate issue) #31

Closed Disaer closed 3 years ago

Disaer commented 3 years ago

Environment

Describe the bug

QTGMC and ApparentFPS work great individually in realtime, but not in one script. Script 1 plays choppy (but seeking works). Script 2 plays smoothly, but the video player with AVSF 0.8.2 hangs on seek. Script 2 with AVSF test build plays smoothly and seeking work mostly, but sometimes hangs (1 of 5-10 times).

To Reproduce

  1. Load quoted script to AVSF
  2. Try to play video and check lags and ability to seek.

Checklist

Disaer commented 3 years ago

Note: this issue is already discussed on the doom9 forum, it submitted for tracking purpose.

CrendKing commented 3 years ago

Well, you already confirmed the test build works with TDecimate(). Mind change the issue to the problem about QTGMC() and ApparentFPS(), after verifying the test build does NOT work on that problem? Sometimes multiple problems have the same root cause.

CrendKing commented 3 years ago

BTW, I tested a bit myself. If I just use ApparentFPS(), everything seems to work perfectly. However, if I use QTGMC(), regardless of which preset I use, the video is choppy and CPU usage spikes through the roof. I have Ryzen 3700X, which is usually good enough for most tasks. So I wonder if QTGMC is simply too heavy for real-time video playing. I also tested QTGMC on ffdshow, and it seems even more laggy.

If you have evidence that there is bug in the filter that causes the lag, please update or create new issue. Otherwise, feel free to close this one.

Disaer commented 3 years ago

Oh, I misunderstood which issue you ask to submit. I'll rename and update it.

Disaer commented 3 years ago

I have Ryzen 3800X (not much difference from 3700X) and I'm using QTGMC only for SD videos (640x480, 720x576). On my system, it runs smoothly with default settings. I'll do more thorough testing tomorrow.

CrendKing commented 3 years ago

I downloaded a 640x360 video and I can reproduce the problem you described. Here is what I noticed:

  1. I compared the times between just QTGMC and QTGMC+ApparentFPS. The latter is just slow, but the frame timings are the same. Basically I think avsf is working properly on this specific script, it is just QTGMC is way too much for video playing, even on SD videos. What can QTGMC does that SVP or simple mvTools+madVR can't?

  2. The second script hangs because of a deadlock around prefetcher. If they address https://github.com/AviSynth/AviSynthPlus/issues/180, it may indirectly also fixes this. At the moment there's nothing I could do.

I'm closing the issue. If you have other concern, please follow up.

Disaer commented 3 years ago

I compared the times between just QTGMC and QTGMC+ApparentFPS. The latter is just slow, but the frame timings are the same. Basically I think avsf is working properly on this specific script, it is just QTGMC is way too much for video playing, even on SD videos. What can QTGMC does that SVP or simple mvTools+madVR can't?

I came across two types of problematic videos for which SVP + madVR is not enough:

  1. Videos with duplicated frames. I use ApparentFPS to check these videos, and TDecimate to fix them. TDecimate can be integrated into an SVP generated script.
  2. Interlaced SD (DVD) video, encoded as progressive and improperly deinterlaced video. Such videos are best handled by QTGMC, however, due to its computational complexity, it cannot be used along with SVP. Before AVSF, I had problems running QTGMC in real-time, but now even such heavy scripts can be played without lags. With this script, the CPU load of my Ryzen 3800X is about 30-50%, and madVR CPU queue (16) is always full:
    AvsFilterSource()
    QTGMC( Preset="Very Slow", NNSize=6, NNeurons=4, SourceMatch=3, Lossless=2 ) 
    prefetch(16)
CrendKing commented 3 years ago

I'm sorry that QTGMC+ApparentFPS combo does not work. I'm not familiar with ApparentFPS, but is it just informational tool? If so, maybe you can have two scripts, one only contains ApparentFPS to check if the video is problematic, and the second script only contains QTGMC to fix the video. Since you mentioned isolated both work for you, that's the best suggestion I can give. Further improvement needs that fix from AVS+.

Disaer commented 3 years ago

No problem, I will run it separately. Thanks for the info about the AVS+ bug.

Disaer commented 2 years ago

TDecimate doesn't work again. Both with or without prefetch, equally in MPC-HC and MPC-BE. Just black screen on video start. I don't know when it broke, but 0.9.4 doesn't have this problem.

AvsFilterSource()
TDecimate(display=true)
prefetch()

avsf MPC-HC.log avsf MPC-BE.log

CrendKing commented 2 years ago

I don't have any problem with it as long as I use the "hint" parameter (which value doesn't matter). It is required because otherwise the filter will request frame 0 before the DirectShow graph is ready.