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

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

 

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

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th October 2011, 00:11   #1  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Recover image from shutterless 16mm projector capture

I have posted here before about the unique way that I capture film from a shutterless 24 fps 16mm projector. I have transferred hundreds of reels of film, but have never been 100% happy with the software I have been using (based on TFM and TDecimate) to recover the film frames from the video capture.

I would like to improve my software and would be grateful if anyone has some hints or ideas of other software or scripts that I might use to improve the accuracy of the process. For anyone interested in the challenge, here is a short clip of the raw capture. It is DV format, so it is BFF. If you separate it into fields and then walk through it, I think you will very quickly understand how the capture works and what the challenge is:

NTSC DV capture of 16mm film from a shutterless projector

I want to thank in advance anyone who provides even a small hint or idea. I think that ExBlend & SRestore might be better for this job, but I haven't been able to get them to work.

I don't want to make this post too long, but so you can understand how the system works, let me give you a short description:

I remove the shutter from the projector; I then point an NTSC interlaced camcorder (it HAS to be NTSC, and it has to be able to capture interlaced video -- 60p would also probably work) at the projector and set the shutter speed to 1/1000 of a second. It turns out that doing this absolutely guarantees that the camera will capture two successive fields from each frame of film. The video camera and the projector are not synchronized, so as the capture proceeds, sometimes you get two good fields in a row, with the next field all blurred because the film is captured during the moment the projector is moving the film to the next frame (remember, the shutter has been removed). Sometimes you can get three fields in a row that are all good and all from the same frame of film. All that is needed is to identify two fields in a row that are pristine and from the same frame of film.

Put another way, you always get two fields in a row that are from the same frame of film, and sometimes the next frame after those two is identical to the first of the two, and other times it is garbage.

There is a huge amount of movement from frame-to-frame when capturing film due to gate jitter and dirt, even if the film camera was pointing at a static scene, so it is usually pretty easy to identify one frame from the other.

So, what I need to do is to decimate the third good field, or the garbage field (captured during the film pulldown), and then recombine the two good, matching fields into a frame. I need to make sure that the two fields are from the same frame of film.

Now, here's the twist that may not be obvious: it turns out that it doesn't matter what order the fields happen to be captured, because once the frame of film is in the projector gate, it doesn't move until the projector pulls down the next frame. Thus, you can combine an upper field with the following lower field, and then at a later time combine a lower field with the following upper field. Again, this can be done because the film doesn't move once pulldown has stopped, so there is no temporal difference between upper and lower field.

Anyway, the software I've been using is based in TFM and TDecimate and never has worked 100%. I would like to create a better way to do this field matching and decimation.

Any ideas you have would be appreciated. FWIW, the following is the basic script I currently use.

Code:
# Script to recover film frames from film projected on shutterless 16mm projector.
# Copyright 2010 John H. Meyer
# Written February 16, 2010
#-----------------------------

loadPlugin("c:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")

AVISource("e:\frameserver.avi")

AssumeBFF()
source=ConvertToYV12(interlaced=true)

tfm(display=false,mode=2,pp=1,cthresh=25,micmatching=3,scthresh=2,mmsco=false)
tdecimate(mode=7,display=false, dupThresh=3.5,vidThresh=0.3,rate=23.976, hint=true,debug=false)

FlipVertical()
assumefps(23.976)

Last edited by johnmeyer; 15th October 2011 at 01:16. Reason: Moved the link to the clip from the bottom to the top of the post
johnmeyer is offline   Reply With Quote
Old 15th October 2011, 09:48   #2  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
shouldn't you just look for a frame change after a doubleweave?
jmac698 is offline   Reply With Quote
Old 15th October 2011, 13:36   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
ExBlend(), a non-starter on this I'm afraid.

I think that what you use already is pretty damn good, find below a little bit extra processing which
uses Didee's Blur(0,1.0) from your other thread. I've left in two flavours of MCDegrain, for you to try.

Code:
# Script to recover film frames from film projected on shutterless 16mm projector.
# Copyright 2010 John H. Meyer
# Written February 16, 2010
#-----------------------------

#AVISource("D:\avs\Sample clip.avi")
DirectshowSource("D:\avs\Sample clip.avi")
AssumeBFF()
source=ConvertToYV12(interlaced=true)

tfm(display=false,mode=2,pp=1,cthresh=25,micmatching=3,scthresh=2,mmsco=false)
tdecimate(mode=7,display=false, dupThresh=3.5,vidThresh=0.3,rate=23.976, hint=true,debug=false)

FlipVertical()
assumefps(23.976)
Z=Last


blur(0,1.0)

CSHARP=0.7		# Adjust to taste.


MCDegrainSharp(frames=3,bblur=0.6,csharp=CSHARP,bsrch=true,plane=0,limit=255,limitC=255)

StackHorizontal(Z,Last)
return last


Function MCDegrainSharp(clip c, int "frames", float "bblur", float "csharp", bool "bsrch",int "plane",int "limit",int "limitC")
{ # Based on MCDegrain By Didee, http://forum.doom9.org/showthread.php?t=161594
  # Also based on DiDee observations in this thread: http://forum.doom9.org/showthread.php?t=161580 
  # "Denoise with MDegrainX, do slight sharpening where motionmatch is good, do slight blurring where motionmatch is bad"
  # In areas where MAnalyse cannot find good matches, the blur() will be dominant.
  # In areas where good matches are found, the sharpen()'ed pixels will overweight the blur()'ed pixels
  # when the pixel averaging is performed. 
	frames = default(frames, 2)
	bblur  = default(bblur, 0.6)
	csharp = default(csharp, 0.6)
	bsrch  = default(bsrch, true)
	plane=Default(plane,0)			# as FFT3DFilter
	limit=Default(limit,255)		# maximal change in pixl luma   (default 255 [no limit])
	limitC=Default(limitC,limit)		# maximal change in pixl chroma (default as luma limit)

	bs = (c.width>960) ? 16 : 8
	
	c2 = c.blur(bblur)
	super = bsrch ? c2.MSuper(pel=2, sharp=1) : c.MSuper(pel=2, sharp=1)
	super_rend 	= c.sharpen(csharp).MSuper(pel=2, sharp=1,levels=1)
	backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
	backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
	backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
	forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
	forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
	forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)	
	(frames<=0) ? c :\
	(frames==1) ? c2.MDegrain1(super_rend, backward_vec1,forward_vec1,thSAD=400,plane=plane,limit=limit,limitC=limitC) :\
	(frames==2) ? c2.MDegrain2(super_rend, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,plane=plane, \
			  limit=limit,limitC=limitC) :\
		      c2.MDegrain3(super_rend, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,\ 
		      thSAD=400,plane=plane,limit=limit,limitC=limitC)
	return(last)
}

Function MCDegrain(clip c, int "frames",int "plane",int "limit",int "limitC")
{ # By Didee, http://forum.doom9.org/showthread.php?t=161594
	frames = default(frames, 2)
	plane=Default(plane,0)			# as FFT3DFilter
	limit=Default(limit,255)		# maximal change in pixl luma   (default 255 [no limit])
	limitC=Default(limitC,limit)		# maximal change in pixl chroma (default as luma limit)
	bs = (c.width>960) ? 16 : 8
	super = c.MSuper(pel=2, sharp=1)
	backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
	backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
	backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
	forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
	forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
	forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)	
	(frames<=0) ? c :\
	(frames==1) ? c.MDegrain1(super, backward_vec1,forward_vec1,thSAD=400,plane=plane,limit=limit,limitC=limitC) :\
	(frames==2) ? c.MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400, \
			  plane=plane,limit=limit,limitC=limitC) :\
		      c.MDegrain3(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3, \
		      thSAD=400,plane=plane,limit=limit,limitC=limitC)
	return(last)
}
You might want to experiment with MCDegrainSharp, try modifying the sharpen code to only sharpen vertically, have not
tried this myself, but it might prove fruitful.

EDIT: Perhaps something like
Code:
super_rend = c.sharpen(csharp/2.0,csharp).MSuper(pel=2, sharp=1,levels=1)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th October 2011 at 16:13.
StainlessS is offline   Reply With Quote
Old 15th October 2011, 17:28   #4  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,769
I would strongly suggest that you synchronize the camcorder to the projector (or vice-versa). There are schemes in the internet, unfortunately what I could find is in German.
Once you get the image unaltered on tape you can use software solutions.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 15th October 2011, 21:03   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
shouldn't you just look for a frame change after a doubleweave?
Yes, but is there software that can do a better job of this than TFM/TDecimate, or am I overlooking some better settings for this software combination?

Quote:
find below a little bit extra processing which uses Didee's Blur(0,1.0) from your other thread. I've left in two flavours of MCDegrain, for you to try.
Thank you very much for that. I use "VideoFred's" film restoration script that is the subject of a long and active thread elsewhere in this forum subsection:

The power of Avisynth: restoring old 8mm films

It has some great degraining, sharpening, dirt removal, and other features built in. Here is a few seconds, from the same film in the above example, showing not only that my existing method does a pretty good job (but not perfect, which is why I started this thread) of recovering the original frames, but also showing the result of running a modified version of VideoFred's excellent script:

Clip from 1964 Speech

On this particular project, I used Mercalli, rather than the Depan stabilization built into VideoFred's script, to completely eliminate gate weave. Mercalli's setting to simulate a perfectly fixed camera is amazingly good.

Quote:
I would strongly suggest that you synchronize the camcorder to the projector (or vice-versa).
That is definitely another way to accomplish the objective of getting exactly one frame of film onto one frame of video (so-called "frame accurate" transfer). I am very familiar with the various ways this can be done with a projector (as well as the "ultimate" way to transfer, namely a Rank Cintel).

I actually own one of Roger Evans (MovieStuff) "Workprinter" projector units that does this syncrhonization via a cam mounted on the projector which operates a mechanical switch each time the film is pulled down. This switch is wired to the left mouse button of a modified mouse, and the resulting "left click" causes a camcorder or camera to take a single-frame snapshot. The resulting snaps are assembled into an AVI file.

Of course, the older methods used in film chains, using analog cameras, really don't translate to the digital world.

The one problem with mechanical synchronization is that they require a large amount of modification to the projector, as you will see if you look at the various other schemes invented to accomplish "frame accurate" film to video transfer. By contrast, my method only requires removal of the shutter, something that only took about fifteen minutes on my Eiki SSL projector and which is easily and quickly reversable.

The only reason for starting this thread is that my method sometimes skips a frame, and then introduces a duplicate frame. I can correct this using the "filldrops" script posted on this forum several years ago, but it would be much, much better to not have the problem in the first place.
johnmeyer is offline   Reply With Quote
Old 22nd February 2012, 16:37   #6  |  Link
OldFilmer
Registered User
 
Join Date: Dec 2011
Location: Illinois
Posts: 2
Recover image from shutterless 16mm projector capture

For JohnHMeyer:

From your post on 15th October 2011:
What is “filmdrops” script and where can it be found on this forum?(Avisynth Usage)
Do you have any updates on the script you posted for converting 16mm to digital from a shutterless projector?

I do want to say:
Many, many thanks for all you have accomplished and shared with others. I am absolutely flabbergasted at the huge obstacles you faced and your brilliant solutions! Again, thanks

OldFilmer
OldFilmer is offline   Reply With Quote
Old 22nd February 2012, 17:21   #7  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
What is “filmdrops” script and where can it be found on this forum?(Avisynth Usage)
You mis-read what I posted: the script is called "filldrops," not filmdrops.

The original post by Mugfunky is here:

automated framedrop filler script

I posted an updated version of this which uses MVTools2 instead of the original MVTools, and which works with interlaced material as well as progressive:

FillDropsI

Last edited by johnmeyer; 22nd February 2012 at 17:22. Reason: Found spelling mistake just after posting
johnmeyer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Forum Jump


All times are GMT +1. The time now is 02:18.


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