Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

I got it at your Russian thread here:
http://www.svp-team.com/forum/viewtopic … 14&p=2
HOWEVER, I see now that when I used Google Chrome to "translate to English", it messed with the code!  (This is first time I've used Chrome's "translate to English".)  I see it changed the 2nd line from "msuper" to "msup", for example.  ("Bad translator"  Slap on wrist.  Translate should not tamper with program code.)

I will use what you left here.  Thank you!

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

Ok. I see.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

But VD still can't open it.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

Even these 2 lines by themselves fail:

AviSource("D:\Video-Work\2014-NCAA-wv\2014-11-14.wv.KY-v-MS.lag.ac3-320.avi").ConvertToYV12()
sc=MSuper(pel=1)

But (obviously) the 1st line by itself works fine.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
MSuper
It must work if you have mvtools2.dll in plugins folder.
Try to open script in AvsPmod. And I need exact AviSynth error message to help you.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

Wow, I didn't know that something like AvsPmod existed!  Cool!

When I tried the 2 liner, it fails with something like "not a clip".  Oh, so I need to paste the whole script.  When I did, it reported 'Script error: there is no function named "mt_lut" (New File, line 10)'

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
not a clip
Looks like your AVI is not a real AVI. Try DSS2 + avss.dll

mt_lut
It is function of MaskTools2 plugin. Copy masktools.dll to plugins folder.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

It's working now!

Best I could find of Masktools2 was here:
http://avisynth.nl/index.php/MaskTools2

I didn't make the "not a clip" item clear.  The 2-liner was this:

AviSource("D:\Video-Work\2014-NCAA-wv\2014-11-14.wv.KY-v-MS.lag.ac3-320.avi").ConvertToYV12()
sc=MSuper(pel=1)

Therefore the "not a clip" error made partial sense to me, so I had proceeded with the full script, and gotten the mt_lut error, driving us to get the needed Masktools2.

How do I prevent the "Fix-50" etc. subtitles from appearing in the frames?  Nice for debugging, but need to remove them.  (Forgive me for not being able to figure out.)

59 (edited by TCmullet 24-12-2014 03:31:31)

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

I overcame my fear of experimenting, and even without looking up how MFlowInter works, I suspected that Subtitle is subsidiary data item WITHIN the output of MFlowInter, which allowed me to deduce that simply removing the Subtitle "dot invocation" would remove the little yellow subtitle.

IDEA FOR VALUABLE AND GREATLY DESIRED IMPROVEMENT:

My videos that need this script have another problem you might never have seen.  Would you please consider whether this enhancement is both feasible and are you willing to consider implementing it?

We know (at least we have believed) that when a frame is dropped in a capture process, the last frame successfully captured gets duplicated one time in order to replace the one that was lost.

Let's say we have a 4-frame sequence:
F1 F2 F3 F4

If Frame F3 was lost, then frame F2 is duplicated making F3 = F2.  However, I have many cases where it's F2 (!!!) that is lost.  Somehow, whatever was capturing this failed to get F2 and got F3 and make a copy backwards!  A significant percentage of my lost frames fit this pattern.

When your existing logic processes this, it drops F3 and replaces it with an interpolated one, interpolating between F2 and F4.  What we need it to do (assuming it's even possible to detect my weird scenario) is to drop F2 and interpolate between F1 and F3.

Any chance you could figure out how to make it do this??  It would be wonderful and I'd be willing to hold off longer on processing tons of footage, simply so I could correctly handling these "backward dupped" frames.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
simply removing the Subtitle "dot invocation" would remove the little yellow subtitle
Yes. You did it right.

If your video has 'backward dupped' frames then you need to use GameDropFix_v4 script. It calculates motions in each frame and know about real frames position near every dropped frame.

61 (edited by TCmullet 24-12-2014 13:49:20)

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

In my GameDropFix_v4, I get "SVSmoothFps: unable to load library given in 'compose' [C:\Program Files (x86)\SVP\plugins\svpflow_gpu.dll] (line 147)".

SetMemoryMax(1024)
global svp_scheduler=true
global threads=5
global svp_cache_fwd=threads+10

#LoadPlugin("C:\Program Files (x86)\SVP\plugins\svpflow1.dll")
#LoadPlugin("C:\Program Files (x86)\SVP\plugins\svpflow2.dll")

SetMTMode(3,threads)
AviSource("D:\Video-Work\2014-NCAA-wv\2014-11-14.wv.KY-v-MS.lag.ac3-320.avi").ConvertToYV12()
SetMTMode(2)

src=last
super_params_mini="{scale:{up:0},gpu:1}"
analyse_params_mini="{block:{w:8,h:8}}"
miniW = int(width/64)*32
miniW = (miniW<320) ? 320 : miniW
miniH = int(height/64)*32
miniH = (miniH<160) ? 160 : miniH
mini=BicubicResize(miniW,miniH).TemporalSoften(1, 1, 0, scenechange=1, mode=2)
super_mini=mini.SVSuper(super_params_mini)
vectors_mini=SVAnalyse(super_mini, analyse_params_mini)
vectors_Forward=SVConvert(vectors_mini, false)
HorizontalSpeed_luma=mini.MMask(vectors_Forward, kind=3).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)
VerticalSpeed_luma=mini.MMask(vectors_Forward, kind=4).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)

size=16
luma_lft=HorizontalSpeed_luma.crop(0,0,miniW/16,0).BicubicResize(size,size)
luma_rgh=HorizontalSpeed_luma.crop(miniW/16+miniW/8,0,0,0).BicubicResize(size,size)
luma_top=VerticalSpeed_luma.crop(0,0,0,miniH/16).BicubicResize(size,size)
luma_btm=VerticalSpeed_luma.crop(0,miniH/16+miniH/8,0,0).BicubicResize(size,size)
luma_drop=luma_lft.mt_lut(y=-1, u=128, v=128)

move_idx=5
y_idx=3
min_move=0.2
max_stop=0.5
drop_clip=luma_drop.ScriptClip("
    AvgLuma_lft=128-luma_lft.AverageLuma
    AvgLuma_rgh=128-luma_rgh.AverageLuma
    AvgLuma_lft_prev=128-(luma_lft.trim(1,1)+luma_lft).AverageLuma
    AvgLuma_rgh_prev=128-(luma_rgh.trim(1,1)+luma_rgh).AverageLuma
    AvgLuma_lft_next=128-luma_lft.trim(1,0).AverageLuma
    AvgLuma_rgh_next=128-luma_rgh.trim(1,0).AverageLuma

    AvgLuma_top=128-luma_top.AverageLuma
    AvgLuma_btm=128-luma_btm.AverageLuma
    AvgLuma_top_prev=128-(luma_top.trim(1,1)+luma_top).AverageLuma
    AvgLuma_btm_prev=128-(luma_btm.trim(1,1)+luma_btm).AverageLuma
    AvgLuma_top_next=128-luma_top.trim(1,0).AverageLuma
    AvgLuma_btm_next=128-luma_btm.trim(1,0).AverageLuma

    Max_lft=max(abs(AvgLuma_lft_prev),abs(AvgLuma_lft),abs(AvgLuma_lft_next))
    Max_rgh=max(abs(AvgLuma_rgh_prev),abs(AvgLuma_rgh),abs(AvgLuma_rgh_next))
    Max_top=max(abs(AvgLuma_top_prev),abs(AvgLuma_top),abs(AvgLuma_top_next))
    Max_btm=max(abs(AvgLuma_btm_prev),abs(AvgLuma_btm),abs(AvgLuma_btm_next))
    Max_all=max(Max_lft,Max_rgh,Max_top,Max_btm)
    
    MaxLuma=max(abs(AvgLuma_lft),abs(AvgLuma_rgh),abs(AvgLuma_top),abs(AvgLuma_btm))
    MaxLuma_prev=max(abs(AvgLuma_lft_prev),abs(AvgLuma_rgh_prev),abs(AvgLuma_top_prev),abs(AvgLuma_btm_prev))
    MaxLuma_next=max(abs(AvgLuma_lft_next),abs(AvgLuma_rgh_next),abs(AvgLuma_top_next),abs(AvgLuma_btm_next))
    dif=mini.YDifferenceFromPrevious
    dif_next=mini.trim(1,0).YDifferenceFromPrevious
    dif_prev=(mini.trim(1,1)+mini).YDifferenceFromPrevious
    
    GoodContrast = (max(mini.YPlaneMinMaxDifference,mini.trim(1,0).YPlaneMinMaxDifference)>20) ? 1 : 0

    drop = (MaxLuma<0.1 && MaxLuma*2<Max(MaxLuma_prev,MaxLuma_next) && dif*y_idx<max(dif_prev,dif_next)) ? 1 : 0

    drop_lft = (AvgLuma_lft_prev*AvgLuma_lft_next>0 && abs(AvgLuma_lft*move_idx)<Max_lft && abs(AvgLuma_lft)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 2 : 0
    drop_rgh = (AvgLuma_rgh_prev*AvgLuma_rgh_next>0 && abs(AvgLuma_rgh*move_idx)<Max_rgh && abs(AvgLuma_rgh)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 3 : 0
    drop_top = (AvgLuma_top_prev*AvgLuma_top_next>0 && abs(AvgLuma_top*move_idx)<Max_top && abs(AvgLuma_top)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 4 : 0
    drop_btm = (AvgLuma_btm_prev*AvgLuma_btm_next>0 && abs(AvgLuma_btm*move_idx)<Max_btm && abs(AvgLuma_btm)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 5 : 0
   
    drop = (drop==0 && MaxLuma<Max_stop && Max_lft==Max_all) ? drop_lft : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_rgh==Max_all) ? drop_rgh : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_top==Max_all) ? drop_top : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_btm==Max_all) ? drop_btm : drop
    drop_dif = (dif<0.4 && MaxLuma<min_move) ? 6 : 0
    drop = (drop==0 && drop_dif>0) ? drop_dif : drop
    drop = (drop>0 && Max_all<0.2) ? 0 : drop
    drop = (drop>0 && GoodContrast==0) ? 0 : drop

    luma=mini.AverageLuma
    luma_next=mini.trim(1,0).AverageLuma
    max_luma=max(luma,luma_next)

    drop = (drop>0 && max_luma<16.5) ? 0 : drop

    (drop>0) ? luma_drop : \
     (Max_lft==Max_all) ? luma_lft : \
      (Max_rgh==Max_all) ? luma_rgh : \
       (Max_top==Max_all) ? luma_top : luma_btm
")

fix_r50=luma_lft.mt_lut(y=-1, u=128, v=128)
fix_lr33=luma_lft.mt_lut(y=-2, u=128, v=128)
fix_l50=luma_lft.mt_lut(y=-3, u=128, v=128)
fix_r133=luma_lft.mt_lut(y=-4, u=128, v=128)
fix_r66=luma_lft.mt_lut(y=-5, u=128, v=128)

AvgDrop=127
MaxMulty=10
dblMulti=1.3
fix_clip=luma_drop.ScriptClip("
    drop=drop_clip.AverageLuma
    AvgLuma=abs(128-drop_clip.AverageLuma)
    AvgLuma_prev=abs(128-(drop_clip.trim(1,1)+drop_clip).AverageLuma)
    AvgLuma_prev_= (AvgLuma_prev==AvgDrop) ? 0 : AvgLuma_prev
    AvgLuma_prev2=abs(128-(drop_clip.trim(1,2)+drop_clip).AverageLuma)
    AvgLuma_next=abs(128-drop_clip.trim(1,0).AverageLuma)
    AvgLuma_next_= (AvgLuma_next==AvgDrop) ? 0 : AvgLuma_next
    AvgLuma_next2=abs(128-drop_clip.trim(2,0).AverageLuma)

    RightZero = (AvgLuma_prev_*MaxMulty<AvgLuma_next_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0
    LeftZero = (AvgLuma_next_*MaxMulty<AvgLuma_prev_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0

    drop = (AvgLuma==AvgDrop && AvgLuma_next==AvgDrop) ? -50 : 0
    drop = (AvgLuma==AvgDrop && AvgLuma_prev==AvgDrop) ? 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && RightZero==0) ? \
     AvgLuma_prev_>AvgLuma_next_*dblMulti ? -50 : \
      AvgLuma_prev_*dblMulti>=AvgLuma_next_ ? AvgLuma_next2==AvgDrop ? 50 : 33 : 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && RightZero==0 && AvgLuma_next2==AvgDrop) ? -50 : drop
    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && AvgLuma_prev2==AvgDrop) ? 66 : drop

    (drop==50) ? fix_r50 : \
     (drop==33) ? fix_lr33 : \
      (drop==-50) ? fix_l50 : \
       (drop==133) ? fix_r133 : \
        (drop==66) ? fix_r66 : drop_clip
")

r50=1
lr33=2
l50=3
r133=4
r66=5

super_params="{scale:{up:0},gpu:1}"
analyse_params="{main:{search:{coarse:{distance:4,bad:{sad:2000}},type:2,distance:4},penalty:{lambda:1,pglobal:10000}},refine:[{thsad:65000}]}"
smoothfps_params="{rate:{num:12,den:1},algo:13,scene:{blend:true}}"

super=SVSuper(super_params)
vectors=SVAnalyse(super, analyse_params)
fix_all = SVSmoothFps(super, vectors, smoothfps_params, mt=threads, url="www.svp-team.com")
fix50 = fix_all.SelectEvery(12,6).Subtitle("fix50", align=3, size=12)
fix33 = fix_all.SelectEvery(12,4).Subtitle("fix33", align=3, size=12)
fix66 = fix_all.SelectEvery(12,8).Subtitle("-fix33", align=3, size=12)
fix66p = fix_all.SelectEvery(12,8).Subtitle("fix66", align=3, size=12)
fix75 = fix_all.SelectEvery(12,9).Subtitle("-fix25", align=3, size=12)
fix50n = fix_all.SelectEvery(12,6).Subtitle("-fix50", align=3, size=12)
fix133 = fix_all.SelectEvery(12,4).Subtitle("fix133", align=3, size=12)
fix125 = fix_all.SelectEvery(12,3).Subtitle("fix125", align=3, size=12)

ScriptClip("
    AvgFix=fix_clip.AverageLuma
    AvgFix_next=fix_clip.trim(1,0).AverageLuma
    AvgFix_next2=fix_clip.trim(2,0).AverageLuma
    AvgFix_next3=fix_clip.trim(3,0).AverageLuma
    AvgFix_prev=(fix_clip.trim(1,1)+fix_clip).AverageLuma

    (AvgFix==r50) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix33 : fix50 : \
    (AvgFix==lr33) ? fix33 : \
    (AvgFix_next==lr33) \
     ? (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix66.trim(1,1)+fix66 : \
    (AvgFix_next==l50) \
      ? (AvgFix_prev==lr33 || AvgFix_prev==r50) ? fix66.trim(1,1)+fix66 \
      : (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix50n.trim(1,1)+fix50n : \
    (AvgFix==r66) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix50 : fix66p : \
    (AvgFix_next==r66) \
      ? (AvgFix_next3==lr33 || AvgFix_next3==l50) ? fix125.trim(1,0) : fix133.trim(1,0) : \
    last
")

trim(0,framecount-10)

Distributor()

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
SVSmoothFps: unable to load library given in 'compose'
It is mean no OpenCL device found.

Did you have any graphic device with OpenCL support?
If not then use line:

super_params="{scale:{up:2},gpu:0}"

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

I'm not aware either of what OpenGL is or that I have such a device.  If it's graphics-related, I do not have a fancy video adapter; only what's on the mobo.

Should the corresponding line that loads super_params_mini (line 14) be changed similarly?

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

I proceeded assuming I should change super_params_mini, likewise.

I've had some instances of VD blowing up with this new script GameDropFix.

But more importantly, some test frames (w/forward drop) that worked fine with DoubleDropFix are now not being seen and processed by GameDropFix at all.  Most are, and all the backward-drop frames are being fixed nicely. (Great!)

Is there some tweak I need to make to let GDF detect the same drops as DDF?

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
I need example.
Can you give me short videoclip with that difficult frames for GameDropFix_v4 script?

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

This 21 frame file has dupped pairs at frames 5-6, 8-9, and 14-15.  GameDrop fixes the one at 14-15, but not the two prior ones 5-6 and 8-9.   (I didn't see the 8-9 pair earlier, nor the 14-15.)  Video codec is Lagarith.
http://www.tomsgoodfiles.com/2014-11-14 … rames1.avi

(It's too big to attach, so I uploaded to my own website's server.)

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
Thank you.
I tuned up the script on your video.

Your video has low level of noise and all dropped frames are not encoded: [D]-frames in VirtualDub. So, these drops are clear and full match with previous frame. In GameDropFix you need to reduce one constant from 0.2 to 0.1:

drop = (drop>0 && Max_all<0.1) ? 0 : drop

68 (edited by TCmullet 25-12-2014 14:18:41)

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

MAG79 wrote:

Your video has low level of noise

I'm not sure if you're saying it has low when there should be none, or it's lower than one would expect.  All I can report is that I did screen capture of streaming video.

...and [not] all dropped frames are not encoded: [D]-frames in VirtualDub.

Not sure why you're bringing this up (if I understand you right). That's the way Lagarith works; if 2 frames are identical, the 2nd one is encoded with merely a pointer.  Great for slide shows.

So, these drops are clear and full match with previous frame.

Yes, and I think they would still have been a full match, even if I had not enabled Lagarith's "null frames" feature

In GameDropFix you need to reduce one constant from 0.2 to 0.1:

drop = (drop>0 && Max_all<0.1) ? 0 : drop

I find this line at approx. line # 81

Is this a change that would be good for everyone to put in, or should we consider it to be used only for my group of videos?

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

I have some bad news.  With or without the change from 0.2 to 0.1, Lagarith crashes in VirtualDub.  Here's the info:

Problem signature:
  Problem Event Name:    APPCRASH
  Application Name:    VirtualDub.exe
  Application Version:    1.10.4.0
  Application Timestamp:    526d9abc
  Fault Module Name:    lagarith.dll
  Fault Module Version:    1.3.27.0
  Fault Module Timestamp:    4ee00598
  Exception Code:    c0000005
  Exception Offset:    00023e4d
  OS Version:    6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1:    0a9e
  Additional Information 2:    0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:    0a9e
  Additional Information 4:    0a9e372d3b4ad19135b953a78882e789

This is all "greek" to me.  But it would seem odd that Lagarith would be defective as it's been stable for a long time.  Any thoughts?  It didn't blow up right away, but only after awhile.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

Lagarith crashes maybe because of big number of threads. Try to reduce it. The script line:

global threads=5

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

MAG79 wrote:

Lagarith crashes maybe because of big number of threads. Try to reduce it. The script line:

global threads=5

I had to lower it to 2 to get it to run steadily.  I have multithreading enabled in Lagarith.  I've never seen anything to indicate how many threads Lagarith might use.  I presume it's using 2, then this script uses 2.  That might be fine as I have a 4 core i5 system.

However, after running 25 minutes out of a 1 hour 45 minute run, it bombed, but not as before.  This time it's a direct VirtualDub crash.  (The prior ones were from Windows 7.  "Program has stopped running" yada yada...)  VD's best guess is "An out of bounds memory access (access violation) occurred in module 'lagarith'... ...reading address 39543FD7.

So I guess I should treat this as needing further lowering of threads.  I'll lower it to 1, but I can't help wonder if I should disable Lagarith's multithreading instead.  Any thoughts?

I guess I'm behind the times with my biggest and best system being only a 4 core system w/no GPU power to assist.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
Problem not in threads count as is. Problem in memory consumption of each thread and with memory leaks.
Try to overwrite avisynth.dll in system32 from SVP bundle to SVP-edition version. It is optimized by speed and memory consumption for multithreaded use MVTools and SVPFlow plugins.

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

MAG79 wrote:

TCmullet
Problem not in threads count as is. Problem in memory consumption of each thread and with memory leaks.
Try to overwrite avisynth.dll in system32 from SVP bundle to SVP-edition version. It is optimized by speed and memory consumption for multithreaded use MVTools and SVPFlow plugins.

I'm not clear about what you are saying; whether you are urging me to do something or merely reporting the cause, or perhaps stating your plans.  (I hope you'll clarify.  Leaving off a suffix or a trailing 's' on a word confuses me.)

In the meantime, I DID make it through an entire file.  It ran 29-35 fps, slightly better than real time.  Thread experimentation.  Lagarith=1,global=2 worked.  Lagarith=2,global=1 not as fast.  Lagarith=1,global=3 worked but was actually slower than Lagarith=1,global=2.

I think it would be good for me to show the final script, with annotations for some of the options.  Before I do, can you please clarify some thing?  I ask them one at a time, to prevent any q.s getting lost in the shuffle.

In GameDropFix you need to reduce one constant from 0.2 to 0.1:

drop = (drop>0 && Max_all<0.1) ? 0 : drop

I found that line at approx. line # 81

Is this a change that would be good for everyone to put in, or should we consider it to be used only for my group of videos?

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

TCmullet
not clear about what you are saying
In the Internet you can find different versions of avisynth.dll. Original avisynth 2.5.8 is not optimal for SVP and for its plugins. So we optimized it and shared multithreaded (MT) SVP-edition: avisynth-2.5.8-svp.zip
You need to replace avisynth.dll with version from archive.

I don't know if 'global threads=1' syntax is real working with 1 thread or with 2 threads by default. It is needed to check.

Lagarith=1,global=3 worked but was actually slower than Lagarith=1,global=2
It can be so. I tested script with battlefield (720p mkv) in realtime mode without transcoding. At my system (core i5) the value threads=5 was optimal.
Your case is encode to x.264 (or anything else)? So encoder will use some number of threads and you can lower 'global threads' number to get maximum speed with memory leaks prevention (VD crashes).

Is this a change that would be good for everyone to put in, or should we consider it to be used only for my group of videos?
I think, no. It is individual.
Battlefield clip need 0.2
Your clip need 0.1

Re: Fixing dropped frames in action cam footage? (for stereoscopic 3D)

MAG79 wrote:

...So we optimized it and shared multithreaded (MT) SVP-edition: avisynth-2.5.8-svp.zip
You need to replace avisynth.dll with version from archive.

I had already done that.

Your case is encode to x.264 (or anything else)? So encoder will use some number of threads and you can lower 'global threads' number to get maximum speed with memory leaks prevention (VD crashes).

I capture to Lagarith, then via your sweet script to reclaim lost frames I reencode to Lagarith to then await further processing.  Where exactly are the leaks occurring?  Bug in Lagarith?  Avisynth?  One of the subroutine DLLs?  Will these leaks someday get fixed?

Is this a change that would be good for everyone to put in, or should we consider it to be used only for my group of videos?

I think, no. It is individual.
Battlefield clip need 0.2
Your clip need 0.1

Oh dear.  Then how can one decide whether to use 0.2 or 0.1?  What's the difference between your "battlefield" (whatever that is) and footage I captured off a streaming video?  Are there any particular criteria we must look for?  Is this something we're never going to be able to resolve into a formula for easy use?  (And all this is only my first questions.  I have a couple more, but simpler ones after we get to end of this one.)