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 4th February 2006, 21:53   #1  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
High Speed Film to Video Transfer Machine -- Need IVTC Help

I'm transferring 16mm film to video. I have an 8mm Workprinter, which captures one frame at a time, but at very slow speed.

I had a brainstorm: Remove the shutter from a 16mm projector, set the "shutter speed" on my video camera to 1/1000 second, capture the video, and then process with IVTC software. A sketch of the relative timing of the film and the video camera shows that no matter what the relative timing of the projector and the camera (they cannot be synchronized), I can be absolutely assured of the camera taking two complete fields (one frame) for every frame of film. Depending on where the film is in its pulldown cycle, the next field after the two good ones will either be: 1) A third duplicate; 2) The film during its pulldown cycle, which will not match either the film frame before or the film frame after; 3) The next frame of film.

I have tried the normal Telecide() Decimate() routines because I thought that the captured video would be virtually identical to video that contained 3:2 pulldown film. However, I have not been able to get this to work. I can use SeparateFields to look at each individual field, and indeed what I expected in theory is indeed what I have captured in practice.

I really do think that this invention will let me capture film a frame at a time, but at full 24 fps speed. However, I need some ideas, guidance, or help on what I should try next.

I have thought of building a script using motion estimation software, like MVTools, to do my own field matching and decimation and ultimately that's what I may have to do. However, it sure seems like this software -- perhaps with FDecimate instead of Decimate -- should be able to do the trick.

With the Show=True in the Telecide filter, I get four good recovered frames. Then, either the fifth or sixth frame (not consistent because the projector is slightly slower than 24 fps), I get an interlaced frame (as reported by Telecide) which needs to be discarded. However, about every fifth group of five frames, I instead get a duplicate frame (because the unique frame captured during pulldown is skipped). This frame should also be discarded.

One last piece of info: Even with a synchronous AC motor in my Eiki projector, the film is not exactly 24 fps, so the pattern doesn't exactly repeat. Therefore the software has to adapt, which of course is the heart and soul of this smart IVTC software.

Last edited by johnmeyer; 4th February 2006 at 21:56.
johnmeyer is offline   Reply With Quote
Old 5th February 2006, 01:43   #2  |  Link
Backwoods
ReMember
 
Backwoods's Avatar
 
Join Date: Nov 2003
Posts: 416
Can you post a sample?
Backwoods is offline   Reply With Quote
Old 5th February 2006, 03:10   #3  |  Link
rfmmars
Registered User
 
Join Date: Feb 2004
Posts: 743
Quote:
Originally Posted by johnmeyer
I'm transferring 16mm film to video. I have an 8mm Workprinter, which captures one frame at a time, but at very slow speed.

I had a brainstorm: Remove the shutter from a 16mm projector, set the "shutter speed" on my video camera to 1/1000 second, capture the video, and then process with IVTC software. A sketch of the relative timing of the film and the video camera shows that no matter what the relative timing of the projector and the camera (they cannot be synchronized), I can be absolutely assured of the camera taking two complete fields (one frame) for every frame of film. Depending on where the film is in its pulldown cycle, the next field after the two good ones will either be: 1) A third duplicate; 2) The film during its pulldown cycle, which will not match either the film frame before or the film frame after; 3) The next frame of film.

I have tried the normal Telecide() Decimate() routines because I thought that the captured video would be virtually identical to video that contained 3:2 pulldown film. However, I have not been able to get this to work. I can use SeparateFields to look at each individual field, and indeed what I expected in theory is indeed what I have captured in practice.

I really do think that this invention will let me capture film a frame at a time, but at full 24 fps speed. However, I need some ideas, guidance, or help on what I should try next.

I have thought of building a script using motion estimation software, like MVTools, to do my own field matching and decimation and ultimately that's what I may have to do. However, it sure seems like this software -- perhaps with FDecimate instead of Decimate -- should be able to do the trick.

With the Show=True in the Telecide filter, I get four good recovered frames. Then, either the fifth or sixth frame (not consistent because the projector is slightly slower than 24 fps), I get an interlaced frame (as reported by Telecide) which needs to be discarded. However, about every fifth group of five frames, I instead get a duplicate frame (because the unique frame captured during pulldown is skipped). This frame should also be discarded.

One last piece of info: Even with a synchronous AC motor in my Eiki projector, the film is not exactly 24 fps, so the pattern doesn't exactly repeat. Therefore the software has to adapt, which of course is the heart and soul of this smart IVTC software.
Are these commerical 16mm or home 16mm movies? If they are home 16mm your hitting your head against the wall because consumer cameras are not persision cameras, they are either spring motor or battery operated and are not constant speed, so you will have always some blended fields, no way around this. A frame at a time is the only way to go.

Richard
www.photorecall.net
rfmmars is offline   Reply With Quote
Old 5th February 2006, 03:40   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
they are either spring motor or battery operated and are not constant speed, so you will have always some blended fields, no way around this. A frame at a time is the only way to go.

If I was doing a capture with a 3- or 5-bladed shutter, you would be correct. However, I am doing something completely different here. I have removed the projector shutter and am capturing using a very high shutter speed on the video camera (1/1000 of a second). Therefore, there are no blended frames. There can't be. The resulting video is very similar to telecined video -- although not exactly the same, hence this post. Thus, whether the original video was shot at 15, 18, or 24 fps, or whether the camera or projector are constant speed don't really matter, except that the IVTC algorithm can't rely on the "pulldown pattern" being exactly constant (it never can even with telecined film, but this is even tougher).

I am quite certain that the film can be IVTC'd. I'm working on uploading a sample. I should have it shortly.
johnmeyer is offline   Reply With Quote
Old 5th February 2006, 03:43   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
OK. Here's a link to a 14.9 MB 3-sec NTSC DV AVI clip. This is exactly as it was captured, with no modifications at all. The link will take you to my Yahoo briefcase page. You will then need to click on the "film to video test" link to download the clip (I can't post a direct link to it).

http://briefcase.yahoo.com/bc/john_m.../Video&.view=l
johnmeyer is offline   Reply With Quote
Old 5th February 2006, 05:10   #6  |  Link
rfmmars
Registered User
 
Join Date: Feb 2004
Posts: 743
Quote:
Originally Posted by johnmeyer
they are either spring motor or battery operated and are not constant speed, so you will have always some blended fields, no way around this. A frame at a time is the only way to go.

If I was doing a capture with a 3- or 5-bladed shutter, you would be correct. However, I am doing something completely different here. I have removed the projector shutter and am capturing using a very high shutter speed on the video camera (1/1000 of a second). Therefore, there are no blended frames. There can't be. The resulting video is very similar to telecined video -- although not exactly the same, hence this post. Thus, whether the original video was shot at 15, 18, or 24 fps, or whether the camera or projector are constant speed don't really matter, except that the IVTC algorithm can't rely on the "pulldown pattern" being exactly constant (it never can even with telecined film, but this is even tougher).

I am quite certain that the film can be IVTC'd. I'm working on uploading a sample. I should have it shortly.

My question is how do you know that the frame is stopped and centered when you take the 1/1000 sec exposure? Without some type of sync circuit, how are you eliminating capture frames when the film is advancing?

Thanks for posting the clip.

Richard
rfmmars is offline   Reply With Quote
Old 5th February 2006, 05:15   #7  |  Link
rfmmars
Registered User
 
Join Date: Feb 2004
Posts: 743
Quote:
Originally Posted by johnmeyer
OK. Here's a link to a 14.9 MB 3-sec NTSC DV AVI clip. This is exactly as it was captured, with no modifications at all. The link will take you to my Yahoo briefcase page. You will then need to click on the "film to video test" link to download the clip (I can't post a direct link to it).

http://briefcase.yahoo.com/bc/john_m.../Video&.view=l
The link isn't correct

See
http://briefcase.yahoo.com/bc/john_meyer77@sbcglobal.net/lst?.dir=/Video&

Richard
rfmmars is offline   Reply With Quote
Old 5th February 2006, 05:25   #8  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
My question is how do you know that the frame is stopped and centered when you take the 1/1000 sec exposure? Without some type of sync circuit, how are you eliminating capture frames when the film is advancing?

I'll admit that what I'm doing is pretty unconventional and therefore may not be immediately obvious. If you draw a timeline and put tick marks every 1/24 second, that represents the timing for the film. Now about 12% of the way into each 1/24 second frame, put a little tick mark. The point between the start of each frame and that tick mark is the pulldown, when the film is moving. The rest of the time, the film is stationary.

Now, above that timeline, place a dot every 1/60 of a second. Each dot represents the capture of one field of video. You need two fields of video to get a complete frame. If you stare at these two timelines, you'll eventually realize that no matter when the camera happens to take its two fields relative to when the film comes to rest (because, as you point out, the projector and the video camera are in no way synchronized), the camera will ALWAYS be able to capture two good fields of every frame of film.

Now, the trick -- and the whole purpose of this post -- is to figure out what to do with the "extra" fields that are captured. Sometimes you will get a field that is captured while the film is moving. Sometimes you will get a third field that duplicates the previous two. Those need to be discarded.

I thought up this whole scheme a month ago and have been working on it for some time. Everything is working exactly according to theory, and all I have to do is figure out how to either modify Decimate() or FDecimate() so they will do what I want, or else write my own decimation code (which I can do, but would like to avoid, since lots of sharp people have written some pretty smart decimation code that can handle exactly this sort of problem).
johnmeyer is offline   Reply With Quote
Old 5th February 2006, 05:35   #9  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
The link isn't correct

If you get a Cannot Find Server message, press the retry button on your browser to retry the link. Yahoo Briefcase is finicky. I just clicked on the link above (the one in your email) and did indeed get a Cannot Find Server error. I just clicked on retry and was connected.

If you have any suggestions of a more reliable, free place to upload my clip, I'll gladly upload there.
johnmeyer is offline   Reply With Quote
Old 5th February 2006, 22:19   #10  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
That link I provide does work -- but apparently only sometimes. Here is a link to my own website. This will download just by clicking on the link:

http://www.themeyersite.com/Sounds/f...video_test.avi

Not the fastest server in the world, but it shouldn't take too long. Thanks for being patient.

Also, thanks in advance for any help that any of you can provide!
johnmeyer is offline   Reply With Quote
Old 6th February 2006, 04:16   #11  |  Link
rfmmars
Registered User
 
Join Date: Feb 2004
Posts: 743
Quote:
Originally Posted by johnmeyer
My question is how do you know that the frame is stopped and centered when you take the 1/1000 sec exposure? Without some type of sync circuit, how are you eliminating capture frames when the film is advancing?

I'll admit that what I'm doing is pretty unconventional and therefore may not be immediately obvious. If you draw a timeline and put tick marks every 1/24 second, that represents the timing for the film. Now about 12% of the way into each 1/24 second frame, put a little tick mark. The point between the start of each frame and that tick mark is the pulldown, when the film is moving. The rest of the time, the film is stationary.

Now, above that timeline, place a dot every 1/60 of a second. Each dot represents the capture of one field of video. You need two fields of video to get a complete frame. If you stare at these two timelines, you'll eventually realize that no matter when the camera happens to take its two fields relative to when the film comes to rest (because, as you point out, the projector and the video camera are in no way synchronized), the camera will ALWAYS be able to capture two good fields of every frame of film.

Now, the trick -- and the whole purpose of this post -- is to figure out what to do with the "extra" fields that are captured. Sometimes you will get a field that is captured while the film is moving. Sometimes you will get a third field that duplicates the previous two. Those need to be discarded.

I thought up this whole scheme a month ago and have been working on it for some time. Everything is working exactly according to theory, and all I have to do is figure out how to either modify Decimate() or FDecimate() so they will do what I want, or else write my own decimation code (which I can do, but would like to avoid, since lots of sharp people have written some pretty smart decimation code that can handle exactly this sort of problem).
I want to thank you for taking another fork in the road not traveled. I am going to study this very closely.

One way you may want to detect the moving frame is the the vertical resolution will drop off the chart, this should be the key.

Thanks for making me think.

Richard
rfmmars is offline   Reply With Quote
Old 6th February 2006, 04:25   #12  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
So far, detecting the frames with Telecide() works perfectly. The frames that it reports as interlaced ALL should be discarded, and the frames that it reports as duplicates should be discarded. The only thing missing is figuring out how to use an existing decimation routine -- like Decimate() or FDecimate() -- or one that I write, to take that information and delete the frames. I think that Telecide() can be made to pass information to other routines, but I'm not quite sure what the interface might be.

I'm so close to having this work. Hopefully with a couple of hints I can finish this off. I've have about 50 hours of films waiting to be transferred (and that's just the start).

Thanks for you input and help.
johnmeyer is offline   Reply With Quote
Old 6th February 2006, 04:37   #13  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
this is quite ingenious. rfmmars has a good point about vertical resolution. a modified comb mask (that takes a wider area into account) could be used to detect these frames. scenechange detection could also be useful, but would drop fields on actual scenechanges.

also, i haven't spotted a ratio of blurred fields to good fields as yet. i'm sure one exists, but it might vary by quite a bit. so it might make more sense to output a copy of the last good field and then decimate in a separate step (this would also make scripting a solution much easier - avisynth's conditional environment isn't able to arbitrarily remove frames. input framecount and output framecount must be equal).

i can imagine a reasonably simple method of detecting and replacing "blurs", and then decimating using a regular decimator plugin like decimate or tdecimate or whatever.

this would also mean A/V sync isn't an issue.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 6th February 2006, 07:03   #14  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
The moving frame isn't really the way to do any detection, because it is possible to happen to take the 1/1000 second capture just at the beginning or end of the pulldown, in which case the error will be rather slight. Instead, the way to do this is to have a routine that "syncs up" to the pattern using field matching. This is easy because there are two ways to sync up. First, when one field is completely different from the next, you know you have crossed into a new frame or film, or into the film pulldown area. If the next field after that "matches," then you are within a frame of film and those two fields should be chosen. If the field after that one matches also (which happens once in awhile, then you take the better match between fields one and two, or fields two and three, and use those two fields to make a frame.

The second way to sync up is to look for situations where one field is totally different from both the field before and the field after. This clearly is a pulldown field, and should be discarded. The next two fields will always be good.

The Telecide() function that is part of Decomb is detecting everything perfectly and is giving me all the information I need to make this work. The problem is that I can't get any decimate function to use this information to take the proper action and throw away the frame. If you use this code:

Code:
converttoYV12(interlaced=true)
AssumeBFF()
Telecide(show=true,guide=0,post=1)
and step through the video, you'll see that Telecide() shows "interlaced" every time the film pulldown is captured. In addition, every time the relative timing causes the video capture to miss the pulldown and instead show a third duplicate field, it properly reports this by changing from "n" to "c" (next to current). Any time this happens, the frame should be discarded. If I can hook into that information, I can decimate properly and I'm home free (I think).

Last edited by johnmeyer; 6th February 2006 at 07:12.
johnmeyer is offline   Reply With Quote
Old 6th February 2006, 07:26   #15  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,487
TFM should be able to match Telecide's prog/interlaced decisions, and it has a "clip2" parameter so that you can supply your own output for interlaced frames. Maybe a blankclip(last) or blankclip(last,color=$0000FF) or even colorbars, something you can easily detect and delete. Then you can decimate away spurious duplicates, which hopefully might even show some pattern.

I don't know if a filter exists such as
Code:
tfm(clip2=colorbars)
removefrom(last,colorbars)
I have the right pieces to build it efficiently, I'm just a filter novice still. ^^;
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 8th February 2006, 01:55   #16  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
Thanks for the TFM tip. I am getting close using this script:

Code:
loadPlugin("c:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")
AVISource("E:\Film\Film Test.avi")
converttoYV12(interlaced=false)
AssumeBFF()
tfm(display=false,mode=5,pp=1,cthresh=16,mi=125,debug=false)
tdecimate(debug=false,display=false,cycleR=7,cycle=38)
However, it is not quite perfect. The problem is that IVTC software has to make allowances for the fact that the pulldown pattern may change. In this application, the pattern will never change, but because of the drift between the projector speed and the video camera capture speed, the duplicate or the combed frame happens either every five, or every six frames. 98% of the time, the combed frames are easy to spot because one of the fields is the film while it is moving. This doesn't match either the previous or next field and tfm reports it as interlaced with a value of 255. However, once in awhile, the film has just started to move or is just about to finish moving, so the combining is not too obvious. However, this always happens on the fifth or sixth frame.

So, in a nutshell, what would be ideal is to use the combining values of 255 as a way to reset the cadence (so the thing can sync up at the beginning of the film). From that point on, the next four frames can absolutely, positively be guaranteed to be progressive. Then, one of the two next frames is either going to be massively combed or, if the timing between camera and projector is just right, it will be a third duplicate (TFM matches the third duplicate field with the previous field). In either case, that's the one to decimate.

Thus, what I want to do is somehow figure out how to communicate with TFM from within a script and write my own decimation code that smartly deletes the fifth or sixth frame, but never touches the next four.
johnmeyer is offline   Reply With Quote
Old 8th February 2006, 02:09   #17  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
Quote:
Originally Posted by johnmeyer
Thus, what I want to do is somehow figure out how to communicate with TFM from within a script and write my own decimation code that smartly deletes the fifth or sixth frame, but never touches the next four.
I think you'd be better off starting from (say) the Decimate() source code, and adding your own intelligent modes.
Guest is offline   Reply With Quote
Old 8th February 2006, 05:07   #18  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
Problem is, the last time I compiled anything in C was 1995. Most of my programming at this point is VB, scripts, jscript -- basically small stuff. My old compiler won't work.
johnmeyer is offline   Reply With Quote
Old 8th February 2006, 05:30   #19  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,487
If you're willing to install .Net 2, VS2005 express is free. You should be able to load and compile decomb immediately, and make changes from there.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 8th February 2006, 18:14   #20  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,263
Didn't know about that. It requires SP2, which my new laptop has. I'll see what other things it requires.
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 16:45.


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