Log in

View Full Version : The Simpsons: Combination IVTC + Bob to 59.94 output


Chewielewis
24th June 2017, 09:32
Ive got a very complex process to restore episodes of the Simpsons.

So like most early cartoons, The Simpsons is animated at 23.976, IVTC'd to NTSC then edited on tape. So you have cadence breaks, duplicated/dropped frames, orphaned fields and 60fps overlays. And while you can decimate it to 23.976 pretty easily, it's not the best way to do it. The official FXX HD remasters suffer from jerkyness and combed frames in some places.

One example of this is during the chalkboard gag in the opening sequence. The chalkboard shot is inserted via chroma or luma key and has a difference cadence to the school window shot before it, so when you bob that shot, each of the 60 frames has a movement in either the window shot or the chalkboard shot, playback in 59.94p is the only way to get it looking smooth.

So what i'm looking to do is create a preservation of the episodes in 59.94 fps. With the Telecined frames IVTCd and then placed back exactly in the right place (with a 2:3 progressive frame pulldown), then using a bob deinterlace on remaining combed frames.

My current workflow is pretty complicated, rendering out 3 copies, one with tfm/tdecimate, one with QTGMC double frame rate and one as a straight 29.97 untouched. Then combining the 3 copies by hand in Premiere Pro. Which is far too lengthy a process for one episode let alone 200.

What I'm looking for is some sort of script that can do this automatically.

Motenai Yoda
24th June 2017, 14:13
yatta?

hello_hello
24th June 2017, 14:48
I'm not sure there's a way to avoid going through each episode manually to decide where to apply IVTC or de-interlacing etc, but I've used scripts similar to the one below to make patching it all together a bit less painful.

DGDecode_mpeg2source("D:\video.d2v")

A=Last.AssumeFPS(30000,1001)
B=A.ChangeFPS(60000,1001) # Clip for progressive sections and as a guide video.
C=A.Yadif(mode=1) # Deinterlaced clip. Replace Yadif with QTGMC for encoding.
D=A.TFM(clip2=C).TDecimate(mode=1).ChangeFPS(60000,1001) # IVTC and duplicate frames for 60fps.

E=Trim(C,0,49)\
++Trim(B,50,99)\
++Trim(D,100,149)\
++Trim(C,150,0)

F=E.Spline36Resize(640,480) # Cropping, resizing and/or any other global filtering
StackHorizontal(B, E)
# Return F # Uncomment for encoding.

I'm a bit dyslexic with numbers so using StackHorizontal or StackVertical for a side by side comparison with the original helps ensure the video timing doesn't change, and when IVTCing and converting to a common frame rate such as 23.976 it's a way to ensure the edited version stays lined up with the source video to maintain audio sync.

The tedious part would be stepping through each episode and adjusting/adding/removing trims accordingly, but it'd be a lot easier than encoding the video 3 times and trying to combine the encodes. Plus the trims can also be used to apply additional filtering to specific sections if need be. ie

E=Trim(C,0,49)\
++Trim(B,50,99).Tweak(sat=0.9)\
++Trim(D,100,149)\
++Trim(C,150,0)

AvsPMod would probably be the way to edit the script with a preview.

Katie Boundary
25th June 2017, 01:54
This is my boilerplate script for dealing with such nonsense:

mpeg2source("101.d2v")

LoadCPlugin("c:\yadif.dll")

A=yadif(mode=1).selecteven()
B=yadif(mode=1).selectodd()
C=Tfm(field=1,mode=0,cthresh=2,mthresh=2,clip2=A,micmatching=0)
D=Tfm(field=0,mode=4,cthresh=2,mthresh=2,clip2=B,micmatching=0)
Interleave(C,D)

It assumes top field first. Switch "field=1" and "field=0" for bottom-field-first content.

manono
25th June 2017, 08:52
Is there a reason for making a 29.97fps version? Is it only to help in discovering where the screwups are?

I'd make an IVTC'd and pulled down to 59.94 version and a QTGMC'd version. Assuming the vast majority of it IVTC'd correctly, I'd use that one (converted to 59.94fps) as my 'base' and when going through it replace the difficult sections with the QTGMC'd version for those frames alone. I see no need at all for Premiere.

And that's only if I decided just QTGMCing the whole thing was too easy a solution.

The script for replacing the main video with sections of the QTGMC'd version might go something like this:

B=AVISource("QTGMC.avi")
AVISource("IVTCPulledDown.avi")
A=Last
ReplaceFramesSimple(A,B,Mappings="[1000 2000] [15999 6999] [10000 11000] ")

Those frame numbers represent the start and end frame numbers to be replaced. ReplaceFramesSimple replaces frames from one video with those from another and is part of stickboy's RemapFrames (http://www.avisynth.nl/users/stickboy/).

Like hello_hello, I don't know of a way to do it all automatically.

Chewielewis
26th June 2017, 05:44
Thanks Katie, your script seems to be just what im after.

I've made some changes and thrown in some lines from another simpsons script.

LoadPlugin("C:\Program Files (x86)\MeGUI_2624_x86\tools\DGIndex\DGDecode.dll")
mpeg2source("S02E06_7F08_PUTTING_NTSC.d2v")
LoadPlugin("C:\Program Files (x86)\MeGUI_2624_x86\tools\avisynth_plugin\TIVTC.dll")
trim(0,1000)
Crop(8,0,-8,0)

J=ChangeFPS(60000,1001)
A=QTGMC( Preset="Slow",sourcematch=3, Sharpness=0.0, lossless=2 ).selecteven()
B=QTGMC( Preset="Slow",sourcematch=3, Sharpness=0.0, lossless=2 ).selectodd()
C=Tfm(field=1,mode=0,cthresh=2,mthresh=2,clip2=A,micmatching=0,chroma=true,display=false)
D=Tfm(field=0,mode=4,cthresh=2,mthresh=2,clip2=B,micmatching=0,chroma=true,display=false)
Interleave(C,D)

### Gibbs Noise Block ###
Edge=MT_Edge("prewitt",ThY1=20,ThY2=40).RemoveGrain(17)
Mask=MT_Logic(Edge.MT_Expand().MT_Expand().MT_Expand().MT_Expand(),Edge.MT_Inflate().MT_Inpand(),"xor")
MT_Merge(Minblur(),Mask,Luma=True)


What I am finding is a few instances of Line doubled frames, where a frame on either side is the correct progressive frame.

For example the following two sequential frames https://imgur.com/a/Uv66G

I know i can correct these manually but I wonder if there is a way to detect these frames.

Katie Boundary
26th June 2017, 23:49
Thanks Katie, your script seems to be just what im after.

I'm happy to hear that :)

About half of the credit goes to Hello_Hello, who showed me that chains of filters could be assigned to arbitrary variables, which could then be fed to parameters like "clip" and "clip2" in filters like Interleave. Further credit goes to ndjamena and TheFluff for discovering/explaining why "micmatching=0" is important: http://forum.doom9.org/showthread.php?t=174194

What I am finding is a few instances of Line doubled frames, where a frame on either side is the correct progressive frame.

For example the following two sequential frames https://imgur.com/a/Uv66G

I know i can correct these manually but I wonder if there is a way to detect these frames.

tdecimate?