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 18th September 2013, 22:59   #1  |  Link
egekhter
Registered User
 
Join Date: Sep 2012
Posts: 19
Removing duplicate frames (16->24 fps)

Hi there,

I have telecined HD silent 16mm film footage that was scanned at 16fps and output into a 24fps file.

The pulldown pattern is ABCCABCCABCC.

Can someone provide a precise AVISynth script, using whatever available internal or external plugins exist,
that when I open the .avs file in virtualdub I will be left with only unique frames.

Thanks for your help,
egekhter is offline   Reply With Quote
Old 19th September 2013, 01:22   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,539
Quote:
Originally Posted by egekhter View Post
Hi there,

I have telecined HD silent 16mm film footage that was scanned at 16fps and output into a 24fps file.

The pulldown pattern is ABCCABCCABCC.

Can someone provide a precise AVISynth script, using whatever available internal or external plugins exist,
that when I open the .avs file in virtualdub I will be left with only unique frames.

Thanks for your help,


Maybe my math is wrong, but something doesn't add up.

If it's 16fps => 24fps , but your pattern suggests removing 1 of every 4. That would suggest 18fps (0.75 * 24 = 18), or was there a speed change as well?

For straight 1 of 4 decimation you can use TDecimate(mode=0, CycleR=1, Cycle=4) . Have a look at the documentation for adjusting the other parameters
poisondeathray is offline   Reply With Quote
Old 19th September 2013, 13:03   #3  |  Link
Kisa_AG
Registered User
 
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 51
egekhter

Take a look on MultiDecimate. It needs two separate passes but in case of unknown/nonregular pattern it does the absolutely perfect job!
Kisa_AG is offline   Reply With Quote
Old 19th September 2013, 15:22   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,920
If you are intending to try Multidecimate, then you might be interested in MDec2(), a mod of FDecimate() metrics
but acting much like the Multidecimate() filter. Requires MultiDecimate.Exe & ProcessMD.Exe from MultiDecimate package,
here:
http://forum.doom9.org/showthread.ph...22#post1639822

Multidecimate YUY2() only, MDec2 v2.5 and v2.6 dll's, Planar, YUY2, RGB24/32.
__________________
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; 11th December 2013 at 18:58.
StainlessS is offline   Reply With Quote
Old 19th September 2013, 15:44   #5  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
I hope you haven't absorbed FDecimate's issues while re-using its metrics. It's pretty much pointless and braindead. I wrote it so consider me an expert on it.

I'd like to make a one-pass version of MultiDecimate.
Guest is offline   Reply With Quote
Old 19th September 2013, 16:07   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,920
I did fix what I thought was a bug in FDecimate metrics, but not offhand sure exactly what it was.
I still prefer Multidecimate/MDec2 in preference to other decimators due to two pass with all metrics
simultaneously available for 2nd pass. Find it particularly preferable if fixing a clip with multiple issues,
where can do 1st pass only once and then can play with additional filters to your hearts content
without incurring decimate detection overhead whilst trying to find optimum correction settings.
Never did get to see the source though, as not released, I think, same for Multidecimate.Exe and ProcessMD.Exe.

On second thoughts, I think you did metrics in frame strips skipping some of the frame and think that
it got 'out of whack' for chroma metrics, adding chroma metrics to wrong BLOCK. I modded to examine
entire frame, and corrected what I thought was the error.

You are welcome to take what I've done and mod it further, would be very happy to try out new 1 pass multidecimate.

EDIT: MDec2(), Metrics for Planar (v2.6 compatible)
Code:
// Below, Luma *2 as luma counts 50%, same as combined chroma (U+V) [maintain precision].
	if(vi.IsPlanar()) {
		for (y = 0; y < height; ++y) {
			for (x = 0; x < row_size;++x) {
				sum[(y/BLKSIZE)*xblocks+x/BLKSIZE] += abs((int)currp[x] - (int)prevp[x]) * 2;
			}
			prevp += pitch;
			currp += pitch;
		}
		if (color) {
			prevpU = prev->GetReadPtr(PLANAR_U);
			currpU = curr->GetReadPtr(PLANAR_U);
			prevpV = prev->GetReadPtr(PLANAR_V);
			currpV = curr->GetReadPtr(PLANAR_V);
			for (y = 0; y < heightUV; ++y) {
				for (x = 0; x < row_sizeUV; ++x) {
					int sm	=	abs((int)currpU[x] - (int)prevpU[x]);
					sm		+=	abs((int)currpV[x] - (int)prevpV[x]);
					sum[((ySubS*y)/BLKSIZE)*xblocks+(xSubS*x)/BLKSIZE] += sm * tSubS;
				}
				prevpU += pitchUV;
				currpU += pitchUV;
				prevpV += pitchUV;
				currpV += pitchUV;
			}
		}
        }
EDIT: SubS stuff
Code:
	int xSubS	=1;
	int ySubS	=1;
	int tSubS	=1;
	bool color	= (chroma);

	if (vi.IsPlanar()) {
		row_sizeUV = curr->GetRowSize(PLANAR_U);
		if(color && row_sizeUV>0) {
			pitchUV		= curr->GetPitch(PLANAR_U);
			heightUV	= curr->GetHeight(PLANAR_U);
			xSubS=row_size	/ row_sizeUV;
			ySubS=height	/ heightUV;
			tSubS = xSubS * ySubS;
		} else {
			color=false;
		}
	}
__________________
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; 19th September 2013 at 16:41. Reason: additional
StainlessS is offline   Reply With Quote
Old 19th September 2013, 20:09   #7  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,041
I do this all the time, both with 16 fps and 18 fps telecined film. Here is the script I use. I'm sure you can adapt it to your needs. Make sure to set BFF/TFF to match your source material. I have included a commented out line for 18 fps material, in case you ever need to do that. Also, if the tdecimate settings don't work on your material, you can try one of the other modes, or play with the cycleR and cycle settings.

[edit]If the pulldown pattern extends over more than a few fields, you can try using multiples of the cycle settings, e.g., cycleR=4, cycle=6; or cycleR=6, cycle=9. Also, do NOT use SetMTMode with this script.

Finally, take note of the last three lines. I always temporarily enable the "separatefields()" statement at the end of the script and step through a few hundred frames throughout the source material. You should get two matching fields, with nothing more than a little up/down motion (from the spatial separation between fields). You should not see any horizontal motion and you should not see any blended fields, if the script is working correctly. Once you have done this, remove the separatefields() statement and proceed.

Code:
# Script to IVTC an 8mm movie.

loadPlugin("c:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")

AVISource("e:\fs.avi").killaudio()

AssumeBFF()
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

#AssumeFPS(18)
AssumeFPS(16)

#Uncommend this field in order to check that IVTC is being performed correctly. 
#Put back the comment before doing the actual IVTC 
#separatefields()

Last edited by johnmeyer; 19th September 2013 at 20:13. Reason: added advice about using multiples of cycle and cycleR
johnmeyer is offline   Reply With Quote
Old 20th September 2013, 05:50   #8  |  Link
egekhter
Registered User
 
Join Date: Sep 2012
Posts: 19
Thanks everyone for contributing.

I ended up using TDecimate and it worked like a charm with cycleR=1, cycle=3.

Best,
Eugene
egekhter is offline   Reply With Quote
Old 20th September 2013, 06:15   #9  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,041
I just re-read the OP, and realized the pulldown was added to only bring the speed up to 24 fps. My post was for 30 fps film. I'm glad you figured out the right cycle settings.
johnmeyer is offline   Reply With Quote
Old 25th September 2013, 13:10   #10  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,169
Quote:
Originally Posted by johnmeyer View Post
I'm glad you figured out the right cycle settings.
Especially given, as pdr pointed out, that he had the cycle completely wrong at first.
manono is offline   Reply With Quote
Reply

Tags
avisynth, duplicate frames, film, inverse telecine, pulldown

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 11:37.


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