Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th October 2012, 12:06   #21  |  Link
smok3
brontosaurusrex
 
smok3's Avatar
 
Join Date: Oct 2001
Posts: 2,392
Quote:
Originally Posted by videoFred View Post
Example clip:
https://vimeo.com/49963017
amazing!
__________________
certain other member
smok3 is offline   Reply With Quote
Old 15th October 2012, 18:39   #22  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by videoFred View Post
But you have used an old version of my script! Both stabilizing and sharpening are different in my latest script. I'm also using the modified Autolevels() by Frustum, and this one is much better than the old one.
One problem in making such a long post (so long that it took three posts), is that many points get lost. I did try the new autolevels, and also tried the different approach to using that DLL that you have in your latest script (using the Low/High parameters), but I ended up with all sorts of levels "pulsing" where the levels would shift violently from frame to frame. I'm pretty sure it is some sort of scene detection issue and probably could have been easily solved. However, as I said in my last post, both the auto levels and auto color correction (not just in your script, but in all scripts I have tried) just can't cope with the huge variation in problems that I find in old amateur film. So, I have to do those manually, and therefore didn't want to spend a lot of time trying to tweak these settings.

I also didn't use your code because your newer approach involves two more color space conversions (converttoRGB24() followed immediately by a converttoYV12() ), and those always have a pretty significant performance penalty.

As for the Depan improvements, I did try them, but didn't see much difference (I did temporarily bolt your new code into my script). Also, I realized, as I was testing, that unless there is a performance improvement or a borders improvement, I'm not too interested because for "big" motion stabilization, I always use either Deshaker or Mercalli inside of Vegas prior to frameserving into your script (or my version of your script).

However, if you think I should re-visit your autolevels, autocolor, and Depan improvements, I'll be happy to go back and make the changes. It is only a few minutes of work to put them back.

Quote:
Originally Posted by videoFred View Post
It seems that the botteneck for speed is RemoverdirtMC(). Can you give me some tips to speed up RemoverdirtMC()? Are the SSE2 versions from the dll's realy that much faster?
The SSE2 versions only account for a very small portion of the improvement, but there is zero downside to using them, and they are optimized to use faster instructions available in my processor.

Here are, I think, the major reasons why my script is faster, and therefore these are the things you should try when making revisions to your work:

1. Get rid of the original MVTools. MVTools2 is, I think, better in every way, but the most important improvement is that it was rebuilt to be compatible with AVISynth multi-threading. Multi-threading is essential for speed improvement. Once you get rid of the original MVTools, you should be able to use the SetMTMode() statements, and once you do that, you can get integer multiple speed improvements (2x-4x).

2. Use the two-step motion estimation which involves using MRecalculate. This takes very little additional coding. The basic idea is to do an initial motion estimation using a somewhat denoised clip. fft3dfilter is often used, but I found that RemoveGrain is faster and more importantly, results in more dirt removal and fewer false positives. This initial motion estimation is done using really large block sizes, and therefore is quite fast. Then, a second motion estimation is done using the original unfiltered clip, but using the estimation vectors generated from the denoised clip. This second motion estimation is done using a smaller block size. You end up with better motion estimation and, even though two estimations are done, the overall speed is actually faster than if you did one estimation using really small block size.

3. Do the same two-step estimation for the MDegrain section of the script.

4. Try different versions of AVISynth. This is really important when doing multi-threading, both because of stability and also performance.

I do have plans for possible further improvement. As you know, there is another branch of the MVTools development that resulted in a real-time motion estimation tool called SVP. This is designed primarily for creating smooth motion on 24p material by creating interpolated frames. This is actually built into many modern TV sets (the "soap opera effect"). The SVP tool can use GPU acceleration and can be amazingly fast. Unfortunately, it was not created to produce vectors for MDegrain or other plugins like RemoveDirt. However, the authors did respond to requests for a "hack" to let the SVP vectors get passed to these other plugins. I did try this some months ago, and it did work. I just didn't have time to put it into the script and debug it. This potentially could provide another big increase in speed.

SVP is included as part of the InterFrame script for doing motion-estimated frame rate conversion.

Last edited by johnmeyer; 15th October 2012 at 19:09. Reason: clarified MVTools vs. MVTools 2 confusion in original post; added InterFrame statement at end of post
johnmeyer is offline   Reply With Quote
Old 19th October 2012, 16:51   #23  |  Link
matfra
Registered User
 
Join Date: Jul 2009
Posts: 111
Hey Fred.
Is it possible to have you script run in MT mode.
How can I do it. It is crashing for me
matfra is offline   Reply With Quote
Old 19th October 2012, 17:18   #24  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by matfra View Post
Is it possible to have you script run in MT mode. How can I do it. It is crashing for me
My version of Fred's script (posted earlier in this thread) as well as my earlier version (posted in Fred's earlier thread) were designed specifically to run under MT using SetMTMode. They run at least 4x faster and, if you are willing to use larger block sizes for MDegrain, you can approach 10x faster.
johnmeyer is offline   Reply With Quote
Old 19th October 2012, 18:31   #25  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
In my version of the script, which I posted on the first page of this thread, one of the "improvements" I added was to use the Interframe script for motion interpolation. I mentioned that I don't often use this capability, but that this script had been written specifically for this purpose and therefore, I assumed (oh no!), it would be better.

Well, yesterday I actually used it, and wasn't entirely satisfied. So, I tried a few alternatives and, with this one test case, I got much better results using my own (much simpler) implementation of the function, still using SVP, but using settings that I was not able to achieve just by changing the settings passed to Interframe.

FWIW, here is my motion interpolation code:

Code:
function SmoothFPS2(clip source, threads) { 
  super_params="{pel:2,gpu:1}"
  analyse_params="""{
        block:{w:16,h:16}, 
	main:{search:{coarse:{distance:-10}}},
	refine:[{thsad:200}]
        }"""
  smoothfps_params="{rate:{num:30,den:16,abs:false},scene:{mode:0,limits:{scene:8500}},algo:21,cubic:1}"
  threads = 5

  super =   SVSuper(source,super_params)
  vectors = SVAnalyse(super, analyse_params)
  SVSmoothFps(source,super,  vectors,  smoothfps_params,  url="www.svp-team.com",  mt=threads)

# Alternative for interlaced output
# SVSmoothFps(source,super, vectors, smoothfps_params, url="www.svp-team.com", mt=threads).SeparateFields().SelectEvery(4, 0, 3).Weave().assumefps(29.97)
}
I was not able to figure out how to pass "num" and "den" parameters to this function because they are inside an array and AVISynth kept throwing an error. I didn't have the time to figure this out, and for my needs it was sufficient to just "hard-wire" the function for the desired final rate.
johnmeyer is offline   Reply With Quote
Old 20th October 2012, 00:03   #26  |  Link
matfra
Registered User
 
Join Date: Jul 2009
Posts: 111
Hey John,
I already tried you version. Yes its working fast with MTmode. I ran 2 test on same clip, 1 was your and the other was Fred's script. I did get the same quality image on both clip, and your script was running at 22fps. Fred script ran at 9fps. The difference with Fred script, that you can tweak lot more and apply a versy strong denoising, and FlowFPS.
I have a question for you John, or maybe Fred can answer me too. I really dont like the Sharpening fonction used in the script. I find the sharpening too strong or not enough. Often it is sharpening noise and I get (Noise Halo) around people or object in the video.
Is there a way you could implement more tweak for the Sharpening, or maybe replace USM by LSFMod ?
matfra is offline   Reply With Quote
Old 20th October 2012, 14:18   #27  |  Link
matfra
Registered User
 
Join Date: Jul 2009
Posts: 111
I made some test last night. I managed to replace the denoising parameters with SMDegrain 2.1d.
I get 16fps with very high denoising at tr8 ! Tr2 lot lot more faster than John script. I made some custom parameter.

#SMDegrain SETTINGS
thSAD= 400 #denoising level of second denoiser
tr=8 #number of frames for averaging (forwards and backwards) 3 is a good start value
PreFilter=2 #block size of MVDegrainMulti()
Mode=-1
blksize= 16
lsb=False
ContraSharp=True
Interlaced=False

#DEGRAINING/SHARPENING
#vectors= cleaned.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, blksizev= block_size_v, overlap=block_over, idx=1)
#denoised= cleaned.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=2).unsharpmask(USM_sharp_ness3,USM_radi_us3,0)
denoised=noise_baseclip.SMDegrain(thSAD=thSAD,tr=tr,PreFilter=PreFilter,Mode=Mode,blksize=blksize,lsb=lsb,ContraSharp=ContraSharp,Interlaced=Interlaced).unsharpmask(USM_sharp_ness1,USM_radi_us1,0)
matfra is offline   Reply With Quote
Old 22nd October 2012, 06:24   #28  |  Link
videoFred
Registered User
 
videoFred's Avatar
 
Join Date: Dec 2004
Location: Terneuzen, Zeeland, the Netherlands, Europe, Earth, Milky Way,Universe
Posts: 689
Quote:
Originally Posted by matfra View Post
I have a question for you John, or maybe Fred can answer me too. I really dont like the Sharpening fonction used in the script. I find the sharpening too strong or not enough. Often it is sharpening noise and I get (Noise Halo) around people or object in the video.
Are you using the latest version of my script? If you see halo's around people then you have set it way to strong.

Quote:
Is there a way you could implement more tweak for the Sharpening, or maybe replace USM by LSFMod ?
Been there before... LSFMod was in my early scripts.

Fred.
__________________
About 8mm film:
http://www.super-8.be
Film Transfer Tutorial and example clips:
https://www.youtube.com/watch?v=W4QBsWXKuV8
More Example clips:
http://www.vimeo.com/user678523/videos/sort:newest
videoFred is offline   Reply With Quote
Old 9th November 2012, 06:36   #29  |  Link
wesbc
Registered User
 
Join Date: Nov 2012
Posts: 1
Hi,

I have some 8mm film that have been damaged by flood from the recent hurricane sandy. These are old film of my wife's childhood that I've been meaning to transfer to modern media but have kept postponing. With the recent storm my basement was flooded with 6' of water and the film along with the projector was submerged in sea water for several hours. I was only able to get to the film 4 days later. So far I've rinsed each wheel in warm water to clean them. I know nothing about 8mm film so I hope I have not damaged it any further.

If anyone can give me advice on how I can get these restored or can recommend a professional service that is reliable I would greatly appreciate it. Thanks.

Wilson
wesbc is offline   Reply With Quote
Old 9th November 2012, 08:20   #30  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Good move on getting them into fresh water. That is the correct first step. The next step is to get them into a wetting agent so that they dry without waterspotting. "Photo-Flo" is the stuff I used in the darkroom, and I have a bottle of it in my hand right now. It was made by Kodak. You put a few drops in the water (which should be at room temperature), and slosh the film around to remove any residual chemicals (after the film has been in the fixer, in the case of developing). Since the film was developed long ago, you don't have to worry about chemicals, but you probably have a lot of "crud" from the sea water. In the early days of my darkroom work, in the late 1950s, before Photo-Flo, the way to keep the film from water-spotting was to use a soft chamois or sponge squeegee. The one I used look like a pair of kitchen tongs, with the tongs covered with the soft, non-scratch absorbent material.

So I'd recommend, if you're going to do it yourself, that you combine the two steps: you soak in water containing Photo-Flo, and then wipe the water off with a sponge or similar tool in order to remove any remaining dirt.

If you are looking for professional help, I'd call various East Coast transfer services and ask if they have any special cleaning facilities. Some of the really good places have ultrasonic cleaning machines that will certainly be able to remove the gunk from the water. That is going to be the big challenge, and the sooner you do it, the better. Much of my father's 35mm negatives were immersed in sewer water in a house flood back in the 1940s. When I tried to clean them in the late 1990s, I couldn't get any of the gunk to budge.

Whatever you end up doing, you should still proceed with the fresh water rinse with the wetting agent in order to get rid of the salt.

[edit]You might also want to consider posting in this forum:

8mm Forum

Last edited by johnmeyer; 9th November 2012 at 08:22. Reason: added postscript
johnmeyer is offline   Reply With Quote
Old 3rd December 2012, 15:54   #31  |  Link
digitap
Registered User
 
Join Date: Nov 2012
Posts: 2
Hi, all, this is my first post. I've been reading these threads and saw many of the Vimeo clips. My goal is to help my father process the 5000+ feet of regular 8mm film he had transferred. To get started, I have a few questions. Before I get to those, let me give you some relevant details:

We had the film transferred at filmtransfer.com (now pixcel) using their frame-by-frame HD process. We received a 1080 transfer saved as avi's. Upon playing it, I found they had done a basic time-correction by duplicating each frame. Also, they encoded the file using the Cineform lossless codec.

I've gotten the codec issue squared away, as the one provided on the hard drive they sent back only had the playback codec, not the one able to be used to encode video. I found the necessary software and did a test run using AVS and VirtualDubMod and was able to save the video using the Cineform codec and at the same time delete every other frame. On opening the new file, though I'm getting a message about YV12 color and it doesn't let Fred's script do any processing. I'm not sure how to correct this.

Secondly, is there any way to use Fred's script or JohnMeyer's directly on the source files? I'd like to not have to re-encode all the video to take out the duplicate frames if I can just add a few lines to the restoration scripts to have that process done automatically.

Lastly, what parameters need changed since this is a 1080 transfer vs. standard resolution? I obviously need to adjust the cropping values, but what about the stabilization, spot/grain, and sharpening? Any thoughts or suggestions?

Thanks all!
digitap is offline   Reply With Quote
Old 3rd December 2012, 18:01   #32  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
1. Cineform is now owned by GoPro. You can download from their site a codec that will both play and encode Cineform files.

Cineform Codec

2. Use VirtualDub to cut 2-3 seconds of one of your transfers (choose something with lots of motion). Make sure to use the "Direct Stream Copy" option (video menu). Upload this so we can take a look at the pulldown that was added. The most important thing facing you, before you do anything else, is to remove that pulldown properly, without leaving duplicates, or without decimating good frames. You cannot use any of the film restoration scripts until and unless all pulldown (duplicate) frames or fields are removed. Note, in that last sentence, that I said "frames or fields." Proper pulldown is done at the field level, not frames, and if you decimate entire frames you can end up with a huge mess. Google "3-2 film pulldown" and read up on how the telecine process is done. This will describe the process for 24 fps sound film, but the concept is the same for other, slower, silent film speeds.

Basic pulldown removal is done with the IVTC plugin using TFM followed by Tdecimate. With simple sound telecine, you can use these two functions without any parameters, but with film that runs at other than 24 fps, you must supply your own parameters.

Here are some basic starting points for 16 fps and 18 fps film, but this code may not work for your situation because I have no idea how the pulldown was added:

Code:
tfm(display=false)
tdecimate(display=false,mode=0,cycleR=2,cycle=5) #18 fps  # 3:3:4 field count
#tdecimate(display=false,mode=0,cycleR=2,cycle=3)#16 fps
3. Use ConvertToYV12 (or ConvertToYUY2, if appropriate) to do the color conversion. There is a performance penalty to these color conversions, so only do them when necessary.
johnmeyer is offline   Reply With Quote
Old 3rd December 2012, 20:28   #33  |  Link
digitap
Registered User
 
Join Date: Nov 2012
Posts: 2
Thank you, I have already downloaded the software from GoPro, maybe I wasn't clear on that point.

I'll see about pulling out a short clip for you. I emailed the company and asked about their time correction and confirmed that they just duplicate each frame. I don't believe they blended fields such that I'd need to do IVTC. When I load a clip into VDub, I can advance frame by frame. In the original clips, you simply see each frame of film twice, then it moves to the next frame, i.e. 1,1,2,2,3,3,4,4... There doesn't appear to be any sort of blending of two different frames of film into a single frame of video.

I guess the company was "being nice" so that the AVIs were immediately playable without having them look like they are in fast forward, but as a consequence they're twice as big (file size) as they needed to be. With this doubling, the speed is off just slightly from the original 16fps (all of these were standard 8mm silent films), but not too noticably.

I guess my second question above is question is whether I could add a parameter at the beginning of the script to only process every other frame? If not, I'll need to convert each clip by removing duplicate frames and saving as separate files. With around 500GB of video, I was simply looking to save the time and space (another 250GB) doing that.
digitap is offline   Reply With Quote
Old 3rd December 2012, 21:14   #34  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by digitap View Post
I guess my second question above is question is whether I could add a parameter at the beginning of the script to only process every other frame?
Try SelectEven().
Guest is offline   Reply With Quote
Old 4th December 2012, 02:34   #35  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I have seen the simple pulldown you describe (duplicating each frame). This is correct for 15 fps film, but for the common 16 fps (8mm and early silent 16mm) and 18 fps (later 16mm and all Super 8), your film will run too slow.

For your simple pulldown, the SelectEven() already recommended is all you need.

When you are ready to create the final video, if it is going to play on anything other than a TV set, you can simply set the playback speed using the guidelines I gave above. Just plug the appropriate fps value into AssumeFPS(), e.g., AssumeFPS(18) for Super 8.

Last edited by johnmeyer; 4th December 2012 at 02:35. Reason: added paragraph break
johnmeyer is offline   Reply With Quote
Old 16th August 2013, 08:02   #36  |  Link
Boffee
Registered User
 
Join Date: Oct 2011
Location: Worthing, UK
Posts: 24
This one is for John Meyer. I have put your script from post #25 in to the Frame Interpolation section of your new cine script on post #17 replacing the use of Interframe. However I end up with 16 or 18 fps, which is what I started with. I guess, looking at the function SmoothFPS2, it seems to me I am missing a return line. Am I correct? If so, could you say what this should be. Being a newbie to Avisynth I could not figure this out. Thanks
Boffee is offline   Reply With Quote
Old 16th August 2013, 16:47   #37  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by Boffee View Post
However I end up with 16 or 18 fps, which is what I started with. I guess, looking at the function SmoothFPS2, it seems to me I am missing a return line. Am I correct?
I apologize for posting a rather incomplete function. I should have spent more time and allowed you to pass the frame rate into this function. However, in my haste to show what I did, I posted a "hard-wired" function that is designed for a specific source rate (16 fps), going to a specific output rate (30 fps). Therefore, you may need to alter the code to match your source and output rates. You will need to change these numbers

num:30,den:16

A "return" statement is not needed. If omitted "last" is used.

Everything else in the function is hard-wired as well. You would be better served by taking code from the documentation and using that, but feed to that code the settings I used in my function.
johnmeyer is offline   Reply With Quote
Old 16th August 2013, 22:38   #38  |  Link
Boffee
Registered User
 
Join Date: Oct 2011
Location: Worthing, UK
Posts: 24
I must be missing something. I had already changed num to 25 and den to 18 for PAL, but same result no change in speed. Tonight I have put this into a script on its own.

avisource="E:\Cine Capture\1977\Band on the march.avi"

LoadPlugin("Plugins/svpflow1.dll")
LoadPlugin("Plugins/svpflow2.dll")

function SmoothFPS2(clip source, threads) {
super_params="{pel:2,gpu:1}"
analyse_params="""{
block:{w:16,h:16},
main:{search:{coarse:{distance:-10}}},
refine:[{thsad:200}]
}"""
smoothfps_params="{rate:{num:25,den:18,abs:false},scene:{mode:0,limits:{scene:8500}},algo:21,cubic:1}"
threads = 5

super = SVSuper(source,super_params)
vectors = SVAnalyse(super, analyse_params)
SVSmoothFps(source, super, vectors, smoothfps_params, url="www.svp-team.com", mt=threads)
}

Result from Avisynth is error "not a clip"
Virtualdub says "scripts return value is not a video clip".


I have also tried the script included with the SVP documentation which works absolutely fine on the same source clip, get 25fps output, just don't seem to be able to get it to work as part of your cine script.
Probably the answer is simple, just can't figure it out, sorry.
Boffee is offline   Reply With Quote
Old 16th August 2013, 23:40   #39  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Code:
# LoadPlugin("Plugins/svpflow1.dll")    # Are you storing the script in the Avisynth directory? Don't do that; it's better to create a dedicated project directory.
# LoadPlugin("Plugins/svpflow2.dll")    # And the plugins and scripts in the "Plugins" directory are automatically loaded.


AVISource("E:\Cine Capture\1977\Band on the march.avi")




function SmoothFPS2(clip c, threads) { 
        super_params   = "{pel:2, gpu:1}"
        analyse_params = """{
                block  :  {w:16, h:16}, 
                main   :  {search:{coarse:{distance:-10}}},
                refine :  [{thsad:200}]
        }"""
        smoothfps_params = "{rate:{num:25, den:18, abs:false}, scene:{mode:0, limits:{scene:8500}}, algo:21, cubic:1}"
        threads = 5
        super   = c.SVSuper  (super_params)
        vectors = c.SVAnalyse(super, analyse_params)
        c.SVSmoothFps(super, vectors, smoothfps_params, url="www.svp-team.com", mt=threads)
}

Last edited by creaothceann; 16th August 2013 at 23:42.
creaothceann is offline   Reply With Quote
Old 16th August 2013, 23:43   #40  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
avisource="E:\Cine Capture\1977\Band on the march.avi"

LoadPlugin("Plugins/svpflow1.dll")
LoadPlugin("Plugins/svpflow2.dll")
Your script has two problems.

Problem #1: Your script has to call the function, but it doesn't.
Problem #2: When you use a variable to hold your video, you must refer to that variable in subsequent calls, and must explicitly return the variable you use for the final video result using the "return" statement.

Therefore, your script should be:

Code:
LoadPlugin("Plugins/svpflow1.dll")
LoadPlugin("Plugins/svpflow2.dll") 
threads=1
avisource="E:\Cine Capture\1977\Band on the march.avi"
newvideo = SmoothFPS2(avisource,threads)
return newvideo
The function itself should follow this code, as you already did in the script you posted above.
johnmeyer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.