Log in

View Full Version : The power of Avisynth: restoring old 8mm films.


Pages : 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

videoFred
17th February 2011, 07:19
That question about a "new" script was just referring a future update Fred mentioned in a post, on 10th November, maybe with the last Autolevels plugin.

Ah yes, now I see. Well.. you can do it yourself. Just replace the old autolevels.dll with the new one, and add some of the new parameters if you need them. But Frustum is still working on it, there's a thread about it:

http://forum.doom9.org/showthread.php?t=128585&page=4


Fred.

Gargamel
17th February 2011, 09:18
Sorry, my english was (is) not very clear... ;-)
I'll do as you say. Thank you for the link.

One thing more: In the first times, I intended to use the script, only to cure a few Super 8 footages (those which were a little too unstable and/or "dirty"). But I quickly saw the obvious improvement, and now ALL the family films I transfer to burn DVD, even the best ones, are cleaned and stabilized, trying to set the corrections "just as I have to do" for each reel, sometimes each take, for as John said "no two reels are the same, and each is going to require custom tweaking".

Logar
5th March 2011, 02:17
I need help. I would like to improve the quality of my Super 8 films. I followed the "film restoration script by videoFred". Intalled Avisynth
and other programs for it. Changed only two parameters in -> play speed=20 and numerator=30 because I record my films in NTSC with 1/60, I can
run my .avi file in VirtualDub. Unfortunatelly when I want to run the restoration script I got the following: Avisynth open failure: I don't
know what "stab_reference" means.
MT command commented out with # because my CPU is AMD Athlon 64 Processor 3500+ 2.2GHZ
Please advice me how can I run this Avisynth script without error. BTW is it any chache to improve on this film: http://www.youtube.com/svaradi#p/a/u/1/w740GzJYO1c ?
Thanks.

johnmeyer
5th March 2011, 03:58
I got the following: Avisynth open failure: ... BTW is it any chache to improve on this film:
I can't help you with the AVISynth error. Someone else will have to do that.

However, if you want to use the script, you won't get good results with the film you linked to. I downloaded your video from YouTube, and it looks like you used a 100 fps camera to capture the film from your projector. There are many, many duplicate frames where no motion occurs. These must be eliminated using an inverse telecine script (IVTC using TFM and TDecimate). In addition, even after you eliminate the duplicates, you still have some ghost frames that result from using the video camera to capture film from a projector. You may still be able to get results from Fred's script, but these ghost frames will probably reduce the ability to get good sharpness, and may fool the motion estimation algorithms.

Logar
6th March 2011, 01:20
These must be eliminated using an inverse telecine script (IVTC using TFM and TDecimate).

I see an IVTC filter in VirtualDub this will working for me? I do not know what is TFM and TDecimate. Sorry, I just start to learn this film restoration process.
Thanks for the advice.

Logar
6th March 2011, 01:41
I forget to explain how I captured this film. I used my videocamera setting exposure 1/60 sec. in NTSC system. Projector set on 20fsp. After I edit this film in iMovie: slow it down 15%,flipped, crop, rotate. Maybe the ghost frames came from the slowing down the film?? BTW in VirtualDub I see 7127 frames playing time 3:57:804 this is 29.97 fps as standard NTSC. Should I change something in this workflow order??
What program determine: "used a 100 fps camera" ?
Thanks.

johnmeyer
6th March 2011, 22:38
The 100 fps is what GSpot reported on the MP4 that I downloaded from YouTube. From what you say, you just used a normal video camera, so I don't know how the file got set to 100 fps. That actually isn't important. What IS important is that there are a LOT of duplicated fields and frames. If you want to use Videofred's script, you have to remove these. The IVTC in VD isn't useful: you have to use the TIVTC.dll plugin for AVISynth and then use these two functions:

tfm(display=false)
tdecimate(mode=0)

However, for your video, you will have to use settings other than the defaults, because you have a very non-standard cadence.

videoFred
7th March 2011, 07:54
Unfortunatelly when I want to run the restoration script I got the following: Avisynth open failure: I don't
know what "stab_reference" means.

This means you have disabled or perhaps deleted the first line of the stabilisation code. Why have you done this?

Fred.

Logar
7th March 2011, 21:04
I have to command out this line because it contain MT_binarize also. I do not have multi core CPU:( Ok I break the line before MT_binarize. Now the next error: Avisynth open failure: I don't know what "result5" means
Is it possible to run this script with single core CPU computer? How?
Thanks.

Logar
7th March 2011, 21:08
I comment out. Sorry for my mistake.

um3k
7th March 2011, 23:45
MT_binarize isn't for multithreading, it is part of MaskTools. Leave it enabled. :)

Logar
8th March 2011, 07:16
Thank you very much! Finaly Avisynth is running without error. The result is not satisfy me yet, but at least some progress. Now come the "fine tuning".
Thanks again.

Logar
9th March 2011, 01:27
One more question: I see now in the VirtualDub right panel "Result3: autolevels, manual color correction" What happened with Result4 and Result5?? Maybe my script is working only partially?? Any idea how can I get more details from the "dark" exposure parts?
Thanks

johnmeyer
9th March 2011, 05:09
One more question: I see now in the VirtualDub right panel "Result3: autolevels, manual color correction" What happened with Result4 and Result5?? Maybe my script is working only partially?? Any idea how can I get more details from the "dark" exposure parts?
ThanksYou get different results by changing the Results parameter.

result="result3"

will give you #RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS

If you put an "S" in front of the number, you can see both the original and the corrected version side-by-side.

Result5 is a special test clip. Don't use it.

To get a brighter clip, use Results1 or Results3, since they both have Autolevels. You can then brighten the image further by setting the "gamma" parameter to something other than 1.0. If you use manual levels, you will probably find settings in the 1.05 - 1.20 are all you'll need. With Autolevels, you may need to use larger amounts.

videoFred
9th March 2011, 08:20
@ Johnmeyer: thank you for the support John. :)



One more question: I see now in the VirtualDub right panel "Result3: autolevels, manual color correction"

It's not the VirtualDub right panel. It's the left panel. The split screen is done by the script.


What happened with Result4 and Result5??

I have added a manual, Logar. Please read it.

Fred.

Logar
10th March 2011, 01:02
[QUOTE=videoFred;

I have added a manual, Logar. Please read it.

Fred.[/QUOTE]
Thank you for your support. I was so eager to start the project I forget to read BOTH files. I read only the installation help.
Now I read Film_restoring_help.txt also.

I still do not know how to save .avi file with the result ONLY panel in it?
Do you know any similar program for Mac OS X?? My MacBook Pro is much faster than my windows computers.

johnmeyer
10th March 2011, 01:16
I still do not know how to save .avi file with the result ONLY panel in it?Please read my last post. I already answered that question! Repeating myself: remove the "S" from the result:

result="resultS1"

gives you both the before and after video in the same frame;

result="result1"

gives you the "result ONLY panel," as you described it.

Undead Sega
10th March 2011, 04:55
It is a telephoto lens, designed for projecting to a screen a long way away, like in an auditorium. There is no such thing, I don't think, as a "macro" lens for a projector.

You put the video camera about four inches from the lens, which is prior to the focal point. This means that the image is upside down (it becomes right side up after it crosses the focal point). If you get the correct lens, you can fill the video frame, and will get a sharp image edge-to-edge. I contacted Roger Evans (inventor of the Workprinter) after I accidentally discovered this when trying to adapt his Workprinter aerial lens to my home-made setup. I just happened to have purchased a projector on eBay that had been used for projection in a school auditorium, so it had a telephoto lens, rather than the shorter lens used for projection in a classrooom.

Hi again, sorry for bringing this up but I am still liking to restore my 16mm animated film reel that's faded red, but from re-reading our past posts I believe there was a misunderstanding.

What I was trying to say regarding the lens, I was merely talking about the lens on the camera and not the projector, thus wouldnt one remove the projector's lens so one can directly see the film plane, and use a macro lens on the camera itself to record the film that's projecting in the film plane. Not a macro lens on the projector which lead you to say that there isnt one to your knowlege, this is where I think the confusion was.

And once again, would an Elmo 16-CL projector be a good choice for a project like this or similar to yours?

Anyways I hope that clears some things up, and I hope to hear back.

johnmeyer
10th March 2011, 07:13
There is no way to focus on the 16mm frame without using a lens in the projector. Just put a frame of 16mm film on a table and see if you can get it to fill the entire frame on your video camera. I don't think you can do it.

I don't know anything about the Elmo 16-CL, so I can't help you there.

Pieter8mm
16th March 2011, 18:01
Hello everyone, first time posting and a little scared to join the 8mm-grandfathers. It all started by Fred vimeo example's for me, and I was blowing away seeing the results by the script from Freddy!!

A few questions
Wy are the output avi files so big?
input file avi 3Gb and the output file from the script is around 30Gb.

Pieter

johnmeyer
16th March 2011, 18:42
Wy are the output avi files so big?
PieterYou have to choose a codec to compress the video. Otherwise, you get uncompressed video, which is huge.

If you are using VirtualDub to read the output of the script, then go to the Video menu and choose Compression. Choose something other than "uncompressed." There are many choices, and you may have to download a codec to get something that works for you. Free lossless codecs include HuffYUV and Lagarith. You can also use codecs with higher levels of compression such as DivX and Xvid.

Boulder
16th March 2011, 19:47
Also don't forget to set "Fast recompress" to avoid conversion to RGB and then to the compressed format which often is in YV12.

tin3tin
17th March 2011, 09:30
Check out this setup for transfering 8mm with a Canon 5Dmk2:
http://vimeo.com/20950590 (http://vimeo.com/20950590)

Pieter8mm
18th March 2011, 12:48
Thanks for the response. I tried both codecs and the file size is smaller but Pinnacle 12 don't recognize this codecs.

If you are using VirtualDub to read the output of the script
Do I need to change something in the script for the right output?

videoFred
18th March 2011, 13:05
Do I need to change something in the script for the right output?

Please read post #414. John Meyer has explained this to someone else.

Fred.

Pieter8mm
18th March 2011, 14:47
Dear Fred ,
I understand the output thread 414. I thought John meant something else in the script has to change but it's clear for me now. Thanks.:)

Undead Sega
25th March 2011, 03:48
Check out this setup for transfering 8mm with a Canon 5Dmk2:
http://vimeo.com/20950590 (http://vimeo.com/20950590)

This guy is doing almost exactly what I was trying to say before! :D

torwart
26th March 2011, 08:56
Hello gyes.

I think only this forum can help me. I have a video(mpeg2DVD) from an old 8mm film and I want to clean it from dust, scratches and dirt. I tried different plugins for avisynth and even Freds script, but nothing helped. Maybe it is very dirty. :) . If you can suggest some filters or scripts for this video it would be great. Here are 3 screenshots from video:

http://i064.radikal.ru/1103/c7/f76094d67d7a.jpg

http://s016.radikal.ru/i334/1103/52/49b84a6d7668.jpg

http://s014.radikal.ru/i327/1103/8a/9679f58a7d42.jpg

Thank you!

johnmeyer
26th March 2011, 16:39
Hair is almost impossible. Long scratches are also difficult. However, the "RemoveDirt" plugin, used in Fred's script does a remarkable job on the dirt spots.

If you still have the film, then you should try to clean it with Edwal Film Cleaner or similar product. Use a clean pure cotton cloth or a "Pec Pad" dampened with this solution. You can also use pure isopropyl alcohol (not rubbing alcohol, which contains water), but it doesn't dry as fast as the Edwal.

torwart
26th March 2011, 18:53
Thank you John, but I have only video file. Also I tried remove dirt plugin but result i 0. I don't know what to do.

Didée
26th March 2011, 19:12
Usually, the difficult part isn't the dirt removal. Temporal Median Filters are mighty at this. The bigger problem is to avoid the artifacts from false clamping. That's because in case of "big" dirt, it is very difficult to decide what is good and what is bad. Figuring whether temporal neighbor pixels are related or not-related is difficult, and spatial safeguarding also is somewhere between "very difficult"..to.."impossible", because the neighbors of dirt pixels are ... dirt pixels.

Something along the lines of global/pan compensated temporal median filtering. Probably as one step of a multi-step approach.

johnmeyer
26th March 2011, 19:50
I have restored dozens of hours of 16mm, 8mm and Super 8 film. The RemoveDirt plugin really works well, and seldom removes things it shouldn't. Here is all you need:

loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\RemoveDirtSSE2.dll")
RemoveDirtMC(source,23,false)

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

function RemoveDirtMC(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
i=MSuper(clip,pel=2)
bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
backw = MFlow(clip,i,bvec)
forw = MFlow(clip,i,fvec)
clp=interleave(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}


Before/after results here:

Remove Dirt (http://www.youtube.com/watch?v=4Gy9ZG23TTk&feature=channel_video_title)

Although the above example on YouTube used VideoFred's script, all of the improvement in dirt reduction that you see was from the removedirt function above.

Didée
26th March 2011, 21:24
That works out for relatively small speckles, but will necessarily fail for bigger spots of dirt. RemoveDirt on its own can not distinguish between local motion and local dirt. MVTools necessarily fails on sufficiently polluted blocks.

I'm not arguing against the practical improvements that can be achieved by such a script. Just want to point out that the measurings and decisions are rather vague and contain a good amount of uncertainty. The underlying problem is unsolved.

See ...
The RemoveDirt plugin really works well, and seldom removes things it shouldn't.
... when I use that script, I hardly need to search for removed objects.

Arrow? what arrow? - Arm? what arm?
http://img217.imageshack.us/img217/8361/remdrtmc01.th.png (http://img217.imageshack.us/i/remdrtmc01.png/) - http://img163.imageshack.us/img163/4871/remdrtmc02.th.png (http://img163.imageshack.us/i/remdrtmc02.png/)

I spare you the examples of deformed structures. (Unless you insist.) In fact, those are a bit harder to find.

johnmeyer
26th March 2011, 21:47
Are you saying that in the practical before/after example I posted, that the "after" wouldn't be 100 times more enjoyable to watch?

I agree that some real objects are occasionally removed, but when you deal with dirty film, rather than pristine video, and are simply watching the result rather than looking for flaws, the improvements, IMHO, completely negate the occasional small problems. Also, using a smaller input to RemoveDirt often takes care of the problems you show.

I can't think of any tool or algorithm that doesn't introduce artifacts or cause problems with some types of input. I therefore do not think this is a valid way to measure the success or failure of that tool. The correct measure is whether the resulting video is more enjoyable for most people to watch.

If someone has a better solution, then I will use it instead. Until then, in the real world of amazingly dirty amateur 8mm, Super8 and 16mm film, this tool does a great job and will give you something that is much better to watch than if you hadn't used it.

Didée
26th March 2011, 22:44
I'm not questioning the enjoyability of your examples. Just warning about worship of the golden calf.

From the screens posted by torwart, it is to be feared that Motion Search/Compensation will fail severely. If MC fails, everything fails. My guts are telling me that he'd rather need a multi-stage approach, like pre-cleaning before doing the MC for cleaning. Maybe even pre-pre-cleaning before pre-cleaning before final cleaning. Asymptotic solution, you know. A bit more tricky than plugging together the default-usage-examples of RemoveDirt and MFlow.

I know my [screenshot] examples could be considered "a bit unfair" -- obviously, low-contrast scenery is inherently problematic. But since you said "it seldom removes anything it shouldn't", I could not resist. ;)

torwart
27th March 2011, 10:35
Thank you John for your script , but it didn't work. I tried to change the parameters, but nothing changed. Steel searching for a solution. :)

videoFred
28th March 2011, 06:20
Thank you John for your script , but it didn't work.

The first thing you must do is deinterlace the source and remove any duplicate frames. Then you might have a chance..

Good luck!

Fred.

johnmeyer
28th March 2011, 06:27
Yes, you must have exactly one frame of film on each frame of video, or nothing will work. If instead you have one frame of film spread out over several frames of video, or two frames of film blended together into one frame of video, none of these scripts will work at all.

drewcox
28th March 2011, 18:20
Hi, my first post on the forum, though I have been lurking for a while. I've been working with Fred's film restoration scripts and think I've had pretty good success with pretty bad source material. See a sample of work in progress here (http://www.youtube.com/watch?v=YzVnTWkfZTw&hd=1):

http://www.youtube.com/watch?v=YzVnTWkfZTw&hd=1

I've been very impressed with the remove dirt process, certainly for single frame blemishes it is almost flawless for me.

My current challenge is a bad case of vertical scratches our old projector has carved into all these prints. I've tried to incorporate descratch into your scripts Fred, with some success. As you say, it's not perfect, but certainly more enjoyable to watch than without.

Have you done any experimenting with trying to remove these? Where in your workflow would you attempt it. After some experimentation I am doing it after stabilisation, before remove dirt. On that note, can you say a few words on why it is best to stabilise first, before removing dirt and noise?

Cheers
Drew

torwart
29th March 2011, 07:49
Thanks gyes! Script started to work after multidecimate plugin. There were random duplicate frames. You were right. Now the problem is , that I don't know what parameters(values) is better to change to have a script with more strict(hard) working. For me is better to loose some quality, but to erase this lines.

Thanks again.

videoFred
29th March 2011, 08:10
Have you done any experimenting with trying to remove these? Where in your workflow would you attempt it. After some experimentation I am doing it after stabilisation, before remove dirt. On that note, can you say a few words on why it is best to stabilise first, before removing dirt and noise?

Welcome here, Drew!

You are doing some nice film restoration work. I remove the vertical scrathes at the source: wetgate transfer.

Somehow it seems logical to me to do the stabilising first. But I have no scientific arguments for this :p

Fred.

videoFred
29th March 2011, 08:15
Now the problem is , that I don't know what parameters(values) is better to change

All sources are different. You must do the testing yourself.


For me is better to loose some quality, but to erase this lines.

Erase lines? What lines?

Fred.

torwart
29th March 2011, 08:53
I am talking about these dirty black lines that are on screenshots.

videoFred
29th March 2011, 09:26
I am talking about these dirty black lines that are on screenshots.

I see... Please try dirt_strength=60 or even more.

Fred.

torwart
29th March 2011, 10:36
sorry for my stupid questions, but where can I write dirt_strenth=60 ?? I can not find this parameter in script:

loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\RemoveDirtSSE2.dll")
RemoveDirtMC(source,23,false)

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

function RemoveDirtMC(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
i=MSuper(clip,pel=2)
bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
backw = MFlow(clip,i,bvec)
forw = MFlow(clip,i,fvec)
clp=interleave(backw,clip,forw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}

videoFred
29th March 2011, 11:03
sorry for my stupid questions, but where can I write dirt_strenth=60 ?? I can not find this parameter in script:

You will find it on top of my filmscript, in the parameters section:

#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------

dirt_blur= 0.1 # some blur before cleaning to avoid pixel artifacts
dirt_strength=40 # set this lower for clean films.

Please do not change 03_RemovedirtMC.avs!
And only change the parameters in my filmscript.

Fred.

drewcox
29th March 2011, 15:38
Hi Fred, thanks for your responses, I have another question for you!

My target output from your scripts are files for importing into a traditional NLE (probably iMovie) for further editing and incorporating some voice-over work we recorded from my parents a few years ago.

This would be a NTSC 720p project for viewing on a computer and AppleTV. I believe my target framerate is 30 fps (or is it 29.97?) for easy compatibility with iMovie defaults.

I am thinking I would like to slow down the 18fps 8mm source to ~15fps and then generate 1 interpolated (or blended) frame between each of these to get back to 30fps.

This would have the added benefit of slightly slowing the overall playback, which is a good thing as my Dad seemed to never take a shot longer than 3 seconds. More jump-cuts than a 90's MTV music video. I guess that Super-8 film was expensive in the 70s...

Anyway, I am working with settings like:


play_speed=15 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 30 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps

Is this the right approach? Can you forsee any issues?

I am getting some interpolation artifacts in some high-motion shots, I might end up having to render both interpolated and frame-blended versions and picking and choosing between them during editing. But it's worth it for the smooth playback compared to 18fps...

Thanks
Drew

torwart
29th March 2011, 19:14
please somebody give me a link of Freds filmscript. I can' t find it on site. :thanks:

Didée
29th March 2011, 19:23
Ermh ... 1st link in the 1st post on the 1st page of this very thread?

torwart
29th March 2011, 21:14
Freds script works just amazingly. I have no words!!!! Now I have a last problem :) . how to make a final clip??? when I drop the script in virtual dub it shows 2 videos(before and after). what I have to do to have my final amazing clip???????