I give up. AviSync, DebugMode, johnmeyer stuff

tboydva wrote on 2/21/2012, 9:02 PM
I've tried all weekend and am stumped. I'm trying to use the debugmode frameserver to use film restoration scripts (http://forum.doom9.org/showthread.php?t=144271) outlined by johnmeyer in this thread: http://www.sonycreativesoftware.com/forums/ShowMessage.asp?ForumID=4&MessageID=762659. I thought I understood how to do this, but I've just had struggle after struggle. I had trouble getting frameserver to show up in my render options, then I got that working, but I can't get the avs scripts to work with the served AVI. I have V9 64-bit, AviSync 64-bit, and Frameserver 64-bit. When I try and run the 01_Film_Restoring_Frame_Interpolation.avs file (in VirtualDub), it gives an error: "Avisynth open failure: LoadPlugin: unable to load "Deflicker.dll".... deflicker.dll is in the directory with the script... Do all these dll's need to be loaded into the system32 folder? I copied some over when installing AviSynth?

I'm sorry but I've been at this since Friday and I'm ready to pull my hair out. Maybe there's a tutorial that explains how to do this? I was very impressed with the film restoration scripts. I'd really like to run lager sections through this script and make an AVI that I can further cut up and fine tune. This seemed like an appropriate tutorial - but I want to have an AVI at the end - not encoded for the web. I figured VirtualDub would be a good candidate to run the scripts, then final render as AVI - then continue to edit in Vegas. Maybe I'm way off conceptually?

I'm sure the answer is in a thread somewhere here, but I simply cannot find a group of instructions that seems to get me through the workflow. Any help would be greatly appreciated.

Comments

johnmeyer wrote on 2/21/2012, 9:05 PM
I have V9 64-bit, AviSync 64-bit, and Frameserver 64-bit.I'm afraid that many of the plugins used by the film restoration script only run under 32-bit.
NickHope wrote on 2/21/2012, 10:12 PM
Use 32-bit versions of AviSynth and all its plugins, even though your O/S is 64-bit. I recommend this version of AviSynth (2011.09.13). It can be used multi-threaded, but will work fine in single-threaded mode while you get up and running.

Most of your AviSynth plugins should be in a folder such as C:\Program Files (x86)\AviSynth 2.5\plugins\. That's where mine are under XP x64, even though I'm running a build of AviSynth 2.6.

Using VirtualDub to render from an AviSynth .avs file is normal and fine.

My web video guide might help you with some of the basics of Frameserver and AviSynth.
Rory Cooper wrote on 2/22/2012, 12:41 AM
Some pain killers Courtesy Jerry “amendegw”







Shot Jerry thanks for the hard work and script.

I am still having a hassle loading the script for vdub. I can’t get the script to load in vdub. Fortunately it not like loading a shot gun where I could hurt myself or some unfortunate bystander.

Just wondering if I increase the frame rate in Vdub is it tweening it seems to be so. And what is the “bob doubler” doing = filter

Anyway from Vegas – framserve – vdub = avs – motion perfect – Vegas has got some good results for me so I would like to compare MVTools if I can get that script to load.
amendegw wrote on 2/22/2012, 4:00 AM
I guess I should dial-in here. Rory & I have been having a little off-forum dialog about how to use Sony Vegas/Debugmode Frameserver/AviSynth/MVTools/VirtualDub to achieve SloMo.

Please forgive the "quality" of the tutorials above - in replaying them there's lots of errors in syntax and technical mis-statements. And bear with the ums-and-ahs - I did this all on-the-fly. Since I didn't plan on giving them wide distribution, they are just quick-and-dirty, however if one follows the sequence of events everything will work - despite some errors in wording. If they help others - enjoy!!

All that said, there is one more tut in this series - to be viewed just prior to the "Wrap Up" (above).



...Jerry (who doesn't claim to be an expert in this arena - just a disciple of johnmeyer & Nick Hope)

btw: Thanks for the kind words, Rory.
btw2: The Frameserver install was specific for Rory - i.e. Vegas 10.0c running on Windows 7 64 bit.
btw3: The above installs the AviSynth 32 bit version. Thus far I've hand no problems using it with Vegas 11 64bit (and whatever 32bit plugins are available for AviSynth)

System Model:     Alienware M18 R1
System:           Windows 11 Pro
Processor:        13th Gen Intel(R) Core(TM) i9-13980HX, 2200 Mhz, 24 Core(s), 32 Logical Processor(s)

Installed Memory: 64.0 GB
Display Adapter:  NVIDIA GeForce RTX 4090 Laptop GPU (16GB), Nvidia Studio Driver 566.14 Nov 2024
Overclock Off

Display:          1920x1200 240 hertz
Storage (8TB Total):
    OS Drive:       NVMe KIOXIA 4096GB
        Data Drive:     NVMe Samsung SSD 990 PRO 4TB
        Data Drive:     Glyph Blackbox Pro 14TB

Vegas Pro 22 Build 239

Cameras:
Canon R5 Mark II
Canon R3
Sony A9

tboydva wrote on 2/22/2012, 5:20 AM
Thanks gentlemen... It least it appears my workflow is generally acceptable. Nick, I was essentially trying to follow your tutorial (but I think I want to end up with AVI files vice other encoding). I have Vegas 64-bit, so I made the assumption that the frameserver/debugmode/plugins would all have to "match." I'm going to try going 32-bit on everything and keep fingers crossed.

As always, thanks for the help!!!
NickHope wrote on 2/22/2012, 7:57 AM
Yep tboydva, I was just suggesting it for the Frameserver and Avisynth bits and ignore the MeGUI stuff.

So Jerry/Rory, have you got it working now? I haven't watched the tutorial vids yet.

Anyone feel free to shout in here if you have Framserver/AviSynth/VirtualDub issues and I'll try and help.
NickHope wrote on 2/22/2012, 8:09 AM
Jerry, once you've got everything running, at some point you'll probably want to "upgrade" your official single-threaded 2.5.8 AviSynth to this multi-threaded build of 2.6. It will run everything just as the 2.5.8 build will, but it contains a load of bugfixes and you can also add multi-threaded code to it to hugely speed things up. I've found it to be really robust. Get advice on the MT code additions either at that page, in this section of my guide, or on the QTGMC page.
BobMoyer wrote on 2/22/2012, 8:45 AM
Gentlemen,

Those tutorials have been an immense help to me in understanding what has been discussed on many occasions concerning frameserving and debugmode and avisynth. I now have enough courage to try this. Many thanks to all concerned and especially to Jerry for taking the time to make the tutorials.

Bob
amendegw wrote on 2/22/2012, 9:14 AM
"Jerry, once you've got everything running, at some point you'll probably want to "upgrade" your official single-threaded 2.5.8 AviSynth to this multi-threaded build of 2.6"Nick, Just to be clear, I've been "up-and-running" for quite some time now thanks to following the examples posted by you and johnmeyer (and an occasional trip to doom9.org). The recent objective was to get Rory Cooper up and running (and I think he's very, very close).

That said, I just upgraded to the multi-thread version of avisynth.dll and have been about to see about 33% improvement in render time. I think I can get more than that by playing with the SetMTMode() & SetMemoryMax() methods. Much thanks!! This is why you are the "master" and I am the "grasshopper" [grin]

...Jerry

System Model:     Alienware M18 R1
System:           Windows 11 Pro
Processor:        13th Gen Intel(R) Core(TM) i9-13980HX, 2200 Mhz, 24 Core(s), 32 Logical Processor(s)

Installed Memory: 64.0 GB
Display Adapter:  NVIDIA GeForce RTX 4090 Laptop GPU (16GB), Nvidia Studio Driver 566.14 Nov 2024
Overclock Off

Display:          1920x1200 240 hertz
Storage (8TB Total):
    OS Drive:       NVMe KIOXIA 4096GB
        Data Drive:     NVMe Samsung SSD 990 PRO 4TB
        Data Drive:     Glyph Blackbox Pro 14TB

Vegas Pro 22 Build 239

Cameras:
Canon R5 Mark II
Canon R3
Sony A9

johnmeyer wrote on 2/22/2012, 10:29 AM
have been about to see about 33% improvement in render timeYou should be able to get much more than that for most of the scripts using MVTools2. I usually see about 200-300% increase in speed so that scripts that run at 4-5 fps now run at 20 fps or faster.

To get this speed improvement, you install the version of AVISynth that Nick already mentioned. You then insert two "SetMTMode" statements into your script, one before the call to open the video file, and then another one immediately after that call. If you want to use all your CPU cores, then the first call should be "SetMTMode(5,0)". If you find that the script isn't stable (it crashes), then you will want to limit the number of cores. To limit the cores to four, you would change this first call to "SetMTMode(5,4)". The second call actually sets which type of multi-threading will be used by the script. I usually use "2" so my second call, placed immediately after the statement which opens the video is "SetMTMode(2)".

I have 8-cores (threads, actually) and I find that "SetMTMode(5,6)" is usually sufficient to ensure that I don't have stability problems. I find that any script which uses external function calls, such as QTGMC3.25.avsi or LimitedSharpenFaster.avs often require that I reduce the number of cores in order to achieve stability. I still get a minimum of 2x (100%) speed improvement.
tboydva wrote on 2/22/2012, 8:12 PM
OK - I have one more (I hope) question... I loaded all 32 bit versions (Debugmode, AviSyth, VirtualDub). I'm still having trouble with the film restoration avs file... I downloaded all versions in Nick's tutorial (and in this thread). I installed MVTools2. I get an error in Avisynth: "Avisynth open failure: Script error: there is no function named "SetMTMode"..." Looking this up, it appears I need to install MVTools2? I tried registering the MVtools2 dlls from the install, but they will not register in Windows...

Maybe I should take this to the doom9 forums, but perhaps someone here has encountered this issue? I tried the 02_Film_Restoring_Frame_Blending.avs script and got the same error...
NickHope wrote on 2/22/2012, 9:31 PM
tboydva, it sounds like you're trying to run a multi-thread script in the single-thread version of AviSynth.

I'm not sure what script you're running but lines such as the following ones will only work if you have an "MT" version of AviSynth, not "ST":

SetMemoryMax(768)
SetMTMode(5, 4)
...
SetMTMode(2)


I recommend getting a working set-up first with the official 2.5.8 ST version. When that's running fine, upgrade to this 2.6 MT version. Make sure your same script still works single-threaded with it, and only then start adding the MT stuff to it.

Note the 2.6 MT installation instructions to simply replace the avisynth.dll in your system32 (on 32-bit OS) or syswow64 (on 64-bit OS) folder with it.

If you still have trouble, paste your script here in its entirety.
tboydva wrote on 2/23/2012, 10:10 AM
Nick, I commented out all of the SetMTMode calls in the restoration script (it's the one johnmeyer uses). It seems to be working now!!! I am doing this for my family film, so if it takes a week, it's not a big deal (I only have 4 DV tapes worth). Thanks so much!!!
johnmeyer wrote on 2/23/2012, 10:48 AM
I see a big red flag in the OP's last post.

The script you refer to, and which you linked to in the first post in this thread, is for restoring film that has been captured to video using a "frame accurate" film-to-video transfer system, like MovieStuff's Workprinter.

This script will not work for standard DV video. Any attempt to use it on DV video will produce a big, fat mess.
tboydva wrote on 2/23/2012, 4:42 PM
I can't remember where I got the recommendation for film-to-video service, but evidently the place I sent it (I think I got the tip on this board about 7 or 8 years ago) did a pretty good frame-accurate conversion to DV. I've got the Film_Restoring_Frame_Interpolation.avs and the Film_Restoring_Frame_Blending scripts to work. I'm not sure which is better (or how they're different). I'm going to have to step through the code to figure out what they're doing. Right now, the difference is simply amazing! I'd like to "export" to an single "fixed" avi instead of the comparison screen with text so I can use the "cleaned up" clips on a timeline. I think I can modify the avs script to do that (but haven't tried yet).

The process is pretty slow. I commented out the SetMTMode commands, but I might have to try installing the MT-enabled dll and see if I can get it to speed things up.

I followed your suggestions to handle the clip progressive and "disable resample." I think I'm moving into the refinement process now (but I could be kidding myself). Here's the <a href="http://dl.dropbox.com/u/39615209/Beachscene.wmv">link</a>. There might be some frames that are fouled up, but mostly it looks like a great improvement!

Thanks for all the help. As a bit off-topic aside, the machine that johnmeyer has in a link somewhere (that does frame-accurate film-to-video) - I saw the company's webpage (can't find the link now). It now does HD conversion. Is it "worth it" to have old 8 mm film converted to HD? Is the resolution worth it?
johnmeyer wrote on 2/23/2012, 6:47 PM
I didn't realize you had frame accurate film-to-video. Given that you have this content, the script will do wonderful things.

I've got the Film_Restoring_Frame_Interpolation.avs and the Film_Restoring_Frame_Blending scripts to work. I'm not sure which is better (or how they're different).The Interpolation script uses motion estimation to create additional, synthetic frames between each frame. This gives a "smoother" motion result, especially when the camera is panning, but your film will no longer look exactly like film. Also, motion estimation can sometimes introduce artifacts in the frames it creates. I haven't seen the term "blending" but I'm pretty sure it is the other approach for creating the extra frames needed when you playback 16, 18, or 24 fps film on a device that expects 29.97 interlaced. What it does is duplicate fields, a process called pulldown. This is what I use because it is faithful to the original "feel" of film, and it will not introduce any surprises.

I'd like to "export" to an single "fixed" avi instead of the comparison screen with textYou should read the documentation that comes with Fred's scripts. However, all you have to do is change this line:

result="result1" # specify the wanted output here

There are eight possible "results" you can put on this line:

result="result1"
result="result2"
result="result3"
result="result4"
result="resultS1"
result="resultS2"
result="resultS3"
result="resultS4"

The ones with the "S" will give you the before/after screen. Therefore, remove the "S" when you are ready to actually save some video. The difference between 1,2,3,&4 is described in the script comments.

I commented out the SetMTMode commands, but I might have to try installing the MT-enabled dll and see if I can get it to speed things up. This is really easy. Just go to the windows/system32 folder and rename avisynth.dll to avisynth.old. Then, copy the 2.6 AVISynth DLL to that folder. That's all there is to it.

I do not use the LimitedSharpenFaster sharpening because it is dreadfully slow. Also, for my tastes, Fred's scripts use way too much sharpening. I've made a LOT of changes to his script. My version of the script on my computer runs at about 7 fps.

the machine that johnmeyer has in a link somewhere (that does frame-accurate film-to-video) - I saw the company's webpage (can't find the link now). MovieStuff

Is it "worth it" to have old 8 mm film converted to HD? Is the resolution worth it? No, I don't think so, although Roger Evans (the "MovieStuff" guy) seems to think it is. I haven't seen any definitive SD/HD 8mm transfer comparison. Based on theory, I don't think 8mm -- or even Super 8 -- has enough definition for HD to make much of a difference.

16mm is another matter. HD would definitely help.
Rory Cooper wrote on 2/24/2012, 2:21 AM
Jerry I am up and running and rendering = put my favorite quote into action “three wrong lefts actually make a right” I have to screw it up at least three times before I get it right.

It appears the script last line had issues so I deleted the last line = assume fps(25.0) it loaded but rendered bad so I assumed I had to tell it 25 fps was the input so I did this.

loadplugin("C:\slomo\AviSynth 2.5\plugins\mvtools2.dll")

AVISource("F:\slomo\1.avi").Killaudio()

# assume progressive PAL 25 fps

super = MSuper(pel=2)

backward_vec = MAnalyse(super, overlap=4, isb = true, search=3)
forward_vec = MAnalyse(super, overlap=4, isb = false, search=3)


MFlowFps(super, backward_vec, forward_vec, num=8*FramerateNumerator(last),den=FramerateDenominator(last))


It is rendering but still getting orible results but I assume it’s the .avs that’s not right.
NickHope wrote on 2/24/2012, 4:17 AM
Maybe try declaring blksize specifically, and playing with the values of blksize, overlap and search. See [url=http://avisynth.org.ru/mvtools/mvtools2.html]. I would maybe start by setting all 3 of them to defaults (also achieved by just leaving them out).

Or 8 x slomo might just be asking too much.

What format are you starting with exactly? Can you open one of your source files in Mediainfo, switch the view mode to "text", and paste the output here? Admittedly I'm not up with the handling-frame-accurate-film-to-DV-transfer-as-progressive stuff, but it sounds like that might be the issue.
amendegw wrote on 2/24/2012, 4:35 AM
Rory,

Some thoughts:

1) The last line should be assumefps(25.0) - no space between the "assume" & "fps"
2) This is 25 fps footage, correct? Not 50.0 fps?
3) You might start with a little less extreme SloMo to start (e.g. reduce the 8*FrameRateNumerator(last) to 2*FrameRateNumerator(last) )
4) While this SloMo script is very, very good, it cannot recreate the impossible. For example, if frame 1 has a bird at the far left of the frame and frame 2 has the bird at the far right of the frame, this technique will struggle to create the intervening frames. Also, I've found that it struggles when both the camera and the subject moves.

Finally, discussion what each of the statements in the AviSynth script is doing is reaching the limit of my knowledge (I merely copied and modified the script from the MVTools2 help page). Maybe someone with more expertise (e.g. Nick Hope or johnmeyer) add additional info (or correct any errors in my reply).

Good Luck!
...Jerry

Edit: I see Nick posted while I was composing my post. Phew!! At least there was some consistency in our replies.

System Model:     Alienware M18 R1
System:           Windows 11 Pro
Processor:        13th Gen Intel(R) Core(TM) i9-13980HX, 2200 Mhz, 24 Core(s), 32 Logical Processor(s)

Installed Memory: 64.0 GB
Display Adapter:  NVIDIA GeForce RTX 4090 Laptop GPU (16GB), Nvidia Studio Driver 566.14 Nov 2024
Overclock Off

Display:          1920x1200 240 hertz
Storage (8TB Total):
    OS Drive:       NVMe KIOXIA 4096GB
        Data Drive:     NVMe Samsung SSD 990 PRO 4TB
        Data Drive:     Glyph Blackbox Pro 14TB

Vegas Pro 22 Build 239

Cameras:
Canon R5 Mark II
Canon R3
Sony A9

tboydva wrote on 2/25/2012, 8:10 AM
John,

So - it appears that I only have "mostly" frame-accurate capture. There were some areas in parts of my fim-to-video collection that have duplicate frames. 95% is perfect with the avs scripts. From what I can read, the duplicate frames can cause issues (I think you posted quite a bit on this subject).

So now I'm at a decision point. I plan on only doing this once (I have four DV tapes with all of my family film transferred). I could either step through 4 hours frame-by-frame to search out duplicates (seems VERY time-consuming). I could learn how to use AviSynth functions and try the one you posted here (http://forum.videohelp.com/threads/308840-old-VHS-restoration?p=1910641&viewfull=1#post1910641) to try and remove any duplicate frames (then run the avs "clean up" scripts). Or, perhaps I should send out my box of movies (provided I can find where I placed it in the attic) and have it re-digitized (in HD?).

I'm trying to do the time/money balance sheet. I actually enjoy tinkering and customizing, but with a very full-time job, Reserve duty, 2 kids into every sport imaginable (but can't yet drive!), etc, it's tough to know if the time investment will pay off.

So hopefully the last question: Do you think removing duplicate frames will make my DV amenable to running the script(s) successfully?

Thanks to you - and others - for helping me along with this!
johnmeyer wrote on 2/25/2012, 10:36 AM
It is impossible to give any more advice without seeing about 10 seconds from one of your DV files. You may not have a frame-accurate transfer, despite what you think. That would be one thing, and there is a thread over at doom9.org where techniques to deal with such footage are discussed.

Another possibility is that the people who did this added pulldown to the DV file to make the footage play at the proper speed. If this is the case, then that pulldown can be removed using IVTC software. This is fairly straightforward.

If the duplicates follow no pattern, then it will be very difficult to get anything resembling a frame-accurate transfer, and you won't be able to use Fred's film restoration script.
tboydva wrote on 2/26/2012, 11:37 AM
Dumb luck???? Or perhaps, ignorance is bliss?

Once again - Thanks! I've devoted more time (and some frustration) to this than I have in a long time. I think I've actually arrived at a very decent workflow. John, I ended up using your AviSynth function (filldropsI). I created a script to read in my avi, then remove any duplicate frames. Then, I placed the resulting avi on the Vegas timeline, did your suggestions (progressive; no reprocess) and served to AviSynth and used Fred's film restoration script(s). Then, I put the resultant clip on the vegas timeline along with the original. Then stepped through to determine a velocity envelope of 159% made the clip sync perfectly with the original. All the areas that had artifacts previously look perfect (in my eyes at least). A lot of effort no doubt (which probably would have been way easier had I gotten the film transferred frame accurate). It was an significant cost, so I'm reticent to have it done again (this was probably 10 years ago, so I imagine the cost has risen a bit).

Many thanks again to all who helped in this endeavor! Here's how I did the filldropI conversion in case it's useful to anyone else:

# film duplicate frame removal.
# modified 25 FEB 2012
# uses johnmeyer's filldropI.avs function
#=============================================================================================

#Modify this line to point to your video file
film=AVISource("F:\Video\Video Capture and Archives\Capture\xxxx.avi").killaudio()
SetMTMode(2,0)

film = ConvertToYV12(film, interlaced=true)
output=filldropsI(film)
return output

function filldropsI(clip c)
{
even = c.SeparateFields().SelectEven()
super_even=MSuper(even,pel=2)
vfe=manalyse(super_even,truemotion=true,isb=false,delta=1)
vbe=manalyse(super_even,truemotion=true,isb=true,delta=1)
filldrops_e = mflowinter(even,super_even,vbe,vfe,time=50)

odd = c.SeparateFields().SelectOdd()
super_odd=MSuper(odd,pel=2)
vfo=manalyse(super_odd,truemotion=true,isb=false,delta=1)
vbo=manalyse(super_odd,truemotion=true,isb=true,delta=1)
filldrops_o = mflowinter(odd,super_odd,vbo,vfo,time=50)

evenfixed = ConditionalFilter(even, filldrops_e, even, "YDifferenceFromPrevious()", "lessthan", "0.1")
oddfixed = ConditionalFilter(odd, filldrops_o, odd, "YDifferenceFromPrevious()", "lessthan", "0.1")

Interleave(evenfixed,oddfixed)
Weave()
}
johnmeyer wrote on 2/26/2012, 1:35 PM
Well, if it works, then go for it. I'm pretty sure it is not the correct way to solve the problem, but as I said in the previous post, I can't say anything for certain without seeing a few seconds from one of your DV files.
johnmeyer wrote on 2/27/2012, 10:23 AM
I looked at your sample footage, one [i]field[i] at a time (using "separatefields" in AVISynth) and your capture is most definitely NOT a frame accurate transfer. It might be possible to recover the original frames from this transfer, but it will take a custom AVISynth script.

You can start here in the doom9 forum to follow a discussion which is somewhat parallel to this:

Bad Film Capture

That person attempted to collect all that he learned and posted a new thread here:

The power of Avisynth: salvaging "botched" transfers of old 8mm films to DVD

There is a obvious chroma lag in your film that you will see if you use separatefields and look at the result one field at a time.