View Full Version : Capturing and restoring old 8mm films


videoFred
24th September 2012, 07:40
Hello everybody,

Original thread:
http://forum.doom9.org/showthread.php?t=144271

The original thread is getting a bit heavy, so I tought to start up a new thread. In this thread we can perhaps discuss the used Avisynth restoring methods some more in detail.

I have recently upgraded my 8mm film transfer system. A new and better IMI machine vision camera and a custom made RGB Led backlightsource and capture software, both developed and build by Frank Vine.
www.cine2digits.co.uk

For the restoring I have used my film restoring script but I had to modify it for this specific source. For example I have used some hue color corrections. You can see the effect in the blue sky, the skintones and in the vegetation.

Example clip:
https://vimeo.com/49963017

Your feedback is welcome,
many greetings from Belgium,

Fred.

johnmeyer
24th September 2012, 17:29
Fred,

I think it is wonderful that you are continuing to improve your transfer system and also improve the post-production techniques, including your script. Many people abandon these projects after their initial effort.

Since you are starting a new thread, and since you want to discuss possible areas for improvement in the script, let me make a few comments about the before/after video you posted. As you know, I have used your script, with a few variations of my own, for several years now. I mention this because what I am about to write below could be seen as negative, but I think you will understand that my intention is to be constructive, and to point out those areas that I still think need improvement.

1. Water. One of the problems in both the MDegrain and also RemoveDirt sections of the script is that they deconstruct waves, flowing water, and other similar "watery" structures. If you go to the 0:20 mark in your video and look at the middle upper part of the little waterfall (concentrate on the bright upper part of the middle section), not only is there a green shift, but there is a loss of a lot of subtle structure in the water, most notable in the whitest parts of the water. I have seen this so often that I no longer use your original script on any scenes that contain open or running water.

2. Blue Sky. I have pretty much given up using the color correction in your original script (the "coloryuv(autowhite=true)" setting), although once in awhile it does help correct color casts that I cannot correct any other way. If you look at the blue skies in the various scenes in the clip, you will see a definite turquoise (blue-green) shift. The original blue colors appear much closer to correct. There is also a shift towards green in some of the white highlights in all the scenes in the clip. I use the Spyder colorimeter to color calibrate my display, so I think I am viewing the colors correctly, although as most people know, color is extremely difficult to get right.

3. Gamma correction. It appears that you may have improved the gamma correction algorithms. The street scene taken from overhead (at about 0:14) has wonderful improvement in the shadows. I will be interested to know what you have done to get that improvement. As anyone who has transferred film knows, this is one of the toughest things to get to look good, especially if you use a stock video camera for capturing.

4. Clouds. This is actually probably the same issue as what I described with the water, but if you look at the clouds at the 0:24 mark, you will see that a lot of subtle structure and detail in the dark part of the clouds has disappeared. One of the issues here is grain removal. I have done a lot of noise reduction over the past ten years, and one thing I have noticed is that noise (and grain) impart a certain artificial sense of detail, even where none existed. Part of this is psychological, but part of it may be due to the fact that all these "dancing artifacts" do tend to form real details via their movement, and eliminating that movement reduces the details. Once again, the problem is most evident in "objects" that have very little fine structure or detail. On the other hand, objects with lots of detail -- like buildings, flowers, people's faces -- look spectacularly better after treatment with the script. The flowers at 0:28 look unbelievably good. Nice job!

5. Streets. This is similar to the water and clouds, but it happens so often in my film transfers that I have noted the problem many times. You'll see it in the scene starting around 1:09. At first, all most people will see is the remarkable improvement on the external structure around the building in the background. Good stuff! But then, if you start to look at the road in front of the car, you'll notice that almost all the detail and "depth" has been eliminated. It almost looks like what happens if you take a little water and smear it over a watercolor painting, blending all the details together.

The scene that follows, with the tops of the railway cars, shows both the positives and negatives: at times the details are improved, and at other times, especially on the tops of other cars, the details seem to be obscured. This scene actually may hold some clues as to how we might build a better script because the detail on the tops of most of the cars seems to have been improved, whereas the details on one or two seem to have been diminished.

6. Motion stabilization edge loss. The depan motion stabilization works exceedingly well. I own Mercalli and have written extensively about Deshaker, so I have had a lot of experience using these tools. You have done a great job discovering the right settings for Depan. However, one area of improvement would be to find a way to use Deshaker or some other tool that preserves the edges so that we don't lose so much of the frame due to the zooming needed to hide the moving black edges introduced by the motion stabilization. I have justified this because the motion stabilization, IMHO, is one of the two biggest improvements the script provides (the other being dirt removal), and because my capture systems (like yours) capture the entire frame of film (the gate has been removed) so all that is being discarded is the part of the film that probably would have never been seen during normal projection. Still, it is sad to see all this information discarded ...

So, in summary, the areas of improvement I would like to work on would include (more or less in order of importance):

1. Better color correction.
2. More natural (or less aggressive) grain removal that doesn't harm detail in water, roads, and clouds.
3. Better gamma correction (which you seem to have already achieved -- I just want to know how you did it!)
4. Deshaking that preserves borders.

I don't have any ideas for #1. I think #2 may mostly be a matter of finding better settings for the existing plugins. #3 you have already achieved, but I hope you can explain how you did it. And, #4 will probably mean incorporating Deshaker, something that may be more bother than it is worth, given the two-pass nature of the approach that program takes.

RCBasher
24th September 2012, 18:04
Hi John,

The better gamma is down to the larger pixels in the IMI camera (6.45um) and my RGB lighting system which optimises the full well depth of the sensor.

Hope this helps to explain.

Frank

EDIT Should also add that in-camera gamma is done before dropping to 8-bit output.

johnmeyer
24th September 2012, 18:28
The better gamma is down to the larger pixels in the IMI camera (6.45um) and my RGB lighting system which optimises the full well depth of the sensor.I'm sure that the camera is doing a great job, and having direct control over the sensor makes a huge difference.

However, my comments were based on looking on the differences between the left (before the script changes) and right (after the script changes) images in the video Fred linked to. The left is the capture from your camera, and it looks pretty good, but the right image has much better gamma, with far brighter midtones and a little more brightness in the deep shadows. It is this change, which was done in the script and not in the camera, that I was referring to. I'd love to know what plugin and settings Fred used to achieve these differences.

Now, if you are saying that the image on the right side was taken with a different camera than those on the left side, then I did not understand what Fred was trying to show, and I should probably delete my entire previous post.

videoFred
24th September 2012, 18:44
Hi John,

Thank you for examining my work in detail!

- Water - clouds- streets: I agree about the loss of detail caused by the heavy grain reduction. Actualy I have already made a few scripts without MVDegrain. But this specific footage needed a lot of additional sharpening. And with this amount of sharpening, the grain especialy in the blue sky became annoying.

- Gamma: like Frank says: this camera/lightsource setup is capable to get nearly everyting out of the film. Even when captured relative dark, the information is still there and it's easy to make it more visible with levels(0,1.2,255,0,255) for example. But I have used a little trick here: levels(0,1.6,255,0,255) followed by autolevels(output_low=6, output_high=250) This gives almost a HDR effect on some scenes.

- Color correction: this is a tricky one because personal taste can play here and all computer systems are different. So I do not know if you see the same colors as I do.

I have used this for the color correction:
.tweak(sat=1.1, hue=0, starthue=10, endhue=169)\
.tweak(sat=1.0, hue=0, starthue=20, endhue=104)\

.tweak(sat=1.1, hue=0, starthue=170, endhue=280)\
.tweak(sat=1.1, hue=0, starthue=170, endhue=229)\

.tweak(sat=1.3, hue=-4, starthue=280, endhue=360)\
.tweak(sat=1.1, hue=-3, starthue=288, endhue=308)

With other sat and hue values we can make a complete different picture. So it's realy a matter of personal taste.

- Deshaking and cropping the borders: Personal I do not mind so much about that. Of cource I try to keep this as low as possible.

Fred.

videoFred
24th September 2012, 18:49
Now, if you are saying that the image on the right side was taken with a different camera than those on the left side, then I did not understand what Fred was trying to show, and I should probably delete my entire previous post.

Please leave your interesting post. :)

The right side was not taken with a different camera, I can assure you. The trick is to have max. information in the original even when it appears to look dark on the first sight.

Fred.

johnmeyer
24th September 2012, 19:00
Fred,

Thanks for sharing the settings for gamma correction and color correction. I have a big transfer project which I will start within the next week, as soon as the film arrives. I'll use your ideas to tweak my version of your script and report back on any improvements I am able to make.

videoFred
24th September 2012, 19:04
Yes, please report back John, we are all learning from each other. Someone has posted different versions of RemoveDirtMC() in the other thread. Have you tried them?

Fred.

johnmeyer
24th September 2012, 19:12
Someone has posted different versions of RemoveDirtMC() in the other thread. Have you tried them?No, I missed that thread. I'll see if I can find it.

RCBasher
24th September 2012, 19:16
However, my comments were based on looking on the differences between the left (before the script changes) and right (after the script changes) images in the video Fred linked to.
Even when captured relative dark, the information is still there and it's easy to make it more visible with levels(0,1.2,255,0,255) for example.

It is also worth to keep in mind that the left hand image is not the actual original, it has been downsized and compressed for showing on Vimeo.

johnmeyer
24th September 2012, 20:29
Well, I searched but could not find the thread talking about improvements to the RemoveDirt function. Hopefully my film restoration skills are better than my forum searching abilities :)

John

videoFred
24th September 2012, 20:30
It is also worth to keep in mind that the left hand image is not the actual original, it has been downsized and compressed for showing on Vimeo.

I had to downsize and compress it for Vimeo of cource, but there's another reason for the downsizing too: VDub did not accept the stackhorizontal() comparison clip in full 2776 x 1036 size.

Fred.

videoFred
24th September 2012, 20:36
Here it is John:

http://forum.doom9.org/showthread.php?t=164154

Fred.

johnmeyer
24th September 2012, 20:50
Thanks! I'll see what I can do with that information in my upcoming projects.

johnmeyer
12th October 2012, 22:22
Two years ago, I posted an alternative to VideoFred's wonderful film restoration script:

Alternative Script (http://forum.doom9.org/showthread.php?p=1406847#post1406847)

My main goal was to improve performance by using MVTools2 instead of MVTools, and also by using multi-threading. I made many other changes as well, all of which are documented in that original script, which you can read by clicking the link above.

Since that time, Fred has provided many updates and improvements to his script, but I haven't shared any of my changes. However, now that Fred has started this new thread, I thought it might be useful to share my latest script. All of my work is based on what he has done, but I continue to focus on performance, as well as to improve dirt removal which, along with motion stabilization, is one of the most important restoration steps in improving old amateur film.

Most of the changes are documented in the comments at the beginning of the script (see my next post), but let me provide a few additional details.

Performance

I took Fred's latest script, and set both input and output speed to 16 fps; set dirt removal to 23; and set block size to 4 (you need this small block size to avoid having small "structure" disappear). I used the Result=4 mode, which does not provide any autolevel or autocolor correction (more on this below).

I set my new and old scripts to the same settings, and then fed the same clip to Fred's script, to my original script, and to my new script. I then ran the "video analysis pass" in VirtualDub and recorded the average fps shown in the progress dialog. Here are the results on my 3.2 GHz Intel i7-965 computer (I used six threads in my multi-threaded scripts):


Fred's latest script: 3.3 fps
My original script: 8.5 fps
My latest script: 15.2 fps


Dirt Removal

In addition to being twice as fast as what I previously posted, my newer script does a much better job of removing dirt because it uses the more sophisticated two-step motion estimation process which has been posted many times in this forum by some of the doom9 "gurus." I spent quite a bit of time (many hours) comparing various pre-filters, and also working on all the other settings. I also used the following test clip to make sure that fine details were not being removed:

Fine Detail Test Clip (http://dl.dropbox.com/u/1561578/Fine%20Structure%20Test.avi)

It is a real challenge to remove dirt and reduce grain, without also removing the wires that suspend the riders on this old spinning amusement park ride. It is a very useful test clip.

Auto Correction

Fred has made many changes to improve autolevels, autocolor, and motion stabilization. I tried his auto correction improvements, but did not get good results with my film transfers. One reason for this is that Fred uses an amazing custom camera that gives him much different gamma and color than what I get using my Sony FX-1 HDV camcorder as the capture device. Also, I have found that every attempt at doing these corrections automatically almost never works across the huge variations that I get in really old amateur film, all of which suffers from poor development, bad storage (which results in non-uniform fading of each of the three color layers), fogging (from inserting or removing the film cartridge in direct daylight), and many other similar mishaps. I have found, unfortunately, no substitute for manual correction inside my video editing program (Sony Vegas).

So, in my script, I still incorporate the old levels and color correction, but I seldom actually use them.

Also, I did not get much improvement with Fred's newer motion stabilization parameters. I have actually reduced the amount of Depan that I use because if I really need to do serious stabilization, I do that in Vegas using either Deshaker or Mercalli. Therefore, my use of Depan is only to remove film gate weave and minor camera movement. I find limiting Depan to small corrections lets me keep more of the original frame, and when I really need stabilization, both Deshaker and (to a lesser extent) Mercalli provide edge restoration so that no border cropping is done.

Performance "Secrets"

How did I achieve better performance, while still improving quality? Here are the changes (see notes in the script for version numbers of various plugins):

1. Use newer version of MVTools2 that was compiled for the SVP project.

2. Use better MT version of AVISynth (2.60, Aug 28, 2012, Ben Rudiak-Gould)

3. Change motion compensation to two-step process, with first step using large block size. This improves quality, while also providing a slight improvement in performance.

4. Use SSE versions of RemoveDirt and RemoveGrain (I don't know why I didn't do this before ...)

5. Moved the autolevels calls inside of a non-multithreading section, and made sure they were near the end of the script (thanks to Didée for this insight).

Read the script changelog below for the full list.

Frame Interpolation

I have provided a different approach to creating interpolated frames, for those who want to change 16, 18, or 24 fps progressive film to 25p, 30p, 50i, 60i, or 60p video. I do this via SubJunk's excellent InterFrame2.avsi script which in turn uses SVP's SVSmoothFps function. This provides both performance and quality advantages compared to using the old MVTools and BlendFPS technology. I personally don't use this function very often, so I only include it as a commented-out section of code, rather than taking the time to provide a more elegant method of enabling/disabling this feature. However, it does work, and works well.

Bad Frame Removal

I also included the "filldrops" function which was first created by MugFunky many years ago. I use this in conjunction with my editing program. In my editing program, when I have a bad frame (from a projector burn, bad splice, sprocket jump, etc.) I use a macro to replace that frame with a duplicate of the previous frame. I then enable this function (remove the comment). The function passes through all normal frames, but when it detects a duplicate, it replaces that with a motion-estimated frame. Here is an example of what can be done:

Restoration of Jumpy Film (http://www.youtube.com/watch?v=uzMFodrGHDs&list=PL230DED9513ECA2CB&index=2&feature=plpp_video)

It is a labor intensive process, but the results are pure magic.

Issues

Many of the plugins used pre-date the SetMTMode() approach to multi-threading in AVISynth. It is actually remarkable that they work at all and, unfortunately, while they do work, stability can be an issue. I have found that if I need to jump ahead in VirtualDub or seek backwards, that I often get crashes. The "solution" is to temporarily comment out the SetMTMode() calls.

I have tried to figure out if a "Distributor()" call might help, but I cannot for the life of me figure out where or how that is supposed to be used, and was not able to fix stability problems by adding that call. I also have tried various SetMemoryMax values, and sometimes that will change the point at which instability occurs, but it really doesn't solve anything permanently.

So, multi-threading in AVISynth is what it is, and this script does work for me, but YMMV, and you should be prepared to change the "threads" variable and also the MemoryMax setting.

Summary

So, as you can tell, I made many of these changes because of a difference in equipment, difference in workflow, and different set of criteria than what Fred had in his work. I think I have achieved better performance and better dirt removal, but other than that, I make no claims that my work is "better" than what Fred has done. We are each dealing with different source material, and each of us has a different aesthetic we are trying to achieve: for instance, I want to retain more of the look of film, so I do less grain reduction and sharpening, and don't usually do motion-estimated frame interpolation.

I offer this to Fred and to everyone else in the hope that perhaps we can collectively move forward and continue to improve transfer and restoration of old movie film stock.

Many thanks not only to Fred, but to all the other people in this forum who have provided the tools and techniques that make all of this possible.

The script follows in the next post.

johnmeyer
12th October 2012, 22:23
# film restoration script, based on work by videoFred.
# denoising, resizing, stabilising, sharpening, auto-levels and auto-white balance.
#
# Changes made by John Meyer on October 10, 2012
#
# 1. Modified RemoveDirtMC function to do estimation in two steps. This improves performance and quality.
# 2. Modified MDegrain to do estimation in two steps. This provides roughly the same quality with blocksize=8
# as what I was getting with blocksize=4, but with virtually no performance penalty
# 3. Updated to use special build of MVTools2 that works with SVP.
# 4. Moved Autolevels inside special multi-threading section in order to improve performance with autolevels.
# 5. Removed all trim commands because I do all editing outside the script (in Vegas).
# 6. Included InterFrame. The InterFrame script is better than MFlowXXX.
# 7. Reduced default horizontal depan setting to 5. If "real" stabilization is need for really shaky film, then I do
# stabilization prior to using the script, using either Deshaker or Mercalli. Depan is great for small camera shakes and most importantly
# for removing "gate weave" inherent in film. However, I don't think it works too well as a general-purpose stabilizer.
# 8. Still to do: Improve multi-threading stability (change memorymax and reduce threads variable if script crashes). If you can't goto
# a specific frame without crashes, then comment out all SetMTMode() commands. A "distributor()" statement might improve stability
# when scrubbing, but I doubt it. The problem is that too many of these plugins were not built with MT in mind. The script seems
# to perform very well, however, if you just load and then only go forward (or render). The problems general happen only when "jumping"
# ahead in large intervals.
#
# Changes made by Meyer (June 8, 2010):
# 1. Replaced the MVDegrainMulti function, which was part of the original MVTools
# with the equivalent function using the newer and faster MVTools2.
# 2. Added RemoveDirt function prior to Degrain in order to eliminate large dust spots. This
# substantially improves the dirt removal capabilities of this script. The user will need to
# download this plugin at:
# http://www.removedirt.de.tf/
# 3. Eliminated a great deal of sharpening. The original script did sharpening in at least four places.
# With grainy film stock, this sometimes created objectionable grain. Also, the limitedSharpenFaster
# function, while excellent for video, is uncessarily slow, and isn't really needed for this low
# resolution source. Too much sharpening can make the film look too much like video.
# 4. Added multithreading. I was able to roughly triple the script performance. It may be possible to
# substantially increase this, perhaps as much as 12x instead of 3x. However, the autolevels function
# would have to be replaced (see notes above, for changes made in 2012).
# 5. Fixed several things I found. The result3 option didn't have the manual color correction code, so I
# added that back in. All the numbered "stab" variables (stab1, stab2, etc.) aren't needed except
# for providing a test function for stabilization. I eliminated all of this to streamline the script.
# 6. Deflicker seemed redundant, given all the averaging that takes place with MDegrain, and also the averaging
# that is done when the autolevels outputs are selected. I include that as a "commented out" option.
# 7. I reduced the number of frames used for averaging autolevels from the default (which is 5) to 2.
# I probably should add a variable in the header so the user can change this. Something else to do
# in the future ...
# 8. I added yet another set of crop parameters. I did this because both my capture and my output are
# done using NTSC DV AVI which is 720x480. However, 8mm film is almost exactly square, so the captured
# 720x480 video has black bars on the side. These need to be cropped off prior to doing motion
# stabilization, but then added back prior to the final output, which must still be 720x480 with the
# black bars on the side.
# 9. I reduced the default depan settings to 20, which is what was recommended in the original script. I
# also reduced the post-depan cropping. I did this so I could keep as much of the original frame
# as possible.
# 10. I removed the second denoising and sharpening function. It just seemed to be too much, and made the
# result too artificial
# 11. I removed the MVFLowFPS interpolation. I did this during one of dozens and dozens of attempts
# to improve the speed of the script. I should probably add this back, but if I do so, I also
# need to make it work correctly for interlaced output. If the goal is to show this on an NTSC or PAL
# television set, then it is not correct to convert from the film fps to 25 fps progressive (PAL) or
# 29.97 fps progressive (NTSC). Instead, this should be done as follows (example given is NTSC):
#
# MFlowFPS(source,super,backward_vec, forward_vec, num=60000, den=1001,ml=200)
# SeparateFields()
# SelectEvery(4, 0, 3)
# Weave()
#
# This yields interlaced 29.97, which has twice the temporal resolution as 29.97 progressive, and will
# therefore look correct on a TV set. I have done a lot of this as part of my Kinescope to video
# conversion scripts. For those scripts, the goal is to make the filmed version of a TV show look
# like it was actually videotaped. However, for something that originated on film, this "does violence"
# to the original feel of the media. It is true that it can make horizontal pans less "juddery," but
# it won't feel like film anymore. Also, this technique does break down, espcially with fast motion
# in the foreground.
# 12. Removed the unecessary "coloryuv(off_U=blue,off_V=red)" statement from the denoising section.
# 13. Added killaudio() statement to prevent lockups when using SetMTMode().
#
#====================================================================================

johnmeyer
12th October 2012, 22:23
#VIDEO FILE
#----------------------------------------------------------------------------------------------------------------------------
#Change the following line to point to your video file
film="e:\fs.avi"


#GENERAL PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="result4" #specify the wanted output here; valid results are "result1" through "result4" and "resultS1" through "resultS4" for before/after
play_speed=16 #play speed (8mm=16; Super8=18; 16mm sound=24)


#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.0 #for all outputs
gamma=1.0 #for all outputs
blue= -0 red=-0 #manual color adjustment, when returning result3 & result4. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 #manual levels, when returning result2 & result4


#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=16 CTop=16 CRight=16 CBottom=16 #crop values after Depan and before final resizing
W=720 H=480 #final size after cropping
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150
in_bord_left=0 in_bord_top=0 in_bord_right=0 in_bord_bot=0 #Borders around input that must be removed


#STABILISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=05 #maximum values for the stabiliser (in pixels) 20 is a good start value
maxstabV=20
est_left=40 est_top=40 est_right=40 est_bottom=40 #crop and contast values for special Estimate clip
est_cont=1.6

#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
#Fastest parameters
#denoising_strength=600 #denoising level of first denoiser: MVDegrain()
#denoising_strength=300 #denoising level of first denoiser: MVDegrain()
#block_size= 16 #block size of MVDegrain
#block_size_v= 16
#block_over= 8 #block overlapping of MVDegrainMulti()

#Best compromise between speed and quality
denoising_strength= 600 #denoising level of first denoiser: MDegrain()
block_size= 8 #block size of MVDegrain
block_size_v= 8
block_over= 4 #block overlapping of MVDegrainMulti()

dirt_strength=23 #sets amount of dirt removal (big spots)


#FOUR STEP SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
PRE_sharp_ness= 120 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
Sharp_Strength= 0.1


#AUTO LEVELS PARAMETER
#--------------------------------------------------------------------------------------------------------------------------------
X=4 #X is a special parameter for reducing the autolevels effect on the whites
X2=4 #X2 is a special parameter for reducing the autolevels effect on the blacks


#NUMBER OF THREADS
#--------------------------------------------------------------------------------------------------------------------------------
threads=5


# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================

# Using AVISynth version 2.60, build August 28, 2012 (Ben-Rudiak-Gould, etc.)
# Using VirtualDub 1.8.6

#Change the following (lower or higher) if you have stability problems with multi-threading
SetMemoryMax(800)

#Load plugins explicitly
LoadPlugin ("mvtools2.dll") #Version 2.5.11.9 2/24/2012
LoadPlugin("autolevels.dll") #Version 0.6.0.0 1/09/2011
LoadPlugin("Deflicker.dll") #Version 0.4.0.0 8/16/2004
Loadplugin("Depan.dll") #Version 1.10.0.0 4/09/2007
LoadPlugin("DepanEstimate.dll") #Version 1.9.2.0 3/25/2007
Loadplugin("mt_masktools.dll") #Version 2.0.23.0 3/14/2008
loadplugin("RemoveDirtSSE2.dll") #Version 0.9 5/05/2005
Loadplugin("RemoveGrainSSE2.dll") #Version 0.9 5/01/2005
Loadplugin("warpsharp.dll") # 4/05/2010

#Use the following for alternative frame interpolation
#loadplugin("svpflow1.dll") #Version 1.2.1.0 5/29/2012
#loadplugin("svpflow2.dll") #Version 1.3.1.0 6/02/2012
#Import("InterFrame2.avsi") #Version 2.1.0 6/27/2012

#Open and crop the video
#Remove all setmtmode statements (there are four in this script) if not using multi-threaded (MT) AVISynth
setmtmode(5,threads)
source1= Avisource(film).killaudio().assumefps(play_speed).converttoYV12() #killaudio() improves stability (in my experience -- others disagree)
cropped_source=source1.crop(in_bord_left,in_bord_top,-in_bord_right,-in_bord_bot) #temporarily remove any black borders on input video
setmtmode(2)

#cropped_source=filldrops(cropped_source) #Use this when removing bad frames that have been removed by duplicating previous frame
#(see notes in function at end of script)

#STABILIZING
#....................................................................................................................................................................
stab_reference= cropped_source.crop(est_left,est_top,-est_right,-est_bottom).tweak(cont=est_cont).MT_binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15)

#Alternative line that includes deflicker. I find that this usually is not needed.
#stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker()


#DENOISING
#...................................................................................................................................................................

#Remove dirt
input_to_removedirt=stab.crop(CLeft,CTop,-CRight,-CBottom)
stabcrop=RemoveDirtMC(input_to_removedirt,dirt_strength,false)

#Reduce grain
prefiltered = RemoveGrain(stabcrop,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super= MSuper(stabcrop, hpad=32, vpad=32,pel=2)

halfblksize= (block_size>4) ? block_size/2 : 4
halfoverlap= (block_over>2) ? block_over/2 : 2

bvec1 = MAnalyse(superfilt, isb = true, delta = 1, blksize=block_size, overlap=block_over,dct=0)
bvec1 = MRecalculate(super, bvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

fvec1 = MAnalyse(superfilt, isb = false, delta = 1, blksize=block_size, overlap=block_over,dct=0)
fvec1 = MRecalculate(super, fvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

bvec2 = MAnalyse(superfilt, isb = true, delta = 2, blksize=block_size, overlap=block_over,dct=0)
bvec2 = MRecalculate(super, bvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

fvec2 = MAnalyse(superfilt, isb = false, delta = 2, blksize=block_size, overlap=block_over,dct=0)
fvec2 = MRecalculate(super, fvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

denoised=stabcrop.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)


#SHARPENING
#...................................................................................................................................................................
sharp1=denoised.sharpen(Sharp_Strength)
PreBorderFrame = sharp1.Lanczos4Resize(W - bord_left - in_bord_left - bord_right - in_bord_right, H - bord_top - in_bord_top - bord_bot - in_bord_bot)


#FRAME INTERPOLATION (optional)
#...................................................................................................................................................................

#Interpolate frames
#Use this for progressive output -- example shows 29.97 progressive
#PreBorderFrame=InterFrame(NewNum=30000,NewDen=1001,PreBorderFrame,GPU=true,Cores=threads)

#Use this for interlaced output -- example shows 29.97 interlaced
#PreBorderFrame=InterFrame(NewNum=60000,NewDen=1001,PreBorderFrame,GPU=true,Cores=threads).SeparateFields().SelectEvery(4, 0, 3).Weave()


#RESULT1: AUTOLEVELS,AUTOWHITE
#......................................................................................................................................................................
SetMTMode(5) #Turn off SetMTMode for Autolevels
result1= PreBorderFrame.coloryuv(autowhite=true).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)

#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result3= PreBorderFrame.coloryuv(off_U=blue,off_V=red).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
SetMTMode(2) #Re-enable SetMTMode after Autolevels

#RESULT2: MANUAL LEVELS, AUTOWHITE
#......................................................................................................................................................................
result2= PreBorderFrame.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)

#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result4= PreBorderFrame.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)


#PARAMETERS FOR THE COMPARISONS
#.....................................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
source4=Lanczos4Resize(source1,W2,H2)


#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"manual colors and levels correction",size=28,align=2))

#Finish and go home
Eval(result)


# END SCRIPT, BEGIN FUNCTIONS
#=================================================================================================================================


#REMOVE DIRT FUNCTION
#......................................................................................................................................................................
function RemoveDirt(clip input, int "limit", bool _grey)
{
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
}

#This function provides motion compensation for the remove dirt function, thus improving quality.
function RemoveDirtMC(clip,int "limit", bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)

prefiltered = RemoveGrain(clip,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super=MSuper(clip, hpad=32, vpad=32,pel=2)

bvec = MAnalyse(superfilt,isb=true, blksize=16, overlap=2,delta=1, truemotion=true)
fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)

bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=100)
fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=100)

backw = MFlow(clip,super,bvec_re)
forw = MFlow(clip,super,fvec_re)

clp=interleave(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}

# The following function will remove near duplicates ("0.1") or exact duplicates (change to "0.0").
# It replaces these duplicates with a motion estimated frame. It works really well (IMHO).
#
# Use: In your video editor, replace any single bad frame (burned frame, jump, missing frame from splice, etc.) with a duplicate of the
# previous frame. Then, include a call to this function (see script above, where it is commented out).
#
# Here's an example of how this function can be use:
#
# http://www.youtube.com/watch?v=uzMFodrGHDs
#

function filldrops (clip c)
{
super=MSuper(c,pel=2)
vfe=manalyse(super,truemotion=true,isb=false,delta=1)
vbe=manalyse(super,truemotion=true,isb=true,delta=1)
filldrops = mflowinter(c,super,vbe,vfe,time=50)
fixed = ConditionalFilter(c, filldrops, c, "YDifferenceFromPrevious()", "lessthan", "0.1")
return fixed
}

fpp
13th October 2012, 13:38
The sum total of know-how and experience contained in this handful of posts is incredible, and so are the results. Thanks to all for sharing them !

I must definitely make the trip to Belgium someday, to see Fred's new wonder machine :-)

videoFred
15th October 2012, 06:47
Hi John,

Thank you for all the work and for sharing.

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.

Anyhow, you have some very interesting ideas about speeding up everything. At this moment, I'm working on a faster script myself, without heavy degraining, but still with RemovedirtMC().

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?

many greetings,
Fred.

Gargamel
15th October 2012, 12:04
Thank you, videoFred and johnmeyer: no doubt that our transfers will again improve a lot. Everybody reads each of your posts with greed !

Bonjour fpp ! Tres heureux de te lire aussi. Tu devrais organiser un petit "week-end du transfert" a Gand, preside par Fred ! Il y aurait foule. ;-)))

smok3
15th October 2012, 12:06
Example clip:
https://vimeo.com/49963017


amazing!

johnmeyer
15th October 2012, 18:39
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.

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.

matfra
19th October 2012, 16:51
Hey Fred.
Is it possible to have you script run in MT mode.
How can I do it. It is crashing for me

johnmeyer
19th October 2012, 17:18
Is it possible to have you script run in MT mode. How can I do it. It is crashing for meMy 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
19th October 2012, 18:31
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:

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.

matfra
20th October 2012, 00:03
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
20th October 2012, 14:18
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)

videoFred
22nd October 2012, 06:24
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.


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.

wesbc
9th November 2012, 06:36
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

johnmeyer
9th November 2012, 08:20
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 (http://8mmforum.film-tech.com/)

digitap
3rd December 2012, 15:54
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!

johnmeyer
3rd December 2012, 18:01
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 (http://gopro.com/3d-cineform-studio-software-download/)

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:

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.

digitap
3rd December 2012, 20:28
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.

Guest
3rd December 2012, 21:14
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().

johnmeyer
4th December 2012, 02:34
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.

Boffee
16th August 2013, 08:02
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

johnmeyer
16th August 2013, 16:47
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.

Boffee
16th August 2013, 22:38
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.

creaothceann
16th August 2013, 23:40
# 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)
}

johnmeyer
16th August 2013, 23:43
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:

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.

Boffee
18th August 2013, 17:37
Thanks. At last I have got this to work as a stand alone script.

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

threads=1
myclip=avisource("your video.avi").ConvertToYV12()
smooth_video = SmoothFPS2(myclip, threads)
return smooth_video

#followed by function SmoothFPS2 etc as shown in post 25

creaothceann
18th August 2013, 18:33
In short...

AVISource("video.avi").ConvertToYV12.SmoothFPS2(1)

tonydokter
1st October 2013, 00:42
hello everyone I was wondering if anyone of you have made a wetgate for there capture device and if so could thy explain how they did it. Mybe show some examplesor alink to a page

Gerald1937
11th November 2013, 16:43
Having learned much from the thread on restoring 8mm film using Avisynth and contributed to it a few times too, my endeavour has been to get the highest quality stop motion digtal capture I could from the source film to use as the feed into Fred's script. This new thread on capturing seems an appropriate place to post information on the system I developed for making my captures. I hope it helps to stimulate ideas on methods of film transport for stop motion capture. Alas at 76 new ideas do not come to me so frequently anymore.

My design, shown at www.mets-telecinesystem.co.uk ,seeks to:-

Be economic by the re-use of equipment I already owned where practical.

Eliminate both horizontal and vertical jitter during capture and to develop the techniques to measure and analyse the performance obtained.

Investigate the factors that affect the speed of stop motion capture and how these can be measured. This includes the significance of shutter type used, global or rolling, on video camera delay and how I measured it.

The capture method I used to get good captures from worn/damaged film.

The use of digital blending to capture the detail in both highlights and shadows on the film during capture.

The web page includes a "How it is made" section and a PDF file for those wanting better quality resolution and drawings that should print to size.http://www.mets-telecinesystem.co.uk

Regards
Gerald1937

Boffee
26th December 2013, 11:23
I have a problem with the John Meyer script in post #17 which seems to be related to mvtools2.dll. Everytime I run the script with avisynth & Virtualdub, the latter crashes on exit with " out-of-bounds memory access (access violation) occurred in module 'ntdll'". If I use an old mvtool2.dll version from Fred's script plugin folder, version 2.4.2, then all is OK. Any ideas?

johnmeyer
26th December 2013, 16:53
I have a problem with the John Meyer script in post #17 which seems to be related to mvtools2.dll. Everytime I run the script with avisynth & Virtualdub, the latter crashes on exit with " out-of-bounds memory access (access violation) occurred in module 'ntdll'". If I use an old mvtool2.dll version from Fred's script plugin folder, version 2.4.2, then all is OK. Any ideas?Comment out all "SetMTMode()" statements and see if it works. This will substantially reduce performance, but it will help zero in on the problems.

You can also try changing the SetMemoryMax() values.

Finally, check the versions of the various plugins you are using and make sure they match the versions shown in the script.

Boffee
26th December 2013, 20:23
Ok commented out setMTmode statements and changed set memory, but no difference. Plugins are OK except for warpsharp. I can only find a version for 2008. Apparently a warpsharp problem is already known, see http://forum.doom9.org/archive/index.php/t-68947.html. Loaded LoadPluginEx.dll, but did not fix the problem. If I use Fred's download package then all is OK, probably why he uses these specific ones. Guess I will have to use these.

bhershey
30th December 2013, 19:44
I'm so impressed with the results from Fred's script and also with John's modifications I'm going to use one of them in our post production workflow at my media transfer company.

I'll use VDub in distributed batch mode and get all the film transferred each day processed overnight and ready for builds by the next morning.

Fred's script works great out of the box, but I want to try John's code to take advantage of the speed improvements.

I'm getting an error on exit that will prevent any batch operations... "An out-of-bounds memory access (access violation) occurred in module 'ntdll'". I've tried everything already suggested and all versions match what is listed in the code. error log file is below.

The error goes away when using the older version of mvtools2.

I also get the same error at startup if I alter the "Auto Levels Parameters" X and X2 to any other numbers.

I'll be glad to work with the author to troubleshoot.

Thank you Fred and John!!!

Brian

VirtualDub crash report -- build 30009 (release)
--------------------------------------

Disassembly:
76ef64a0: 49 dec ecx
76ef64a1: 7ffd jg 76ef64a0
76ef64a3: ff8b55108d48 dec dword ptr [ebx+488d1055]
76ef64a9: ffe8 jmp eax
76ef64ab: b90100008b mov ecx, 8b000001
76ef64b0: f0 lock
76ef64b1: 85f6 test esi, esi
76ef64b3: 0f84cf070000 jz 76ef6c88
76ef64b9: f6450c08 test [ebp+0ch], 08h
76ef64bd: 0f852a030000 jnz 76ef67ed
76ef64c3: 803d8003fe7f00 cmp byte ptr [7ffe0380], 00h
76ef64ca: 0f8516970000 jnz 76effbe6
76ef64d0: 85f6 test esi, esi
76ef64d2: 0f8481660000 jz 76efcb59
76ef64d8: 8b5df8 mov ebx, [ebp-08h]
76ef64db: 85db test ebx, ebx
76ef64dd: 0f853a970000 jnz 76effc1d
76ef64e3: 5f pop edi
76ef64e4: 8bc6 mov eax, esi
76ef64e6: 5e pop esi
76ef64e7: 5b pop ebx
76ef64e8: c9 leave
76ef64e9: c20c00 ret 000c
76ef64ec: 90 nop
76ef64ed: 90 nop
76ef64ee: 90 nop
76ef64ef: 90 nop
76ef64f0: 90 nop
76ef64f1: 90 nop
76ef64f2: 90 nop
76ef64f3: 90 nop
76ef64f4: 90 nop
76ef64f5: 90 nop
76ef64f6: 90 nop
76ef64f7: 90 nop
76ef64f8: 90 nop
76ef64f9: 90 nop
76ef64fa: 90 nop
76ef64fb: 90 nop
76ef64fc: 90 nop
76ef64fd: 90 nop
76ef64fe: 90 nop
76ef64ff: 90 nop
76ef6500: 8bff mov edi, edi
76ef6502: 55 push ebp
76ef6503: 8bec mov ebp, esp
76ef6505: 53 push ebx
76ef6506: 8b5d10 mov ebx, [ebp+10h]
76ef6509: 57 push edi
76ef650a: 33ff xor edi, edi
76ef650c: 3bdf cmp ebx, edi
76ef650e: 0f84ef220000 jz 76ef8803
76ef6514: 56 push esi
76ef6515: 8b7508 mov esi, [ebp+08h]
76ef6518: f7464400000001 test [esi+44h], 01000000
76ef651f: 0f859f0e0000 jnz 76ef73c4
76ef6525: f6464801 test [esi+48h], 01h
76ef6529: 0f85db220000 jnz 76ef880a
76ef652f: f6c307 test bl, 07h
76ef6532: 0f8551970000 jnz 76effc89
76ef6538: 8d43f8 lea eax, [ebx-08h]
76ef653b: 80780705 cmp byte ptr [eax+07h], 05h <-- FAULT
76ef653f: 0f842d970000 jz 76effc72
76ef6545: f640073f test [eax+07h], 3fh
76ef6549: 0f8431970000 jz 76effc80
76ef654f: 3bc7 cmp eax, edi
76ef6551: 894510 mov [ebp+10h], eax
76ef6554: 0f8499970000 jz 76effcf3
76ef655a: 807bff05 cmp byte ptr [ebx-01h], 05h
76ef655e: 0f8438970000 jz 76effc9c
76ef6564: 8b4510 mov eax, [ebp+10h]
76ef6567: f6400780 test [eax+07h], 80h
76ef656b: 0f84530e0000 jz 76ef73c4
76ef6571: 8bd3 mov edx, ebx
76ef6573: 8bce mov ecx, esi
76ef6575: e823000000 call 76ef659d
76ef657a: 84c0 test al, al
76ef657c: 0f84420e0000 jz 76ef73c4
76ef6582: 803d8003fe7f00 cmp byte ptr [7ffe0380], 00h
76ef6589: 0f858d970000 jnz 76effd1c
76ef658f: b001 mov al, 01h
76ef6591: 5e pop esi
76ef6592: 5f pop edi
76ef6593: 5b pop ebx
76ef6594: 5d pop ebp
76ef6595: c20c00 ret 000c
76ef6598: 90 nop
76ef6599: 90 nop
76ef659a: 90 nop
76ef659b: 90 nop
76ef659c: 90 nop
76ef659d: 8bff mov edi, edi
76ef659f: 55 push ebp

Built on Aegis on Sun Sep 21 12:07:07 2008 using compiler version 1400

Windows 6.0 (Windows Vista x86 build 6002) [Service Pack 2]

EAX = 0715b428
EBX = 0715b430
ECX = 02fdb2e6
EDX = 03170000
EBP = 0012fb24
ESI = 03170000
EDI = 00000000
ESP = 0012fb18
EIP = 76ef653b
EFLAGS = 00210246
FPUCW = ffff027f
FPUTW = ffffffff

Crash reason: Access Violation

Crash context:
An out-of-bounds memory access (access violation) occurred in module 'ntdll'...

...reading address 0715B42F.

Pointer dumps:

ECX 02fdb2e2: 00000159 680c6ac3 02fe91c0 000111e8 08758b00 7a203d83 750302ff 0c353b2e
EDX 03170000: d5f5d467 01000c58 ffeeffee 00000000 05c70010 031700a8 03170000 03170000
ESI 03170000: d5f5d467 01000c58 ffeeffee 00000000 05c70010 031700a8 03170000 03170000
ESP 0012fb18: 0715b430 0679daa0 7559b0ad 0012fb38 75599c46 03170000 00000000 0715b430
0012fb38: 0012fb74 02fdb2e1 03170000 00000000 0715b430 0679daa0 0675eb80 7559b0ad
0012fb58: 7559b0ad 0012fb4c 0012f73c 0012fb94 02fdb458 02fe91b0 ffffffff 0012fbe0
0012fb78: 02f91889 0715b430 06777220 07110020 02b47d90 0675eb80 0675eb80 0012fbd0
EBP 0012fb20: 7559b0ad 0012fb38 75599c46 03170000 00000000 0715b430 0012fb74 02fdb2e1
0012fb40: 03170000 00000000 0715b430 0679daa0 0675eb80 7559b0ad 7559b0ad 0012fb4c
0012fb60: 0012f73c 0012fb94 02fdb458 02fe91b0 ffffffff 0012fbe0 02f91889 0715b430
0012fb80: 06777220 07110020 02b47d90 0675eb80 0675eb80 0012fbd0 02fe7e40 00000002

Thread call stack:
76ef653b: ntdll!RtlFreeHeap [76e90000+66500+3b]
75599c46: kernel32!HeapFree [75550000+49c32+14]
02fdb2e1: mvtools2!_AvisynthPluginInit2@4 [02f60000+6c70+74671]
02f91889: mvtools2!_AvisynthPluginInit2@4 [02f60000+6c70+2ac19]
02f91729: mvtools2!_AvisynthPluginInit2@4 [02f60000+6c70+2aab9]
5dafea4f: AviSynth!avs_delete_script_environment [5da90000+69000+5a4f]
5dbb30dc: AviSynth!DllCanUnloadNow [5da90000+6f190+b3f4c]
5dafd23a: AviSynth!avs_delete_script_environment [5da90000+69000+423a]
5dafea4f: AviSynth!avs_delete_script_environment [5da90000+69000+5a4f]
5dbb30dc: AviSynth!DllCanUnloadNow [5da90000+6f190+b3f4c]
5db27f57: AviSynth!DllCanUnloadNow [5da90000+6f190+28dc7]
5dafcdd2: AviSynth!avs_delete_script_environment [5da90000+69000+3dd2]
5dafd254: AviSynth!avs_delete_script_environment [5da90000+69000+4254]
01791054: RemoveGrainSSE2!00001054
01791195: RemoveGrainSSE2!00001195
01797092: RemoveGrainSSE2!00007092
01797067: RemoveGrainSSE2!00007067
5dafcdd2: AviSynth!avs_delete_script_environment [5da90000+69000+3dd2]
5dafd254: AviSynth!avs_delete_script_environment [5da90000+69000+4254]
003e4670: RemoveDirtSSE2!_AvisynthPluginInit2@4 [003e0000+4550+120]
003e45a8: RemoveDirtSSE2!_AvisynthPluginInit2@4 [003e0000+4550+58]
5dafcdd2: AviSynth!avs_delete_script_environment [5da90000+69000+3dd2]
5dafd254: AviSynth!avs_delete_script_environment [5da90000+69000+4254]
5db31a55: AviSynth!DllCanUnloadNow [5da90000+6f190+328c5]
5dafcdd2: AviSynth!avs_delete_script_environment [5da90000+69000+3dd2]
5dafd254: AviSynth!avs_delete_script_environment [5da90000+69000+4254]
5daf271b: AviSynth!0006271b
5daf3efb: AviSynth!00063efb
5daf3e59: AviSynth!00063e59
5daff6cb: AviSynth!DllCanUnloadNow [5da90000+6f190+53b]
5daff45b: AviSynth!DllCanUnloadNow [5da90000+6f190+2cb]
73d261ba: AVIFIL32!AVIFileRelease [73d20000+61ac+e]
004b5e72: AVIReadHandlerTunnelW32::Release()
004bcf1a: InputFileAVI::~InputFileAVI()
004bd338: InputFileAVI::(special)()
004be1fc: VDInputFileFLM::Release()
004923c7: VDProject::CloseAVI()
00478223: Deinit()
00481893: WinMain@16()
00584d98: __tmainCRTStartup()
7559d309: kernel32!BaseThreadInitThunk [75550000+4d2f7+12]
76ed1603: ntdll!RtlInitializeExceptionChain [76e90000+415a0+63]
76ed15d6: ntdll!RtlInitializeExceptionChain [76e90000+415a0+36]
0066fe60: VirtualDub!0026fe60
0066fe60: VirtualDub!0026fe60

-- End of report

johnmeyer
30th December 2013, 20:46
These are the plugins I use in my version of the script:

LoadPlugin ("mvtools2.dll") #Version 2.5.11.9 2/24/2012
LoadPlugin("autolevels.dll") #Version 0.6.0.0 1/09/2011
LoadPlugin("Deflicker.dll") #Version 0.4.0.0 8/16/2004
Loadplugin("Depan.dll") #Version 1.10.0.0 4/09/2007
LoadPlugin("DepanEstimate.dll") #Version 1.9.2.0 3/25/2007
LoadPlugin("fft3dfilter.dll") #Version 2.1.1.0 2/20/2007
Loadplugin("mt_masktools.dll") #Version 2.0.23.0 3/14/2008
loadplugin("RemoveDirtSSE2.dll") #Version 0.9 5/05/2005
Loadplugin("RemoveGrainSSE2.dll") #Version 0.9 5/01/2005
#Loadplugin("removegrain.dll") #Version 0.9 5/01/2005
Loadplugin("warpsharp.dll") # 4/05/2010

I just checked the date/time on the version of MVTools2 I'm using and it is 2/24/2012 1:15 p.m.

The version of AVISynth may also matter. I am using AVISynth 2.60, build: Mar 9 2013[13:28:27] Ben Rudiak-Gould et al.

I am running this on Windows XP 32-bit SP3. I have Windows 7 64-bit, but never do any AVISynth work on that boot partition.

One question: have you changed the "threads" setting? I have an 8-core computer and if you have fewer cores, bad things may happen. I'd suggest setting threads to 2 for debugging purposes and see if that helps. Also, comment out both SetMTMode statements later in the script, down below the "#Change SetMTMode for Autolevels" comment. You should, of course, leave the two SetMTMode statements, located on either side of the "source1= ..." statement, and these two SetMTMode statements should not be altered.

Make sure you are using my script exactly as posted and that you haven't added any additional SetMTMode or MT statements.

Finally, I did a little research on this forum and found several similar error messages being reported by people using the LimitedSharpenFaster plugin when using SetMTMode. In my script, I still included the vestiges of that plugin, but these old references are all commented out. If you have enabled these lines by removing the comment symbol, I think this will cause that error message. Therefore, make sure that all refernces to LimitedSharpenFaster are commented out or removed. I should have done that before posting, but the script I posted did have them commented out and therefore should not have a problem unless you removed the comment symbol.

[edit]In looking further at other reports of this error message, the version of AVISynth appears to sometimes be the culprit. Try installing the exact version I listed above and see if that helps.

bhershey
31st December 2013, 03:49
I just checked the date/time on the version of MVTools2 I'm using and it is 2/24/2012 1:15 p.m.
The version of AVISynth may also matter. I am using AVISynth 2.60, build: Mar 9 2013[13:28:27] Ben Rudiak-Gould et al.
I am running this on Windows XP 32-bit SP3. I have Windows 7 64-bit, but never do any AVISynth work on that boot partition.


I have all the exact same versions.


One question: have you changed the "threads" setting? I have an 8-core computer and if you have fewer cores, bad things may happen. I'd suggest setting threads to 2 for debugging purposes and see if that helps. Also, comment out both SetMTMode statements later in the script, down below the "#Change SetMTMode for Autolevels" comment. You should, of course, leave the two SetMTMode statements, located on either side of the "source1= ..." statement, and these two SetMTMode statements should not be altered.


No help with any of these suggestions.


Make sure you are using my script exactly as posted and that you haven't added any additional SetMTMode or MT statements. Make sure that all refernces to LimitedSharpenFaster are commented out or removed.


script exactly as posted... no change.


[edit]In looking further at other reports of this error message, the version of AVISynth appears to sometimes be the culprit. Try installing the exact version I listed above and see if that helps.

I have Windows Vista Home Premium, AMD dual core 2.0ghz, 4gb memory.
I'm using avisynth.dll 2.60, build: Saturday, ‎March ‎09, ‎2013, ‏‎4:28:48 AM Ben Rudiak-Gould

Next I should probably get you a small sample of my input files. I've tried two so far and they are both DV AVI files... attached is the mediainfo .txt file from the current video file I'm using for testing, if it helps.

Also, any idea why changing X or X2 crashes?

Brian

johnmeyer
31st December 2013, 03:55
I doubt that the problem is caused by the media file itself, but if you can use Mediafire to post a short, unaltered clip, I'll certainly take a look and see if I can reproduce your problem. The text file you posted hasn't been approved yet, but I don't think I'll be able to learn much from that (although I'll certainly look at it when it becomes available).

Also, at the risk of being irritatingly redundant, may I ask again whether your AVISynth version is the one I showed? I am asking again because I've had several problems with multi-threading when using certain similar-sounding, but different, AVISynth versions.

bhershey
31st December 2013, 04:01
Also, at the risk of being irritatingly redundant, may I ask again whether your AVISynth version is the one I showed? I am asking again because I've had several problems with multi-threading when using certain similar-sounding, but different, AVISynth versions.

I'm using the stable version posted here... http://forum.doom9.org/showthread.php?t=148782

johnmeyer
31st December 2013, 04:11
I wish I could provide more help. I'm out of ideas. Hopefully someone else will have a suggestion.

bhershey
31st December 2013, 04:12
Thanks John.. are you able to change the X and X2 variables without error?

bhershey
31st December 2013, 07:45
Here is the exact script I'm using that is generating memory errors on exit. It also crashes AVSMeter. I expicitly load every DLL. If I use Fred's mvtools2 version instead everything works, AVSMeter included.

#VIDEO FILE
#----------------------------------------------------------------------------------------------------------------------------
#Change the following line to point to your video file
film="c:\film.avi"


#GENERAL PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="result4" #specify the wanted output here; valid results are "result1" through "result4" and "resultS1" through "resultS4" for before/after
play_speed=16 #play speed (8mm=16; Super8=18; 16mm sound=24)


#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.0 #for all outputs
gamma=1.0 #for all outputs
blue= -0 red=-0 #manual color adjustment, when returning result3 & result4. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 #manual levels, when returning result2 & result4


#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=16 CTop=16 CRight=16 CBottom=16 #crop values after Depan and before final resizing
W=720 H=480 #final size after cropping
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150
in_bord_left=0 in_bord_top=0 in_bord_right=0 in_bord_bot=0 #Borders around input that must be removed


#STABILISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=05 #maximum values for the stabiliser (in pixels) 20 is a good start value
maxstabV=20
est_left=40 est_top=40 est_right=40 est_bottom=40 #crop and contast values for special Estimate clip
est_cont=1.6

#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
#Fastest parameters
#denoising_strength=600 #denoising level of first denoiser: MVDegrain()
#denoising_strength=300 #denoising level of first denoiser: MVDegrain()
#block_size= 16 #block size of MVDegrain
#block_size_v= 16
#block_over= 8 #block overlapping of MVDegrainMulti()

#Best compromise between speed and quality
denoising_strength= 600 #denoising level of first denoiser: MDegrain()
block_size= 8 #block size of MVDegrain
block_size_v= 8
block_over= 4 #block overlapping of MVDegrainMulti()

dirt_strength=23 #sets amount of dirt removal (big spots)


#FOUR STEP SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
PRE_sharp_ness= 120 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
Sharp_Strength= 0.1


#AUTO LEVELS PARAMETER
#--------------------------------------------------------------------------------------------------------------------------------
X=4 #X is a special parameter for reducing the autolevels effect on the whites
X2=4 #X2 is a special parameter for reducing the autolevels effect on the blacks


#NUMBER OF THREADS
#--------------------------------------------------------------------------------------------------------------------------------
threads=2


# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================

# Using AVISynth version 2.60, build August 28, 2012 (Ben-Rudiak-Gould, etc.)
# Using VirtualDub 1.8.6

#Change the following (lower or higher) if you have stability problems with multi-threading
SetMemoryMax(512)

#Load plugins explicitly
LoadPlugin ("plugins\mvtools2.dll") #Version 2.5.11.9 2/24/2012
LoadPlugin("plugins\autolevels.dll") #Version 0.6.0.0 1/09/2011
LoadPlugin("plugins\Deflicker.dll") #Version 0.4.0.0 8/16/2004
Loadplugin("plugins\Depan.dll") #Version 1.10.0.0 4/09/2007
LoadPlugin("plugins\DepanEstimate.dll") #Version 1.9.2.0 3/25/2007
Loadplugin("plugins\mt_masktools.dll") #Version 2.0.23.0 3/14/2008
loadplugin("plugins\RemoveDirtSSE2.dll") #Version 0.9 5/05/2005
Loadplugin("plugins\RemoveGrainSSE2.dll") #Version 0.9 5/01/2005
Loadplugin("plugins\warpsharp.dll") # 4/05/2010

#Use the following for alternative frame interpolation
#loadplugin("svpflow1.dll") #Version 1.2.1.0 5/29/2012
#loadplugin("svpflow2.dll") #Version 1.3.1.0 6/02/2012
#Import("InterFrame2.avsi") #Version 2.1.0 6/27/2012

#Open and crop the video
#Remove all setmtmode statements (there are four in this script) if not using multi-threaded (MT) AVISynth
setmtmode(5,threads)
source1= Avisource(film).killaudio().assumefps(play_speed).converttoYV12() #killaudio() improves stability (in my experience -- others disagree)
cropped_source=source1.crop(in_bord_left,in_bord_top,-in_bord_right,-in_bord_bot) #temporarily remove any black borders on input video
setmtmode(2)

#cropped_source=filldrops(cropped_source) #Use this when removing bad frames that have been removed by duplicating previous frame
#(see notes in function at end of script)

#STABILIZING
#....................................................................................................................................................................
stab_reference= cropped_source.crop(est_left,est_top,-est_right,-est_bottom).tweak(cont=est_cont).MT_binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15)

#Alternative line that includes deflicker. I find that this usually is not needed.
#stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker()


#DENOISING
#...................................................................................................................................................................

#Remove dirt
input_to_removedirt=stab.crop(CLeft,CTop,-CRight,-CBottom)
stabcrop=RemoveDirtMC(input_to_removedirt,dirt_strength,false)

#Reduce grain
prefiltered = RemoveGrain(stabcrop,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super= MSuper(stabcrop, hpad=32, vpad=32,pel=2)

halfblksize= (block_size>4) ? block_size/2 : 4
halfoverlap= (block_over>2) ? block_over/2 : 2

bvec1 = MAnalyse(superfilt, isb = true, delta = 1, blksize=block_size, overlap=block_over,dct=0)
bvec1 = MRecalculate(super, bvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

fvec1 = MAnalyse(super, isb = false, delta = 1, blksize=block_size, overlap=block_over,dct=0)
fvec1 = MRecalculate(super, fvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

bvec2 = MAnalyse(super, isb = true, delta = 2, blksize=block_size, overlap=block_over,dct=0)
bvec2 = MRecalculate(super, bvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

fvec2 = MAnalyse(super, isb = false, delta = 2, blksize=block_size, overlap=block_over,dct=0)
fvec2 = MRecalculate(super, fvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

denoised=stabcrop.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)


#SHARPENING
#...................................................................................................................................................................
sharp1=denoised.sharpen(Sharp_Strength)
PreBorderFrame = sharp1.Lanczos4Resize(W - bord_left - in_bord_left - bord_right - in_bord_right, H - bord_top - in_bord_top - bord_bot - in_bord_bot)


#FRAME INTERPOLATION (optional)
#...................................................................................................................................................................

#Interpolate frames
#Use this for progressive output -- example shows 29.97 progressive
#PreBorderFrame=InterFrame(NewNum=30000,NewDen=1001,PreBorderFrame,GPU=true,Cores=threads)

#Use this for interlaced output -- example shows 29.97 interlaced
#PreBorderFrame=InterFrame(NewNum=60000,NewDen=1001,PreBorderFrame,GPU=true,Cores=threads).SeparateFields().SelectEvery(4, 0, 3).Weave()


#RESULT1: AUTOLEVELS,AUTOWHITE
#......................................................................................................................................................................
SetMTMode(5) #Turn off SetMTMode for Autolevels
result1= PreBorderFrame.coloryuv(autowhite=true).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)

#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result3= PreBorderFrame.coloryuv(off_U=blue,off_V=red).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
SetMTMode(2) #Re-enable SetMTMode after Autolevels

#RESULT2: MANUAL LEVELS, AUTOWHITE
#......................................................................................................................................................................
result2= PreBorderFrame.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)

#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result4= PreBorderFrame.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)


#PARAMETERS FOR THE COMPARISONS
#.....................................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
source4=Lanczos4Resize(source1,W2,H2)


#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"manual colors and levels correction",size=28,align=2))

#Finish and go home
Eval(result)


# END SCRIPT, BEGIN FUNCTIONS
#=================================================================================================================================


#REMOVE DIRT FUNCTION
#......................................................................................................................................................................
function RemoveDirt(clip input, int limit, bool _grey)
{
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
}

#This function provides motion compensation for the remove dirt function, thus improving quality.
function RemoveDirtMC(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)

prefiltered = RemoveGrain(clip,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super=MSuper(clip, hpad=32, vpad=32,pel=2)

bvec = MAnalyse(superfilt,isb=true, blksize=16, overlap=2,delta=1, truemotion=true)
fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)

bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=100)
fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=100)

backw = MFlow(clip,super,bvec_re)
forw = MFlow(clip,super,fvec_re)

clp=interleave(backw,clip,forw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}

# The following function will remove near duplicates ("0.1") or exact duplicates (change to "0.0").
# It replaces these duplicates with a motion estimated frame. It works really well (IMHO).
#
# Use: In your video editor, replace any single bad frame (burned frame, jump, missing frame from splice, etc.) with a duplicate of the
# previous frame. Then, include a call to this function (see script above, where it is commented out).
#
# Here's an example of how this function can be use:
#
# http://www.youtube.com/watch?v=uzMFodrGHDs
#

function filldrops (clip c)
{
super=MSuper(c,pel=2)
vfe=manalyse(super,truemotion=true,isb=false,delta=1)
vbe=manalyse(super,truemotion=true,isb=true,delta=1)
filldrops = mflowinter(c,super,vbe,vfe,time=50)
fixed = ConditionalFilter(c, filldrops, c, "YDifferenceFromPrevious()", "lessthan", "0.1")
return fixed
}

johnmeyer
31st December 2013, 21:41
I copied/pasted your code, but used my "Load" lines, because my DLLs are in different places. Everything worked OK.

I do sometimes get crashes when I seek (i.e., GoTo a specific frame number), because MaskTools isn't entirely happy playing with SetMTMode(). However, these crashes do not involve the "ntdll" DLL so I think they are different than what you are experiencing.

To avoid my seek crashes when I am moving about the film when using the side-by-side comparison feature (the "S" versions of the Results variable), I often comment out the two SetMTMode() statements on either side of the "source1" statement. This makes the script run in single threaded mode. I never get any instability when I do this. The script is still faster than Fred's script, even when run with one thread, but the difference is not as substantial.

So, you might try commenting out these two SetMTMode() statements and see if you get any improvement.

I think you are going to have to get help from someone who is more of an AVISynth guru because I think this has to do with something else besides the script itself.

Boffee
31st December 2013, 22:16
I made some more experiments tonight, and changed the MVtools2.dll plugin in Fred's script to the latest one. I was surprised to see that Virtualdub crashed exactly the same as with John's script, so whatever it is, it is common to both Fred & John's scripts. I then tried another script that I use to change film speed which has only one plugin, ie MVtools2.dll. No crash at all in this instance.

johnmeyer
31st December 2013, 23:07
Just to be clear, Fred's scripts all use the original MVTools. All versions of my script use MVTools2. Even though these two plugins have the same authors, they are not interchangeable and each uses completely different syntax. Therefore you cannot simply load one in place of the other. If you do that, nothing will work. My script will probably work with just about any version of MVTools2 and, as I said in a PM but want to say here, I don't think any of the problems reported when using my script have anything to do with MVTools2.

bhershey
31st December 2013, 23:50
So, you might try commenting out these two SetMTMode() statements and see if you get any improvement.


I've removed all MT statements and same error.

johnmeyer
1st January 2014, 00:05
I'm afraid I can provide no further help. I have no idea why it isn't working for you. Sorry.

bhershey
1st January 2014, 00:22
Just to be clear, Fred's scripts all use the original MVTools. All versions of my script use MVTools2. Even though these two plugins have the same authors, they are not interchangeable and each uses completely different syntax. Therefore you cannot simply load one in place of the other. If you do that, nothing will work.

John's script uses mvtools2.dll version 2.4.2.0 4/8/09.

Your script uses the special SVP version 2.5.11.9 2/24/12.

As Boffee and I have said, if we use mvtools2 v2.4 in your script it runs fine. I assume we lose any unique SVP improvements specific to the newer version.

Brian

bhershey
1st January 2014, 02:42
I made progress on the problem that is crashing John and Fred's scripts when using mvtools2 v2.5.11.9 on some computers. I've found two other people so far with the same problem.

It happens here in the RemoveDirtMC function...

backw = MFlow(clip,super,bvec_re)
forw = MFlow(clip,super,fvec_re)

This generates a memory error in ntdll.dll on exit from VDub.

The error does NOT happen if you use mvtools2 v2.4.2.0 and it does NOT happen if you replace the code above with...

backw = MCompensate(clip,super,bvec_re)
forw = MCompensate(clip,super,fvec_re)

Again, this is only a problem on some systems, not all. As before, I'm offering my time and services to the authors to help troubleshoot this problem.

Brian

johnmeyer
1st January 2014, 05:25
You might want to either start a new thread for this problem, or else post in the MVTools thread. It doesn't look like it has anything specific to do with the scripts posted here.

Since this is such a long thread, many people not interested in film restoration don't follow it, and you might get more help with a new thread or in the MVTools thread.

giuso71
13th January 2014, 11:09
Hello to everybody. I have been working with telece since 1years:builded a homemade telecine following Movie2video.com. The sistem work very well, but now i have to improve quality recording. I use a Panasonic gs10eg cam (720x576), than i deinterlace and flip horizzontally, than use VirtualMod with Fred Script. I don't use wetgate, but use one Moviola and a Eyes-clothe to clean the film manually. Really: very good results but when ii'm not satisfied.I'm working to reach Fred results ( even if my relatives weren't so good in taking film). My questions: is my cam enough to obtain good result or should i buy an Imaging Source Camera? Perhaps is too expensive for me....Moreover there is no cheap hd cam with firewire, isn't it??? Please answer me. Thanks Giu

Ps:moreover, i can't understand how Fred succeed on convertingreducing 4:3 Film (Normal 8) to 16/9 film (there is nothing on his script about it)

Guest
13th January 2014, 19:31
[bump after forum move for giuso71]

giuso71
17th January 2014, 23:00
Can someone help me?Read my topic please

johnmeyer
17th January 2014, 23:31
Can someone help me?Read my topic please ... builded a homemade telecine following Movie2video.com ... I use a Panasonic gs10eg cam (720x576), than i deinterlace and flip horizzontallyThe instructions on that site describe how to build a frame accurate capture system. If you have built according to those instructions, then you do not need to deinterlace, and doing so may make your results worse. Even when you use a camera which only records interlaced video, the nature of a frame-accurate capture device creates video where both fields are from the same point in time. Therefore, the video you capture will actually be progressive, not interlaced, even if the camera captures using interlaced video.

You omitted one important piece of information: what film gauge are you transferring? If it is 8mm or Super 8 or 9mm, then 720x576 is probably enough resolution. You may get a little improvement if you are transferring modern film of this size, but for most older, amateur film, this is enough resolution.

On the other hand, if you are transferring 16mm film, then more resolution will definitely give you an improvement.

As always, resolution is only a small part of what you must do to get a good transfer. Exposure is sometimes more important and is where most people who do film transfer themselves end up failing. You must make sure to never let the highlights go to 100% white. Your camera must have "zebras" in order for you to monitor the exposure and take corrective action when necessary.

i can't understand how Fred succeed on convertingreducing 4:3 Film (Normal 8) to 16/9 film Fred will have to answer, but this is normally done by cropping some of the original film (in other words, you are going to lose some of the original image). It can also be done by stretching, but this is usually obvious because everyone looks "fat." Some film was shot with a widescreen lens, and it is possible that some of Fred's film (much of which was shot in the past few years) simply uses a widescreen (anamorphic) lens.

giuso71
18th January 2014, 20:35
Thanks for your kind reply and sorry if i could be like a little newbie.
that's what i undestrand:
1- not to deinterlace
2-cause i'm working with amateur 8 and super 8 film (from 1965 to 1980), my 720x576 cam is good enough.

Only a question: you speak about "zebras" but i can't understand you. when i capture my problem is to reach the right white balance (i do this framing the white strip before the film).I decide the aperture only watching on the pc monitor. Could you please help me to understand you?
Thanks
Giu

johnmeyer
18th January 2014, 22:41
you speak about "zebras" but i can't understand you. when i capture my problem is to reach the right white balance (i do this framing the white strip before the film).I decide the aperture only watching on the pc monitor. Could you please help me to understand you?1. The zebra function of a camera or camcorder puts diagonal black & white stripes on top of any portion of the video that exceeds 100% (pure white) exposure. (Black & white stripes remind people of a zebra horse.) Zebras have nothing to do with white balance (at least not directly). The reason most higher-end cameras have this feature is that it lets you immediately see, in the camera viewfinder, whether any portion of the video is over-exposed, and you can then take corrective action, if your camera has the ability to manually correct automatic exposure.

If you don't manually correct the automatic exposure, I will guarantee that your camera will overexpose the highlights and all the detail in those bright areas will be lost forever. They cannot be recovered. On the other hand, areas that are under-exposed (too dark) can often be brightened, revealing detail, although usually accompanied by noise. Some of this noise can later be filtered using AVISynth.

So, when transferring film, under-exposure (too dark) is preferable to over-exposure (too bright).

This feature is extremely important when transferring film because film is capable of handling a much wider range of luma (light) values than can video. The ideal video camera for film transfer is one that lets you create a custom gamma function that matches the film you are using. Very few cameras under $10,000 offer this feature so you have to do what I described in the last paragraph. I believe, however, that the camera Fred uses does let him create these custom gamma curves. Just to be clear, a gamma curve defines how much to increase or decrease the brightness of each pixel, depending on how bright that pixel is in the original scene.

A large percentage of 8mm film transfers shown on YouTube exhibit horrible highlight loss. Less than 30 seconds of searching turned up this example of bad transfer technique:

Pink Floyd Concert (https://www.youtube.com/watch?v=aPmijzAjvd4&t=18m14s)

While it is possible that the film overexposed the highlights, I'm pretty certain the detail was in the original film, and the complete loss of detail on the guitar was caused by very poor film-to-video transfer technique.

2. Color correction is a different issue. You are correct that you should set the white balance using the projector light. However, this in no way will give you the correct white balance on most scenes. All film must be color corrected manually. The people who create commercial movies call this "color timing." That is a strange phrase, because it has nothing to do with time. Most of us who are amateurs call it color correction.

The reason you must do this manually is that each film emulsion has a very different way of storing color information, and without correction, it will look very strange when you play back the video. Also, film fades, often quite significantly.

There is no automatic white balance function that, in my opinion, does a very good job at giving you color that looks natural and real. You must achieve the correct color balance using the interactive color correction tools in your video editing program (I use Sony Vegas).

giuso71
2nd February 2014, 17:43
first of all thanks for all your reply.
One question: if i buy GZ-EX250 jvc Full HD Camcorder with wifi, perhaps i can use wifi function for telecinema(this camera is used for streaming in HD, like a HD webcam). Now i need only a stopmotion software that work with this camera. What do u think?
secondary: you write: "using the interactive color correction tools in your video editing program (I use Sony Vegas)". So, in your opinion, after used Virtualdub and your or Fred script i should use a video editing program like Vegas o Adobre Premiere for color correction? Is that right???
And u're also saying me that during a 3 minutes film i should adjust colour balance often? Is that right?
Thanks a lot

johnmeyer
3rd February 2014, 00:49
Now i need only a stopmotion software that work with this camera.For stop motion, I use SCLive, a DV capture program that also has stop motion capture capability. Andi (the developer) has discontinued support, but you may still be able to download it.

So, in your opinion, after used Virtualdub and your or Fred script i should use a video editing program like Vegas o Adobre Premiere for color correction?I usually do color correction within Vegas before frameserving that result into the script. Also, I never enable either the autolevels or autocolor correction in Fred's script because I have found, for my work, those functions do the wrong thing more often than they do the right thing. You should experiment with your own film transfer to see if you like the results: maybe these functions will work for you.

And u're also saying me that during a 3 minutes film i should adjust colour balance often?Proper color correction has to be done on a scene-by-scene basis. You will probably find that each time the date the film was taken changes to a different day, the color balance will change, sometimes radically. This might happen many times, even in a 50-foot, three minute reel.

giuso71
3rd February 2014, 09:49
Thanks 4 all:)

2Bdecided
7th February 2014, 17:00
This feature is extremely important when transferring film because film is capable of handling a much wider range of luma (light) values than can video. The ideal video camera for film transfer is one that lets you create a custom gamma function that matches the film you are using. Very few cameras under $10,000 offer this feature so you have to do what I described in the last paragraph.Various sub $1000 cameras will let you reduce the contrast, which helps this problem.

Cinemode on the Canon HV20, and Intelligent Contrast Control on the Panasonic HC-X920 are two quite different features that let you go even further in squashing the dynamic range, in combination with the normal contrast and brightness and/or (on the HV20) exposure controls if you wish.

It's far from a user defined gamma curve, but it certainly helps to bring wide dynamic range scenes in with both dark and light areas intact. Cinemode was static (and exposure could be locked), ICC is dynamic (and locking exposure knocks the camera out of ICC), so the former is better for film transfers. (The latter is better for getting a decent result out of the camera in real-life).

Your typical sub $500 camcorder is pretty hopeless for capturing the dynamic range of film (or real life IME!) - as you say, you can capture under exposed to avoid clipping whites and boost/twiddle in AVIsynth to make things visible, but dark areas can end up noisy and/or blocky.

Cheers,
David.

giuso71
8th February 2014, 13:33
What i mostrly understood is that 720x576 camera is not enough for a good telecine. I've tryied something with a Hd Camileo x200 trhought hdmi and a slot for hdmi and finally i obtained what i was lloking for: every detail was there, every colour, the sharpness was wonderfull. Now i have to buy a Hd camera (to use also during the day) but i can't afford the 2 cameras you say: these are too expensive for me.
I'd like to buy a camera like JVC EX355 Camcorder Full HD.
the question is: is it possible to use the wifisignal for telecine and which software is able to work with wifisignal. SCLive????
Can you help me?
Thanks for all
Giu

johnmeyer
8th February 2014, 18:21
What i mostrly understood is that 720x576 camera is not enough for a good telecine.
Thanks for all
GiuThat is not what I said above, and that is not what you said in your earlier response. You seem confused. To repeat, exactly, my earlier post:

"If it is 8mm or Super 8 or 9mm, then 720x576 is probably enough resolution. You may get a little improvement if you are transferring modern film of this size, but for most older, amateur film, this is enough resolution.

On the other hand, if you are transferring 16mm film, then more resolution will definitely give you an improvement.So, just to be clear, in my opinion you do NOT need to get a new camera because 720x576 is good enough for transferring 8mm and Super 8 film. According to your earlier posts, this is the gauge that you are transferring.

giuso71
9th February 2014, 00:15
You're right, but i'm not confused
during last week i've had chance to test an hd camera (camileo x200) vs 720x576 camera; there is no possibility to be wrong. A Simple hd camera (without autofocus and aperture), is much better that the other. If i could send you an example i would. These are months that i was trying to obtain best results, changing all i could change but the final video was not good for me, no similar with a good Fred Video. With Hd camera: yes, now all is ok. I could even stop to use Fred script.....

bookemdano
22nd February 2014, 16:51
Greetings everyone. I am really grateful that you guys (especially VideoFred and johnmeyer) have been so willing to share your knowledge and expertise with the rest of us. I am pretty new to video, avisynth, etc. but I’ve been wanting to telecine all my family’s old 8mm/Super-8 film for a while and there's nothing like jumping in head first!

After some early tries with a variable speed Chinon piece of crap and not being able to get rid of the shutter artifacts I finally bit the bullet and decided to do it right. I bought a Eumig 610D. Amazing piece of Austrian engineering right there. It almost pained me to modify it! But I did—removed the three shutter blades, removed the R8/S8 crop and widened the gate with a file.

I came across an intriguing method from this guy (http://oysteineliassen.blogspot.com/2012/09/diy-synced-telecine-with-eumig-mark.html) who used his DSLR to do the capture at 6fps and mounted a microswitch on a component of the claw mechanism on the projector to send a sound signal to the DSLR when the frame was advanced. I managed to get a switch managed in the same place he did (it wasn’t easy!) and in some limited testing it’s working great. He uses the GetDups plugin for avisynth which has an audio mode perfectly suited for this purpose. He also uses some of VideoFred’s restoration scripts. For the optics, he mounted a 60mm SLR macro lens backwards on the projector and projects directly onto the sensor of his DSLR. Capture is at 1080p/24 and the projector runs @ 6fps.

I duplicated his setup almost exactly (although I am using a different lens). I set the aperture to F8 for ease of focusing. I recorded one Super-8 reel as a test and ran it through his script (without understanding too much about all the script was doing). I’m amazed that it actually worked—got rid of all the duplicate frames and left me with a smooth 18fps progressive avi. It has given me much hope that my high standards for this project are going to be met and all the money and time I’ve spent so far will not be in vain.

That said, my eye has noticed a few things I would love to have some help with correcting. Would you guys be so kind as to offer your opinions on some of this stuff? I'll just start off with a couple basic questions:

1. LED light source. I’ve procured various 2-5 watt MR16 12V LEDs, both ~3500K and ~5500K. I figured that since these reversal films were formulated to be projected with incandescent/halogen bulbs that a warmer color temperature bulb would look best. But when I experimented a bit I found that my eye actually preferred the look of higher color temp bulbs. Is that what I *should* be using for the highest color accuracy? Or is this just a personal preference kind of thing?

2. On this particular reel the first 1.5 minutes is my first birthday party, shot indoors (tungsten light). The colors look more or less correct. The rest of the reel is scenes from my Aunt’s wedding. Everything there looks far too blue. From the googling I have done it seems that this was indoor-formulated film and my Dad should have flipped a switch on his camera before shooting the outdoor scenes (that engages an orange filter to account for the daylight color temperature). So assuming I have that right, what is the best way for me to correct his error after the fact? I'm assuming I shouldn't bother trying to do anything *during* the capture on my DSLR. Can/should I do this with avisynth? Or is it more effective to do this using my NLE of choice? For a case like this, is it OK to capture both indoor and outdoor scenes together as one file or is it better for me to cap the outdoor scenes separately to a different file?

3. Workflow in general. I'm struggling with trying to nail down a good order in which to do things. My starting point is the H.264 .mov files generated by my t2i and I'd like to end up with the cleaned, progressive 18fps footage in Final Cut Pro to add titles, score, etc. Not sure what codec(s) to use in between--Cineform? Uncompressed RGB? And should I remove the duplicate and smeared frames first thing? Or do color correction first? I know I need to run VideoFred's scripts after the duplicate frames are removed, but not sure if the order of the rest of the steps matters much.

I will have some specific questions about actual artifacts I've seen in the test reel I processed and how I might correct them. But I need to get some frames captured to show you what I"m talking about so I will work on that this weekend. I also think this post is long enough as it is.

Would much appreciate any comments from you guys. When I first decided I wanted to do this project I had no idea how involved it would be, but I also had no idea I'd have so much fun figuring it all out. Thanks a million.

johnmeyer
22nd February 2014, 18:25
Wow! I am really impressed by what you've done. Very professional. I'll be interested to see a few samples of your captures.

One of the key issues in any do-it-yourself telecine mechanism is the optical path. It is very easy to end up with focus issues (is it sharp from edge to edge?); keystoning (are the edges of the frame warped?); and fringing (do you see rainbows around the edges of the frame or in B&W transfers?).

If your optical path is clean, then you should be getting some really great results.

In answer to your questions ...


Bulb color temperature. I built my own 16mm capture system, but a few years before I did that, I purchased one of the very first Workprinter prototypes. That original used an incandescent bulb which was around 2700K color temp. Because this was an early prototype, I contacted the inventor (Roger Evans) several years later and he agreed to refurbish my unit for a reasonable fee. The new unit used a daylight LED. I have not found too much difference in color quality of the final product after this change, so based on actual experience, I don't think it maters much. What does matter is that you set the color balance on your camera correctly. The one thing you should never do is use Auto white balance because that will constantly be changing in every scene and you cannot possibly get predictable results. Instead, you can use one of the two presets (daylight or tungsten) available in most cameras and this often works pretty well. You can also do a white balance when no film is in the gate, and that also works reasonably well.

Try each of the three ways and see what performs best for the film you are transferring. However, whatever you end up doing, you should expect to do a LOT of color correction (or "color grading," as the film people call it) in post production. You will have to do this not only for the one issue you describe (correcting the error of using indoor film outdoors, or vice versa) but for all sorts of other situations. Color emulsions are not stable over time, so you will have to correct for fading. The beginning and ending points of each reel are often fogged, and this will change the color balance. Under- or over-exposure will change color balance.

I can list many more examples, but the bottom line is that film color changes a lot, and if you are trying to get a result that matches the effort you've already put into the project, you'll have to do a lot of color correction in post. This should be done in your NLE, not in AVISynth because it is an interactive process, and AVISynth is simply not the right tool. There is no automatic color correction tool that I've ever seen that can do a very good job with these sorts of problems.

As for workflow, if you can, try to capture using a codec that compresses each frame individually. h.264 would most definitely not be my codec choice for initial acquisition. In fact, it would be my absolute last choice. It is the worst possible codec for editing because of its long-GOP structure. The only reason it is used in camcorders is that it permits relatively modest-sized memory cards to hold reasonable amounts of very high resolution video. By contrast, Cineform is a fantastic choice for both capture and intermediate editing.

h.264 is a great choice for final delivery.

For 8mm and Super 8, I use DV. It is still one of the best capture and editing codecs (although its limited colorspace can sometimes be an issue). The resolution is, IMHO, more than adequate for the limited resolution available on 8mm and Super 8. For 16mm, HD resolution can provide better results.

So get rid of all your dups first. Next, set the playback speed in the video file header (I use AVIFrate for AVI files): 16 fps for old 16mm and 8mm film; 18 fps for modern 16mm and Super 8; and 24 fps for sound. Put that on your NLE timeline and do gamma correction and color grading on each reel. Then cut the video to get rid of blank spots, etc. Also, use the recently posted Stainless scripts to find and remove flash frames at the beginning of each scene. Then serve this edited and color-corrected version into the scripts posted in this thread to create a "restored" version (I do not use the gamma or color correction options in these scripts for the reasons I already gave). I then take all these restored video files and put them in whatever order is going to be on the final delivery format (DVD, for instance), add titles, etc., and then render to my final delivery format.

Hope that helps!

bookemdano
22nd February 2014, 21:00
johnmeyer - I was hoping you would respond. Thanks so much for your kind words and advice. Everything you said makes sense to me.

I cannot take any credit at all for the method I'm using--I pretty much copied exactly from that page I linked. I have loved reading about all of the different ways people have devised to get one capture per film frame (or decimate duplicate frames later as I know you have perfected). Such ingenuity... whereas I am just lucky to be able to follow in these footsteps.

I will definitely get some sample frames and show you what I am dealing with. Right now while experimenting I have had the projector on a table and the DSLR on a tripod in front of it (with a macro slider for focus adjustment) but next I think I may fashion a more stable setup to try to minimize some of the vibration/camera shake I am seeing.

I will definitely try another capture with AWB off and try the various settings. I notice also that the ISO changes throughout the course of the capture. Should I be setting a fixed ISO for the entire capture or is it OK to let that fluctuate a bit?

Your comments on H.264's weaknesses as a capture codec got me thinking a bit, although I'm not sure I have (m)any other options. On Canon DSLRs they give you no choices really. Now, I do have an EOS 6D (full-frame sensor) I could use--it offers the choice of All-I versus IPB which should give higher quality (albeit larger file size) captures. I was trying to stick with the t2i though since I'm not using it for anything else at the moment and I can completely fill its cropped sensor with the projector image. If I use the 6D I'd need a longer focal length lens if I wanted to fill the sensor.

The only other possibilities without switching to a completely different camera (not really in the budget) would be:

1. RAW video - This is thanks to the magic lantern firmware for the Canon DSLRs (pretty amazing stuff). The t2i due to its slower SD write speed of 21MB/s can only manage 960x540 when shooting RAW. I think the 6D at this point can get close to 720p but from what I've read it can't record audio at the same time. So I would have to try to record the beep track marking frame advance separately and then try to sync up before GetDups... sounds like a lot of hassle.

2. Capture from HDMI - I'd need to buy a capture device (no idea on the cost but my guess is that it's pricey) and everything I've read says it's not that advantageous (still 8-bit, also it's in 1080 60i).

I knew h.264 wasn't exactly an ideal capture format but I was hopeful I guess that considering the low-resolution source material that it wouldn't have too great an impact on the end product.

So considering I need to strike some kind of balance between indulging my perfectionism and actually completing this project in a reasonable amount of time and without spending much more money--do you think I should just deal with the h.264 source (I would transcode to cineform before any subsequent steps) or should I try dealing with RAW video despite the limitations/hassle? It sucks that there's no in-between those two extremes at the moment.

I mean I'm quite sure my family even thought my early attempts with the Chinon projector (shutter artifacts and all) were pretty great. I think I am the biggest critic I will need to satisfy at this point.

Thanks again. I'll post up some captures later today or tomorrow.

johnmeyer
23rd February 2014, 01:19
I think I may fashion a more stable setup to try to minimize some of the vibration/camera shake I am seeing.Yes, definitely put the equipment on a solid table, and the camera on a sturdy tripod. The sturdy tripod makes it harder to screw up the alignment as you are walking around changing film, etc. I can't begin to count the number of times I've bumped the tripod ...

I notice also that the ISO changes throughout the course of the capture. Should I be setting a fixed ISO for the entire capture or is it OK to let that fluctuate a bit?I forgot to mention how to deal with exposure. This is much more important than white balance. You have two problems: exposure variation, and the difference in exposure latitude between film and video.

The exposure variation is due to the fact that most film cameras, prior to Super 8, used manual f-stop settings for exposure, so most amateur film contains many segments that are either under- or over-exposed, often by a huge amount, because the operator was either operating without an exposure meter, or forgot to change the setting when conditions change, or just screwed up.

You can watch the video from your film transfer, real time, on a computer monitor and manually adjust the exposure, or you can use the auto exposure on the camera to track the changes in overall exposure. If you are doing a lot of film, you pretty much have to use the auto exposure, especially if you are capturing at six frames a second; otherwise you'd have to stand there all day to capture just a few 400 foot reels.

So, I recommend you use the camcorder/DSLR's auto exposure.

However, this will give you a second problem, and this problem is the Achilles heal of almost all amateur film transfers: film can capture a much wider range of dark to light than can video, and if you rely solely on the auto-exposure you may end up with exposure that looks like this horrible YouTube example (I've posted this before, and there are thousands more like it):

Pink Floyd Concert (http://www.youtube.com/watch?v=aPmijzAjvd4&t=18m14s)

As you can see, the body of the guitar no longer exists, even though I'm pretty sure that it was there on the original film. This example has a dozen other problems, but I post it here simply to show the exposure problem.

The solution to this hopefully exists in your DSLR, although it may not. On most traditional camcorders there is a "spotlight" function. This is designed to make the auto-exposure far more sensitive to small areas that are very bright, such as what you get when a performer is lit by a "follow spot." Using this feature, the camera will usually do a good job of exposing for the highlights. This often makes the shadows pretty dense, but you can adjust for that in post using either the features in your NLE (I use the "Color Curves" function in Vegas) or using various AVISynth plugins, like HDRAGC. AVISynth should be able to do a better job than the static NLE adjustments, but I've never been able to make any of the AVISynth auto-gamma plugins work the way I expect, so I do the adjustment manually in Vegas.

I also do one other thing for really critical transfers: I use the AE compensation. On most cameras this takes the exposure created by the auto-exposure and then adds or subtracts a set amount from that value. This lets you use auto-exposure but then adjusts (usually in the darker direction) to avoid blowing out the highlights.

Finally, always use the zebra function on your camera. This highlights sections of the film that are being overexposed so that you don't end up with nothing in the highlights. If your camera doesn't have zebras, that is going to be an issue ...

Remember that once over-exposed, the detail is gone forever; but if under-exposed, you can usually recover some detail from the shadows. As I've posted before, the ideal situation is to use a camera that lets you define your own gamma curve. This was discussed earlier in this thread (or in the parallel thread on film transfer -- I can't remember now which thread).

Oh yes, you asked about capture formats. Most DSLRs can capture in JPEG format. This should work great, and you can use either VirtualDub, AVISynth, or your NLE to assemble individual JPEG images into a video file and then save the result using whatever codec you want. Cineform, MJPEG, or Lagarith would be my initial choices for HD, and DV would be my choice for SD.

giuso71
8th March 2014, 13:41
Hello,johnmeyer, i've downloasd scenalyzer but i can see that it doeesn't work with wifi cam (That's to say ip HD video camera).
Can you suggest me something?

johnmeyer
8th March 2014, 18:09
I don't know who suggested Scenalyzer. It is a great (although no longer supported) application but is only for DV video. It most definitely will not work with HD.

Most people who go this route simply use the application that came with their capture card. The reason I answer the question that way is that you are somewhat limited in how you can import HD video into a computer. HDMI is used for getting video onto a TV screen, but the HDMI specification includes encryption to prevent copyrighted material from being captured. So I don't think you'll find an HDMI capture card that will work for you because their functionality is intentionally limited.

You can simply capture to your camera's memory card and then take the video from that. However, this brings us to the second problem in capturing HD video: compression.

Almost every camera compresses the video into (usually) AVCHD before sending to the memory card or even to an external capture location. Because of the long GOP used in this compression, the individual frames, when viewed one at a time, are not very clean compared to the original HD video at the moment it was captured. The key to good "frame accurate" film transfer is to capture each frame of film onto one frame of video with no compromises.

I actually did try to use the Firewire output from my Sony FX1 camera during my first attempt at capturing HD from my film transfer machine. I was able to capture the stream and then extract individual frames from that, but you could actually see the individual frames degrade as the stream got to the end of each GOP.

The right way to capture HD is to use a camcorder which has component output and then purchase a capture card for that. The video sent over this connection has not been compressed and, with the proper capture card, you can capture and store each frame and do the compression at that point in time or, if you have the space, store each image uncompressed.

As I've said several times in previous posts, you will get very little, if any, improvement capturing 8mm and Super 8 in HD. In an earlier post you said you did see an improvement when using an HD camcorder, but my guess is that this may be due to using an inferior SD camcorder. What I would suggest is that you consider getting an HD camcorder that can capture in SD. This is what I do (with my Sony FX1). It sensor captures in HD, and the lens and sensor are all upgraded to deal with HD. It then has the option of doing the downconversion to SD in the camera and outputting SD. I then use Scenalyzer to capture this output.

The important thing to note in this last paragraph is that there are a HUGE number of things that matter when choosing a camera beyond the one specification of whether it outputs SD or HD: the quality of the lens matters; the ability to control gamma matters; the color correction (white balance) matters; the focus controls matter (manual focus; focus assist); exposure controls matter (you should not use a camera if it doesn't have zebra patterns to indicate overexposure, IMHO).

giuso71
8th March 2014, 18:27
Hi
you're right.
You've told me : "For stop motion, I use SCLive", but if i surf on google i find Scenalyzer.....Sorry
Here (http://www.blackmagicdesign.com/it/products/intensity) i can see a box that work with Hd, without problem with encription, i suppose. Than, if i buy a hd video cam and that box i can have a HDMI in trhough my USB3.0. Is that right?
But i'd like not to buy 2 different things, than i think that even via wifi 802.11n i can have on the pC HD video. The problem is the software. Isn' it??

johnmeyer
9th March 2014, 00:20
Someone else will need to help you with your latest questions. I have some ideas, but I only like to post about things I have actually done myself. I don't own the BlackMagicDesign products, but that is definitely what I would look at getting if I were going to do what you are doing.

bookemdano
10th March 2014, 20:09
Hi again johnmeyer,

Sorry for the delay in response. After reading your last post I really started thinking about ways I could avoid using h.264 as the capture format.

MJPEG is just not an option with Canon DSLRs (I know it is with Nikons though), and the amazing Magic Lantern firmware has not yet added it.

However, I think I will be able to do even better. Even though my Canon 6D is gimped in terms of card write speeds (you need a 1000x CF card for continuous full HD capture), I have been able to capture 14-bit RAW in 960x800 with sound (to record the beep track used later to get rid of the duplicate frames). After finally getting a stable rig set up for the projector and camera I was able to capture a reel yesterday (projector @ 6fps, DSLR at 24fps) and I am liking the results. As you have said, 8mm/Super-8 probably can't benefit from full HD-resolution anyhow. But by recording in RAW format, I should be able to capture a lot more dynamic range, and more importantly, because RAW files are essentially just the data from the sensor itself, the exposure can actually be adjusted after the fact in post. Same thing with color correction. Powerful stuff!

Now though I am trying to figure out the workflow, as RAW complicates things a bit. For a 50foot reel projected @ 6fps a 24fps capture is 9-10mins in duration and spits out a 20GB file in a MLV container (this format is a creation of the magic lantern developers). There are various apps, scripts, etc. to deconstruct the mlv file into a sequence of DNG images, along with a wave file of the audio track.

I've gotten as far as creating the set of ~14,000 DNGs and the wave file. I can open the image sequence in DaVinci Resolve (I am brand new to this program but it seems very powerful). But considering the power RAW brings to the table, it seems I should do the exposure and color adjustments first (rather than get rid of the duplicate frames) because it appears that avisynth can't deal with RAW files--I would need to transcode into something avisynth could deal with.

I also recently came across this thread (http://forum.doom9.org/showthread.php?t=168830) where a guy developed scripts to use your method for removing duplicate frames from his DSLR-captured telecine. Because I'm not exactly sure how in-sync the audio will be from the DNG sequence for GetDups I am tempted to try his/your solution instead since it doesn't need audio at all.

It also got me thinking about the possibility of transcoding a copy to mjpeg or something to run through Avisynth with DeDup to mark the location of the duplicate frames and then use the ensuing log file to somehow delete the duplicate frames from the original set of DNGs. That may not be feasible. I will contact the author of those scripts to see if he has any ideas.

I did figure out how to grab a still using Resolve so I put it up in my dropbox as a jpg (~700KB) here (https://www.dropbox.com/s/qm878lfiroipqmn/Test_1.1.1.jpg). I did not make any adjustments yet. Note that Resolve exported it in 1920x1080, my original capture area of 960x800 was completely filled by the projected image. And yeah, my Dad evidently never cleaned the fuzz out of his camera gate!

You can see that the camera actually captured image detail in the curtain right next to the sunny window. I'd have to double check but I think my h.264 capture of the same reel had blown that out.

So while this is adding yet more complexity, I think it may be worth doing it this way. Would much appreciate your thoughts.

EDIT: Yes, here's (https://www.dropbox.com/s/fw4cae8b37ordg7/Testh264.jpg) the same frame (or thereabouts) from when I did the capture @ h264.... big difference.

johnmeyer
11th March 2014, 03:44
It is tough to comment on what you posted because you touched on so many different subjects.

Working backwards:

The still you posted is from an indoor shot. It looks like there might have been a movie light involved. It would be more instructive to post a frame from an outdoor scene, preferably taken on a cloudy day. One problem with DIY telecine is the hot spot you typically get when a projector is involved. There are ways to reduce this with AVISynth, but it is better to work on your rig to reduce this before the image is ever captured. The upper and lower left corners of your image definitely show a considerable drop off in exposure, but as I said, perhaps a video light was being used, and most video lights of that era had a beam spread that was more narrow than the Super 8 lens when it was in wide angle.

I got very confused as to whether you are capturing individual images as RAW and then converting to something else, or whether there is something else going on. If you are capturing individual frames to individual RAW images, that could be a very interesting approach. As you say, RAW could let you do some wonderful manipulation of the gamma (and color) before assembling into a video image. If this is indeed what you are doing, then the key to the workflow will be to use a photo editing program that can perform batch processing. Most can do this, but setting it up will be an interesting challenge. If you succeed, you should be able to get some stunning results.

Once you have manipulated each RAW image, then you can convert them to some sort of lossless intermediate, and from there assemble them into an editable video file. Most video editors let you assemble PNG and JPEG "image sequences" into a video file. You will then be able to save that file using whatever codec seems appropriate. If MJPEG isn't working for you, then I think I probably suggested the Cineform codec which is now available for free from the GoPro site (they now own Cineform). While this is defeatured compared to the professional version that is available for purchase, it is probably adequate for what you need.

bookemdano
11th March 2014, 04:29
Sorry, johnmeyer. I should have clarified. This is somewhat like the RAW still images that DSLRs can take, except that it is done while the camera is in video mode and without actuating the shutter (and at very high frame rates compared to still images--24p). Because it's so much data though, the write speed of the memory card is the bottleneck so you can't get the resolutions you can normally get when taking raw still photos.

It's similar to what the Blackmagic cinema cameras (and RED) can do out of the box. Canon's DSLRs are not supposed to be capable of this, but with the 3rd party "Magic Lantern" firmware addition they have gained this ability (just at limited resolution). It's extremely new, only having been made possible a year or so ago.

There are lots of comparisons and sample videos on the net, but here (http://www.eoshd.com/content/11395/real-difference-normal-dslr-video-5d-mark-iii-raw-video) is a site that summarizes the benefits pretty well.

If it helps, yes you can think of what I did was shoot 24 RAW images per second, and yes they are in the form of an image sequence. There are several editing programs which are able to open up the image sequence as a video and let you work with it as if it was a video.

Yes my Dad's camera had a light, and I am pretty sure it was used in that scene. Here is an outdoor scene to show you. EDIT: sorry I know you said cloudy but didn't have any such scenes on this reel (which is the only one I have attempted in raw format thus far).

RAW (https://www.dropbox.com/s/yety8o6xgaepfli/Untitled_1.1.2.jpg)
h.264 (https://www.dropbox.com/s/douhlr579xzt6ii/Testh2642.png)

Thanks for bearing with me!

EDIT: Looks like doom9 had some downtime there. I'm still trying to figure out if there is any way I can get rid of the dupes prior to transcoding. Avisynth can't deal with the DNG raw files obviously. But I could transcode a "proxy" to something small, detect the duplicate frames using that, and then ideally produce a text file with the frames "to keep" (which I could then script to act against my set of raw frames).

If I can't figure out a way to do that then I guess I would need to do all/most of the exposure and color grading adjustments first, then transcode to cineform, then remove duplicates/VideoFred scripts, then back to the NLE for editing/titles/soundtrack, etc.

One thing I am going to do is try capturing one of my Dad's old 8mm B&W cartoon films (gotta clean it first). That should allow me to judge the focus better and detect if my lens is causing color fringing. I am using a pretty well regarded Canon zoom lens (AF broke on it so I'm not presently using it for anything else). But if it's not going to give me even focus across the field or has too much chromatic aberration I may break down and buy a macro lens.

Anyway, hopefully I can do this here in the next day or so. Will post some frames up ASAP.

papcom
22nd July 2014, 09:34
Here (http://www.blackmagicdesign.com/it/products/intensity) i can see a box that work with Hd, without problem with encription, i suppose. Than, if i buy a hd video cam and that box i can have a HDMI in trhough my USB3.0. Is that right?
But i'd like not to buy 2 different things, than i think that even via wifi 802.11n i can have on the pC HD video. The problem is the software. Isn' it??

@giuso71 - You need a camera of this kind plus a camera control software which is available at the same place. Your projector must be modified in order to output a trigger pulse for each filmframe, as well as with a motorspeed control in order to determine the rate of FPS which can be captured per second. So each filmframe will be captured one after the other by the camera and memorized (via firewire or USB or GigE) on Your Computer. (as an image sequence or e.g. as an AVI)

http://www.theimagingsource.com/de_DE/products/cameras/

Pieter8mm
29th August 2014, 19:33
I have some old footage and I like to make the script so that i can see the different with S1 from Fred's script

What do I have to change in Fred's script to make my footage
16x9 like Fred's example at: http://vimeo.com/37394781 ?
My footage is 1280x960

johnmeyer
29th August 2014, 20:54
You just apply a crop. However, as you see in Fred's examples, you lose a LOT of the image. Are you sure you want to throw away all that picture information??

Pieter8mm
30th August 2014, 17:43
John I don't know for sure. I like to see the difference. If I use S4 and crop something only the comparison on the right crops. And after a day messing around in the script I gave it up. A other question:
Is het possible to remove yellow flames on the edge of the frame with a script? Some replacement from frames before or after the shot

johnmeyer
30th August 2014, 21:40
If I use S4 and crop something only the comparison on the right crops. The whole idea of the "S" is to give you a "before" and "after" comparison. Therefore, by design, only the "after" is going to show the crop.

papcom
9th June 2015, 11:28
@johnmeyer - I would like to add "AutoAdjust 2.5" in Your Film Restoring Script. Can You give me a hint where I optimally place the codeline for "Autoadjust" ? - Thank You very much.

johnmeyer
9th June 2015, 15:48
I would like to add "AutoAdjust 2.5" in Your Film Restoring Script. Can You give me a hint where I optimally place the codeline for "Autoadjust" ?I retained all the headings of the original VideoFred script. This lets you see what each section of the script is doing. I have never used AutoAdjust, but it looks like it is supposed to automatically attempt to change gamma levels and do white balance corrections (both of which I recommend you do manually). You will see that VideoFred did this all in one single line, under the heading:

#RESULT1: AUTOLEVELS,AUTOWHITE

So, just replace the code after "result1 = " with "PreBorderFrame.AutoAdjust()" or something like that. You'll have to decide how to handle all the border adjustments in that line. Some of them were put in there to make the autolevels filter work better, and you may not need them. Some of the others are there to restore borders that were cropped earlier in the script.

So, something like this might work:

result1= PreBorderFrame.AutoAdjust.addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)

However, I don't have time to try out this code.

papcom
10th June 2015, 18:19
thanks @johnmeyer - I personally like AutoAdjust 2.5 and it gives me good results ...but of course it is not a colour correction.

Anyway , I checked several positions for the "AutoAdjust" - line and I found a place where it suits best to my needs. I don't want do alter Your resp. Fred's script. I just want to add the line with AudoAdjust .

Can You please give me another hint regarding Your script? There is the following part in Your script:

source1= Avisource(film).assumefps(play_speed).converttoYV12().FlipHorizontal()AutoAdjust(auto_balance=true)
cropped_source=source1.crop(in_bord_left,in_bord_top,-in_bord_right,-in_bord_bot) #remove any black borders on input video
setmtmode(2)

I want to crop a black border of 8 Pixel around my 720x576px Video. If I set the source1.crop on the value "8" I do not see any alterations in my Results. What is my thinking fault?

johnmeyer
11th June 2015, 00:15
The video card in my main computer just went up in smoke (literally), so I'm not going to be able to answer this for some time, until the replacement card arrives. Someone else can hopefully provide an answer. Cropping is pretty straightforward. Just look at the AVISynth documentation and I'm sure you can figure it out.

Boffee
11th June 2015, 08:13
If you want to "add" autoadjust to John's script why not have a result 5 such as:-

#RESULT5: WITH AUTOADJUST
SetMtMode(1)
result5= PreBorderFrame.Autoadjust(auto_gain=true,high_quality=true,gain_mode=1,avg_safety=1.0,auto_balance=true,temporal_radius=0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)

resultS5= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result5,"autoadjust",size=28,align=2))

Boffee
11th June 2015, 09:10
If I want to do a simple crop. I open my script in AvsPmod. There is a handy crop editor in there under "Video" that will write a line of script for you. It will add that line at your cursor position.

papcom
11th June 2015, 10:51
thank You for Your answers - I know how to do"cropping" in avisynth! My question pointed exclusively to the specific line in Videofred's/Johnmeyer's Script. - I couldn't figure out why this line had no influences in my tests. And I would like to understand this.

thank You @bofee for the hint with "autoadjust" and result5.

johnmeyer
11th June 2015, 18:59
I know how to do"cropping" in avisynth! My question pointed exclusively to the specific line in Videofred's/Johnmeyer's Script. - I couldn't figure out why this line had no influences in my tests. Ah, I didn't realize that was what you were asking.

I added the "in_border..." parameters (VideoFred's scripts don't use this) for captures that contain borders. For instance, 8mm is almost perfectly square, and when captured with normal 4:3 video equipment, you end up with black borders ("pillars") on the left and right side.

But here's the problem, and this is why I added these new border parameters:

If you don't do anything, then the motion stabilization step will move the entire frame around in order to stabilize the main motion, but this will also cause the black borders to wander around, creating a huge mess. This is totally unacceptable. However, the final result must have borders because you are fitting, literally, a square peg in a rectangular hole. Yes, you could blow it up or stretch it, but both of these options degrades the main image.

So, what I did was to create a set of variables which temporarily remove all black borders. This temporarily cropped image is what the rest of the script sees. Then, as one of the last steps, I add back in, exactly, the borders which I took out. Doing it this way not only eliminates the "wandering border" problem, but it also gives me clean crisp borders, unlike the somewhat fuzzy borders you get when doing captures from a device which has an "open gate" and can capture the movie film all the way to the edge of the frame.

So, bottom line, no matter what "in_border" you specify, you will still have borders in the final result. If you specify too large a value, you will end up with borders which are even larger than your original, and you will start to lose part of the original image. So, ideally, you want to specify in_border amounts that are just slightly more than the original borders, both to make sure you get a clean new border, and to account for a certain amount of slop and gate weave in the original capture.

papcom
13th June 2015, 19:33
thank You @Johnmeyer for Your explanation. So how would recommend to remove the blanking around the following picture with Your script,. in order the video is clean?

johnmeyer
13th June 2015, 22:05
I can't see your image, since it hasn't been approved. I always upload my images to PhotoBucket and then link to them. That way, the are available to everyone immediately.

Since you made a point, in your prior post, that you know how to crop an image,
I know how to do"cropping" in avisynth!
I don't know what help you need from me. Just crop it to remove whatever you don't want.

papcom
14th June 2015, 11:40
Since you made a point, in your prior post, that you know how to crop an image, I don't know what help you need from me. Just crop it to remove whatever you don't want.

...after You explained in detail the problems around cropping in Your script, I became unsure about using "crop" in Your script. The remark at the "in_board" - line suggests that it's there where the cropping should happen, but obvivously it's not there.

#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=16 CTop=16 CRight=16 CBottom=16 #crop values after Depan and before final resizing
W=720 H=480 #final size after cropping
in_bord_left=0 in_bord_top=0 in_bord_right=0 in_bord_bot=0 #Borders around input that must be removed

BTW: I don't use photobucket and other cloud services anymore. The all have agressive spamming. Rather I wait some hours in order my pics will be approved to display.

StainlessS
14th June 2015, 13:28
wait some hours

Everyone else has to too.

agressive spamming

Use Firefox with adblock and also Flashblock addons (also way less dangerous than every hackers favorite target [ie]).

EDIT: Having said that, I usually disable FlashBlock temporarily for Photobucket, but only because Copy URL to ClipBoard
works via Flash.

stephen22
16th October 2015, 16:37
I suddenly can't get the scripts to work. There seems to be a problem loading plugins. Of all these...

LoadPlugin("plugins\Deflicker.dll")
Loadplugin("plugins\Depan.dll")
LoadPlugin("plugins\DepanEstimate.dll")
Loadplugin("plugins\removegrain.dll")
LoadPlugin("plugins\removedirt.dll")
LoadPlugin("plugins\MVTools.dll")
LoadPlugin("plugins\MVTools2.dll")
Loadplugin("plugins\warpsharp.dll")
loadplugin("plugins\autolevels_06.dll")
LoadPlugin("plugins\Motion_06Dec05B.dll")
Import("plugins/03_RemoveDirtMC.avs")

...all load except removegrain, removedirt and warpsharp - for these 3 I get a VD error "unable to load - module not found." (also if I rename one of the others - so they are in the right place.)

Help anyone?

Fizick
12th April 2016, 20:48
may be new depan v1.13.1 mode=2 will be useful for small stabilization of static objects like sprocket holes