Log in

View Full Version : Avisynth+ MT and broken Frame Order


Roemer
9th March 2021, 10:40
Hello

I am using Avisynth+ for some enhancements. In this particular case I am using TemporalDegrain2 for degraining. As this is fairly slow, I am using multithreading to speed things up.
In my first try, I just added SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE) which leads to a lot of frames being out of order (but only for larger sources, smaller ones seem to work fine).
Then I found the mtmodes.avsi which should set the correct modes per filter and import this.
Now it is much better bit I still found very few frames that were out of order. Is there a way to prevent them completely and still using MT?
My script is fairly simple, all it does is:


src2 = FFmpegSource2("00004.m2ts", atrack=1, fpsnum=24000, fpsden=1001).Crop(220, 0, -220, 0)
src2 = src2.ConvertAudioToFloat().TimeStretch(tempo=100.0*25.0/(24000.0/1001.0)).TemporalDegrain2(degrainTR=3, postFFT=1, postSigma=4, postDither=-1)
AudioDub(src2, src2)
AssumeFPS(25)
PreFetch(10)

I tried various PreFetch and this one seems to use the most CPU and is the fastest (although I only have 4 cores and 8 threads).

Any help would be really appreciated.

DJATOM
9th March 2021, 11:10
There are few options:
1) demux streams from m2ts and load them separately;
2) use LWLibavVideoSource+LWLibavAudioSource.

Roemer
9th March 2021, 13:43
Is LSMASHSource preferred over FFMS2?
I remuxed the m2ts into an mkv and that also seems to have solved the problem!

DJATOM
9th March 2021, 13:46
FFMS2 is just bad at handling m2ts.