Dogway / Avisynth-Scripts

AviSynth+ 3.7.3+ Filters
GNU General Public License v3.0
92 stars 13 forks source link

QTGMC+: Slow starup and encoding speed #67

Closed marukuru closed 2 years ago

marukuru commented 2 years ago

Describe the bug Sometime the encoding (x264) takes several hours to start (x264 header is shown, but encoding doesn't start), and then runs really slow, like 0,01fps slow with x264 --preset slow

To Reproduce

SetMemoryMax(16000)
SetCacheMode(CACHE_OPTIMAL_SIZE)
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LWLibavVideoSource("file.mkv", threads=16, prefer_hw=3, format="YUV422P10")
AssumeFPS("ntsc_video")
AssumeBFF()
QTGMCp(Preset="Slow", EdiMode="NNEDI3", Threads=20, Denoiser="fft3df", EZDenoise=1.0, NoisePreset="Slow", device_type="gpu", device_id=0)
Prefetch(20,20)
  1. Encoding is slow
  2. Kill process
  3. Restart encoding, encoding runs at normal speed

Expected behavior Encoding should run at normal speed

System:

Dogway commented 2 years ago

Seems to be a problem with this line: SetCacheMode(CACHE_OPTIMAL_SIZE) Without it it runs at about 5.3fps on my CPU (i7-4790K) in AVSMeter. Should run faster on your CPU.

In any case it's a bad idea to deinterlace and encode at the same step, you will get better absolute times encoding to lossless (or transparent) then to H264.

Another idea is to use DGSource, not sure if possible in Ubuntu. And probably to output to YUV420 from loader, 422 is a bit more taxing for QTGMC.

marukuru commented 2 years ago

Hi @Dogway, thanks for your comment. I'll remove SetCacheMode and give it some testing. I'll read before adding it, that it might slow down startup, but what put me off was, that this behavior wasn't deterministic. Out of three encoding attempts one would startup and encode at normal speed (some minutes startup time vs. several hours).

Dogway commented 2 years ago

Well deterministic or not it still seems it's a problem with SetCacheMode(CACHE_OPTIMAL_SIZE). It might be the case of a problem with non linear access to frames, like scripts that deal with temporal filters.

Maybe you can try with RequestLinear(32) before QTGMCp(). Also try to align memory assignment like SetMemoryMax(2048*8)

Dogway commented 2 years ago

Could you test the above?

marukuru commented 2 years ago

@Dogway Thanks, will give it a try this week. As for now I can confirm, that removing SetCacheMode(CACHE_OPTIMAL_SIZE) fixes both, the slow startup and encoding speed.

Dogway commented 2 years ago

Ok, closing for now. Reopen if needed.