Skip to content

AVSTP rarely hangs #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pinterf opened this issue Nov 23, 2022 · 2 comments
Open

AVSTP rarely hangs #1

pinterf opened this issue Nov 23, 2022 · 2 comments

Comments

@pinterf
Copy link
Owner

pinterf commented Nov 23, 2022

The issue was originally reported in pinterf/mvtools#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.

@pinterf
Copy link
Owner Author

pinterf commented Nov 23, 2022

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+ 3.7.2
  • ffmpeg (don't know, my one was prebuilt on 2021/11/07)
  • mvtools2 2.7.45
  • avstp 1.04 (preferably debug build)

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

@pinterf
Copy link
Owner Author

pinterf commented Nov 23, 2022

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:

kép

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant