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

Chainik wrote:

Obviously because there's no current clip inside the function. You should either add the context "c" explicitely or add "last=c" as the first line.

But why has the current clip become no longer current?  I specifically wanted it to be current AS I fell into the function call.  Is there documentation somewhere that says calling a function always causes there to be no current clip??

Well, assuming there is some answer to that question, then the next question becomes, how to solve the "invalid arguments to BicubicResize" error.  (Do you think "last=c" will do it?)  Please remember that I did not write this code; I'm merely trying to put it into a function for reusability.  I was going to share it with the community once I got it working.  If you can help me get this going, I feel it will help many, as this dropped/duplicated frame problem happens often.  (More often than I'd like to think.)

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

I've put "last=c" as the first line of the function.  Yes, it solves the 2 width and height errors.

Now the video does open, but I get two lines of grey text superimposed over the picture saying:

I don't know what "fix_clip" means
([ScriptClip], line 2)

128

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

One moment: c=last not last=c smile

TCmullet
Have you any experience with avisynth scripting?

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

MAG79 wrote:

One moment: c=last not last=c smile

TCmullet
Have you any experience with avisynth scripting?

Changing it to "c=last" re-causes the "I don't know what 'width' means" message again (as I kind of would expect).  "c" does have the clip in it, as it's passed in by the function call.  (But if the current clip is gone, then it would make sense that c=last wipes out c with the contents of last which contains nothing.)  The question is why isn't the clip still current, seeing as I left it current when I hit the function call?

Experience with avisynth scripting?  That's a little puzzling.  Obviously, I assembled the scripts I pasted here, but GameDropFix logic was written by you guys.  (But notice I made tweaks within it to parameterize it.)

I've been writing scripts on and off for several years now.  Several years ago, I figured out (from docs and experimentation) how to IVTC movies I captured off cable back to 24fps.  I didn't like departing from pure Virtualdub at the time.  And in the last year am using Avisynth to do all processing, with the tail end output being to Virtualdub to make a final encode.  I am greatly appreciating Avisynth's amazing abilities.  And then add Interframe, plus DGBob, and I can now make 60fps output from any source.  (60fps is needed for a current major project I hope to make work.)  I also love the fact that it's self-documenting.

What I do NOT know is the nuances or even meaning of many of the Avisynth statements and functions.  I try to learn each one as needed.  So there is MUCH I do not know yet.  (Including nearly everything about MT mode and "setMTmode" which I find it very hard to get documentation on.)

I didn't think it would be hard to put any logic inside a function.  (I've been doing it for years in other languages.)  I guess I was wrong.  So did I answer your question?

I do have a programming background, even though I'm in poverty right now.  I learned Fortran, Cobol, Assembler etc. in college in the 70s and C#, html, javascript and php in recent years, neophytes in all recent languages.  (I learn a new feature as needed.  I just recently learned Ajax a bit, as I needed it for something.)

130

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

TCmullet
I've enjoyed GameDropFixV4 several times. Thank you whoever developed it
Nice to hear! smile

If it is still actual. Today I look and modified your avsi-file to make it work.
You need to insert line with one character "c" in the top of function:

function GameDropFixV4(clip c, bool "myGPU", bool "myDebug", int "myErrSize")
{
c
#myGPU=true
#myDebug=true
#myErrSize=150
...

But for some reason the code of GameDropFixV4 work improperly if it situated inside function. In the middle of calculations local variables stop to show real information and contain fake black frames. And I can't fix it because it is mistake or lack of buffer in the avisynth.

So the only way is to use huge script in one file without "function" statement.

---
MT=MultiThreading
Used for speedup purposes for multi-core CPUs.
Official avisynth description of MT

---

And I was wrong about c=last. Sorry roll
"c" in avisynth is equivavlent to "last=c" as suggested by Chainik

131

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

Yes. I did it! cool
It was not avisynth error it was needed in "global" statements. Working version of GameDropFixFuncs.avsi:

# GameDropFixFuncs.avsi

function GameDropFixV4(clip c, bool "myGPU", bool "myDebug", int "myErrSize")
{
myGPU = default( myGPU, true )
myDebug = default( myDebug, false )
myErrSize = default( myErrSize, 12 )

last=c

super_params_mini = (myGPU==true) ? "{gpu:1}" : "{gpu:0}"

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
global 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
global luma_lft=HorizontalSpeed_luma.crop(0,0,miniW/16,0).BicubicResize(size,size)
global luma_rgh=HorizontalSpeed_luma.crop(miniW/16+miniW/8,0,0,0).BicubicResize(size,size)
global luma_top=VerticalSpeed_luma.crop(0,0,0,miniH/16).BicubicResize(size,size)
global luma_btm=VerticalSpeed_luma.crop(0,miniH/16+miniH/8,0,0).BicubicResize(size,size)
global luma_drop=luma_lft.mt_lut(y=-1, u=128, v=128)

global move_idx=5
global y_idx=3
global min_move=0.1
global max_stop=0.5
global 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.1) ? 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
")

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

global AvgDrop=127
global MaxMulty=10
global dblMulti=1.3
global 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
")

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

super_params = (myGPU==true) ? "{gpu:1}" : "{gpu:0}"

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")

dummy = myDebug ? Eval("""
# These are for visual debugging (the "Subtitle" clauses)
global fix50 = fix_all.SelectEvery(12,6).Subtitle("fix50", align=3, size=myErrSize)
global fix33 = fix_all.SelectEvery(12,4).Subtitle("fix33", align=3, size=myErrSize)
global fix66 = fix_all.SelectEvery(12,8).Subtitle("-fix33", align=3, size=myErrSize)
global fix66p = fix_all.SelectEvery(12,8).Subtitle("fix66", align=3, size=myErrSize)
global fix75 = fix_all.SelectEvery(12,9).Subtitle("-fix25", align=3, size=myErrSize)
global fix50n = fix_all.SelectEvery(12,6).Subtitle("-fix50", align=3, size=myErrSize)
global fix133 = fix_all.SelectEvery(12,4).Subtitle("fix133", align=3, size=myErrSize)
global fix125 = fix_all.SelectEvery(12,3).Subtitle("fix125", align=3, size=myErrSize)
""") : Eval("""
global fix50 = fix_all.SelectEvery(12,6)
global fix33 = fix_all.SelectEvery(12,4)
global fix66 = fix_all.SelectEvery(12,8)
global fix66p = fix_all.SelectEvery(12,8)
global fix75 = fix_all.SelectEvery(12,9)
global fix50n = fix_all.SelectEvery(12,6)
global fix133 = fix_all.SelectEvery(12,4)
global fix125 = fix_all.SelectEvery(12,3)
""")

#SetMTMode(5)
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-threads)
}
# end of GameDropFixFuncs.avsi

It is single-threaded implementation. To make it multy-threaded you need to uncomment two lines: SetMTMode and trim.

You can use it from your script simply by write a line:

GameDropFixV4()

(gpu-acceleration in on, debug strings are off by default)
or full call of function:

GameDropFixV4(myGPU=true,myDebug=true,myErrSize=150)

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

MAG79 wrote:

Yes. I did it! cool
Working version of GameDropFixFuncs.avsi:

It is single-threaded implementation. To make it multy-threaded you need to uncomment two lines: SetMTMode and trim.

You can use it from your script simply by write a line:

GameDropFixV4()

(gpu-acceleration in on, debug strings are off by default)
or full call of function:

GameDropFixV4(myGPU=true,myDebug=true,myErrSize=150)

Yes, COOL!  While I had already finished a bunch of runs where I inserted the entire code in-line, I just found several that I need to use this one.  Nice to have a one-line function call!

I've done it already on one, in non-multi-thread.  Will now change to multi-thread for another one.  I may have questions.

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

Mag79, I've used this in multithreaded form several times already.  Thank you!

But both before you made it into a function when I was putting the code inline AND since then, there must be some kind of memory leak.  I have video programs that are 1.5 to 2.5 hours long.  Somewhere between 25 and 40 minutes in, Virtualdub blows up.  To get around this, I've had to create a Vdub AVI output for each segment that's about 20 minutes long.  20 seems to be below the threshold for blowing up, and 20 (or thereabouts) fits to a natural break in the program content.

I will be continuing to use GameDropFix frequently and ongoing.  Do you have any idea of where to look for a suspect memory leak?  When my scripts do not need GameDropFix, I do not have this problem.  Even when I use InterFrame, I do not have this problem.  (I mention that as I know both use some of the same internal SmoothVideo logic.)

Do you need me to post info from Vdub's crash?  Each time I looked it wasn't very meaningful, that is, it simply said that Vdub crashed due to something or other.  I will create another crash if you ask me too, if you think it would help.  (I write this, half suspecting that you and rest may already know about particular modules having memory leaks, so maybe you know this already and are working on it.  But I'll create a crash if you want.)

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

I was hesitant to go to the trouble of setting up and doing a several hour run merely to get it to bomb again, as I'm very behind and I wasn't sure if you would be willing to look at the bomb info.  But my next run required GameDropFix, so I elected to let it fully fly without breaking up into chunks. I actually thought it might finally finish after almost 5 hours.  Was surprisingly near the end, but it bombed.  Here's the data from VirtualDub:

Problem signature:
  Problem Event Name:    APPCRASH
  Application Name:    VirtualDub.exe
  Application Version:    1.10.4.0
  Application Timestamp:    526d9abc
  Fault Module Name:    AviSynth.dll
  Fault Module Version:    2.6.0.5
  Fault Module Timestamp:    54c52eeb
  Exception Code:    c0000005
  Exception Offset:    0006cf53
  OS Version:    6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1:    c4b7
  Additional Information 2:    c4b70ae33514c02d7dfd0bc5a628ea21
  Additional Information 3:    51ce
  Additional Information 4:    51ce8eb2bda31fa21b2d212415bc37da

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

This program was 1 hr 5 min. and the run got to 50 min. before the above crash.

This happens whenever I have used GameDropFixV4, whether inline or with your new function.  I hope someday we can find and fix the memory leak or whatever it is.  At the moment I must proceed to redo this program in 3 chunks (a real hassle).  But I have many more such programs to do, so if you find the solution, that will be very helpful no matter when it is.

135

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

Fault Module Name:    AviSynth.dll
Fault Module Version:    2.6.0.5

Try to use avisynth 2.5.8.5 MT SVP edition. It uses more less memory and must work better with the script.

136 (edited by TCmullet 11-09-2015 21:12:11)

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

Will try, but I always have difficulty understanding about and deciding about so many "current" versions out there.  After searching I found this page:
https://www.svp-team.com/wiki/Download

The version there is 2.5.8.6.  It does say "MT" in the product name, and it's from the SVP site.  Is this what you meant?  And if it's the most current, why is there a creation date of 9/14/2012 (3 years old)???  This totally misleads me.  If this is not the one you meant, please give a link to what you did mean.  Thank you.

But while I'll proceed to change Avisynth version as you recommend (once you confirm this is the correct one), it doesn't address the cause, namely some kind of memory leak in something that's in something that's in GameDropFix.  (I'm speaking figuratively... I don't know where the leak is, other than that GameDropFix is the only thing that triggers it for me.)  If there's a problem there and it can't be easily fixed, I would prefer that that be admitted.  Then it's easier to proceed with temporary workaround.  (But I like to know that it's a workaround.)

So, back to your workaround...  Is this the version you meant?

Also, will I lose some kind... any kind of functionality that I have presently in 2.6.05 MT?

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

Also, I see that what I found is only 397KB.  Whereas the 2.6.0.5 is a whopping 1,784KB.  I saw something somewhere about 2.6 being less efficient.  Is this a case (just making this analogy up) of 2.6 being in COBOL and compiled to assembly vs 2.5 being directly written in assembler?  That would account for bigger size, slower performance and no additional functionality.

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

You can try using version 2.6 MT SVP Edition CRC32 - AA455D77. Download 3.1.7 and take it

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

I'm using the smaller avisynth.dll that you all recommended

File version 2.5.8.6
Product name AvisynthMT 2.5
Product version 2, 5, 8, 0

(I get this from the .dll file itself, which is in the c:\windows\SysWOW64 folder.)

Yes, I can get further into my long programs.  But in most cases it still blows up, but closer to the end.

I now have a TON (dozens) of 1.5-2.5 hour videos that HAVE to have the GameDropFix function applied.  (And I foresee having more in the future in an ongoing basis.)  They all blow up, forcing me to the extremely unpleasantly tedious task of breaking the video up into 20-30 min. chunks, then stringing the resultant Virtualdub output chunks together.  I now have this on a 2nd and faster PC than my prior one.  The error message disappears, but one time I saw it and wrote it down in time:

"An out-of-bounds memory access (access violation) occurred in module
'nvopencl' ... ... reading address 000007dc."

I would GREATLY appreciate if I could package up the script files and put a link here to them and my big video file (11gb).  If I do, would you (Mag79) be willing to recreate my bombing situation with a view to finding where the bug is in this process?  Oh, the new machine has 24GB of ram, and I think I had the task manager up at the time, and it had not greatly increased the memory usage when the bomb occurred.  Months ago, when I did this on my original 4-core PC, I seem to recall that it DID increase memory usage til bombing.

My VirtualDub is 1.10.4 and my output codec (video) is the X264 encoder.  Audio out is PCM.

140 (edited by TCmullet 31-12-2015 18:36:41)

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

I've been getting lots of blowups, but for various reasons beyond the one described above.  I've learned over on Doom9 that for 32-bit VirtualDub (any 32-bit software even if running on a 64-bit OS), there is a 2GB limit.  I was prompted to observe the "Process" tab in Task Manager and see that Virtualdub *32 was increasing to the point where memory in use for it was about 1.6GB.  This has been commonly observed by others who have run into it, whether via memory leaks or an app simply allocating too much memory.  So the direct causes of blowup are superficial.  Anything that would allocate memory correctly will blow up if we're already at the approx. 1.6GB limit (2GB minus overhead).

Here is the Doom9 thread.  At the moment, I'm working on two fronts: 1. Get rid of memory leaks that eat up memory, no matter how much memory is available, and 2. increase available memory to beyond the 2GB boundary. #1 is the ultimate solution, but #2 would get me some success in the interim.  So far I've not been able to get past the 1.6GB limit.  But the thread includes some research done by a kind soul there that seems to prove that MY biggest culprit is GameDropFix, and more specifically, the ScriptClip calls in it.  Please see that thread.  You'll see I mentioned I would pass this on to the GameDropFix author, which is you, Mag79.  Hope you'll look at it and into it, with regard to somehow plugging the leaks from GameDropFix/ScriptClip.
http://forum.doom9.org/showthread.php?t=173023

141

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

TCmullet
Ok. I see.
1. I will read that thread. Maybe I will find the cause of memory leaks you tell about.
2. Did you try to apply 4GB patch to VirtualDub.exe file?

142

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

2. I mean: Start button - SVP - 4GB Patch - select VirtualDub.exe file - OK.
You will see message.

Post's attachments

4GB_Patch_message.png, 5.8 kb, 300 x 200
4GB_Patch_message.png 5.8 kb, 606 downloads since 2016-01-01 

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

MAG79 wrote:

2. I mean: Start button - SVP - 4GB Patch - select VirtualDub.exe file - OK.
You will see message.

Does this program do the exact same thing that the program (LargeAddressAware.exe) here which I did run?:
http://www.techpowerup.com/forums/threa … re.112556/
If I run it again, it shows the current status has being modified and the former status as not modified.  Date stamp has been updated too.

(The above link was one of the hits in the google link provided by the fellow in the doom9 thread I gave you.)

144

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

TCmullet
4GB Patch, LargeAddressAware.exe and others such utils do one thing: change one bit in PE32 header of file.
So, I think yes. LargeAddressAware.exe does the same.

You can check result by CCF Explorer or VMMap. Option 'App can handle >2gb address space' in CCF Explorer must be enabled. Sum of Total+Free in VMMap must be about 4 200 000 K.

Post's attachments

CCF_Explorer.png, 44.73 kb, 747 x 601
CCF_Explorer.png 44.73 kb, 630 downloads since 2016-01-01 

VMMap.png, 32.25 kb, 613 x 643
VMMap.png 32.25 kb, 629 downloads since 2016-01-01 

145

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

TCmullet
Can you share to me the file "2015-12-03.1900.wv.R3-Rnd1.NH-v-FL.sec+.rawX7.mp4" for test?

146

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

TCmullet
As you not answer me I went another way. I take 720p version of this youtube video.
This video has constant pattern 'N-N-J-D'. There one Jump (J) and one drop (D) in every 4 frames. So, for such video you can use another script. It will give you more quality.
If use numbers then pattern is 1-2-4-4 and we need to restore frame #3. We will get 1-2-3-4 when 3 is interpolated frame between frames #2 and #4.

Script FixDropInPattern1244

SetMemoryMax(1024)
global threads=13
global svp_scheduler=true

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

SetMTMode(3,threads)
DirectShowSource("NEWFRO~1.MP4")
SetMTMode(2)

super_params = "{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:2,den:1},algo:13,scene:{blend:true}}"

super=SVSuper(super_params)
vectors=SVAnalyse(super, analyse_params)
fix = SVSmoothFps(super, vectors, smoothfps_params, mt=threads).Subtitle("-fix50")
fix50n = fix.selectEvery(2,1)
fix50n = fix50n.trim(1,1)+fix50n

interleave( \
 SelectEvery(fix50n,4,0), \
 SelectEvery(4,1), \
 SelectEvery(4,2), \ 
 SelectEvery(4,3))

distributor()

If you need to hide subtitle then remove .Subtitle("-fix50") function from the script.
This script has no memory leaks.

147 (edited by TCmullet 16-01-2016 02:18:22)

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

MAG79 wrote:

TCmullet
Can you share to me the file "2015-12-03.1900.wv.R3-Rnd1.NH-v-FL.sec+.rawX7.mp4" for test?

As you not answer me I went another way. ...

I didn't receive notification that you had replied.  Plus I've had to stay off these boards due to too consumed with work (really, this work, but many OTHER video files urgently needing my attention).

Thank you for trying to make logic for your NNJD example.  But all my files are much more random in dupped frames, which is why I really need GameDropFix.  I thought that if you saw what the folks over there at doom9 (via the link I gave) were trying to do, you'd pick up on it and implement the concept in GameDropFix.

Specifically, several appear to be reckoning that the memory-eat-up problem is inherently a part of "ScriptClip".  An Avisynth expert Gavino said "ScriptClip uses up memory in Avisynth's string table for each frame rendered.  Normally this is insignificant, but if it is called with a very long run-time script coupled with lots of source frames, it could eventually eat up a lot of memory.  See this post for the solution."  The post he refers to is this:
http://forum.doom9.org/showthread.php?p … ost1504566
It says to NOT have big content inside a ScriptClip function call (as GameDropFixV4 does), but rather have the voluminous code in it's own function, then call that function in a very brief ScriptClip call.  I figured you would have found that.  I got no emails from either this forum nor that one (doom9), and as I was very consumed with other work, I thought I'd wait y'all out.

Can you please look at at least the link I just gave you (even if you don't further follow what the folks at my first link have been doing)?  I'm hoping you can create GameDropFixv5 to have those ScriptClip calls be tiny by doing the technique at this link right here above.

And now to temporarily upload and make available to you the big Mp4 file you asked for (over 6GB).  I'll post the link after I get it online.

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

Here's the link to the big MP4 file that you can use for testing:
http://www.tomsgoodfiles.com/DaveP/2015 … .rawX7.mp4

I can't leave it up indefinitely but will try to leave it up long enough for you to get it.  Please let me know when you have retrieved the entire 6+ GB file.  Uh, maybe I should package up all of the relevant avs and avsi files?

149 (edited by Nintendo Maniac 64 16-01-2016 03:31:55)

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

You could try "cropping" to only a small portion of the video with something like Avidemux and see if the issue still occurs:
http://fixounet.free.fr/avidemux/

(Avidemux lets you remove parts of the video & audio without re-encoding it if you set the encoders to "Copy" and set it to the proper container)

150

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

TCmullet
Your video is on my hard disk. Thank you for the link.
I will use it for debug GameDropFix_v5 wink
It will take some time.