Open pinterf opened 1 year ago
I narrowed the issue down to AVSTP which is used by mvtools2: when avstp.dll is found among the autoloaded libraries, then mvtools2 is using it for its internal in-frame multithreading support.
Since mvtools2 filters (MSuper, MAnalyze, MCompensate, ...) are automatically using the internally multithreaded option (mt=true default parameter), users report random crash or freeze when using scripts containing mvtools2 (e.g. QTGMC).
The reproduction is so difficult that I had to either make a modified source mvtools2 version an avstp with artificial internal delaying code inside or - as it turned out - the easiest way to use the debug build of avstp which will drop "assert" messages very soon on a check which would be normally not allowed to happen.
Components (64 bit versions tried)
Avisynth script (avs2.avs):
AVISource("demo.avi")
AssumeTFF()
o=last
osup = o.MSuper(pel=2,sharp=2,mt=true)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4,mt=true)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4,mt=true)
bc1 = o.MCompensate(osup,bv1,mt=true)
fc1 = o.MCompensate(osup,fv1,mt=true)
Interleave(fc1,o,bc1)
Batch file:
del success.txt
:retry
"ffmpeg.exe" -i ".\avs2.avs" -f null -
echo success>>success.txt
goto retry
pause
Note that I was unable to make the 1.04 release version hang on a Intel i7-11700.
But on an i7-7700 processor the freeze is somewhat more reproducible.
Previous night the script was running (with the original avstp release version 1.04) w/o issues for at least sixteen hours.
But today the script hung "sooner" (the freeze is seen as ffmpeg output refresh is stopped): in the 12th loop at frame 40740, after 11 successful rounds - each 92466 frames.
Input #0, avisynth, from '.\avs2.avs':
Duration: 00:20:32.88, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: rawvideo (Y3[10][10] / 0xA0A3359), yuv422p10le, 720x576, 75 fps, 75 tbr, 75 tbn
Stream #0:1: Audio: pcm_s24le, 48000 Hz, 4.0, s32 (24 bit), 4608 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Stream #0:1 -> #0:1 (pcm_s24le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf59.5.101
Stream #0:0: Video: wrapped_avframe, yuv422p10le(progressive), 720x576, q=2-31, 200 kb/s, 75 fps, 75 tbn
Metadata:
encoder : Lavc59.10.100 wrapped_avframe
Stream #0:1: Audio: pcm_s16le, 48000 Hz, 4.0, s16, 3072 kb/s
Metadata:
encoder : Lavc59.10.100 pcm_s16le
frame=40740 fps=129 q=-0.0 size=N/A time=00:09:03.20 bitrate=N/A speed=1.72x
Using the debug build the resulting asserts come almost immediately:
The issue was originally reported in https://github.com/pinterf/mvtools/issues/46: a very-very complex AviSynth script encoded with ffmpeg resulted in random freezes. The actual freeze is rare. It may occurs under very sensitive and hard-or-unable-to-reproduce timing conditions. E.g. lock-up happens after eight hours and many hundred thousand frames.