Log in

View Full Version : Anyone Done Family Guy?


HartleySan
12th July 2007, 23:42
Does anyone have a good script for encoding Family Guy? Would be greatly appreciated. Thanks a lot.

Adub
13th July 2007, 08:04
What exactly do you mean? Do you mean Deinterlacing/ivtc-ing or noise removal or ....etc.

Be more descriptive.

foxyshadis
13th July 2007, 10:14
Also, what region discs?

MrAngles
21st July 2007, 06:30
I am also wondering about Family Guy. I've got region 1 NTSC dvds, and am having trouble getting a satisfactory result deinterlacing. I'm using MeUI and most episodes are analyzed as "Hybrid Film/Interlaced. Mostly Film." Without deinterlacing the majority of video looks great, but certain frames have horrible interlacing. When using deinterlacing options I get ugly jagged lines throughout the whole episode. I was hoping there would be a way to only deinterlace specific frames rather than the whole episode. I have a similar issue to a lesser extent with Futurama.

Blue_MiSfit
21st July 2007, 06:56
Family Guy definitely isn't FILM material. IIRC (though it was years ago when I hit Season 1's R1 release) it's pure NTSC, and a same-rate deinterlace worked well.

It could be progressive.. I've seen Adult Swim stuff that was 30p. To really determine what you've got, make a fresh d2v that honors pulldown flags, and step through it frame by frame in a scene with motion or moving mouths. What do you see?

You can always post an unprocessed m2v / VOB sample

~MiSfit

burfadel
21st July 2007, 13:58
You get better compression with 16 reference frames, because its animation! Have you tried tdeint?

Terranigma
21st July 2007, 15:49
You get better compression with 16 reference frames, because its animation!

You mean 16 b-frames.

burfadel
22nd July 2007, 11:07
You mean 16 b-frames.

Yes, 16 b-frames and 16 reference frames :) Simple animation like family guy etc is the only time when more than 5 reference frames are benefical. The x264 options I use (using Cef's build)

--crf 25 --keyint 350 --ref 16 --bframes 16 --b-pyramid --weightb --b-rdo --bime --direct auto --analyse all --8x8dct --subme 6 --me umh --trellis 2 --no-fast-pskip --mixed-refs --progress --threads auto --no-psnr --thread-input --aq-strength 0.4 --thread-queue 12 --aq-sensitivity 12 --nr 1000

Thats constant quality mode (CRF). If you want a smaller file, raise it to say 28, still looks quite decent for animation and can get you a very small file! or you can drop it down to like 23 for high quality. Animation like this doesn't seem to require as high a quality mode than normal (real life?) video.

the aq-strength, aq-sensitivity, and thread-queue are part of the patches Cef include's in his builds. The first two give a better picture in dark areas or on flat colour (these are higher than default, but I think they're good settings), and the thread queue just allows for better cpu utilisation, especially on dual or quad core cpu's. Especially if you run the priority as low and do other things on your computer at the same time!

Hope this helps.

Zarxrax
22nd July 2007, 17:46
Family Guy has a lot of scenes that contain really bad deinterlacing in the source. I don't think there is much you can do to fix those scenes. They edited the show using Adobe Premiere 6 (I saw it in a behind the scenes thing), and one of Premiere's most renowned features was to make your video look like crap by utilizing an extremely ugly deinterlacing method on any clips that you slowed down :)

MrAngles
22nd July 2007, 18:01
The majority of a family guy episode has no visible interlacing when previewing it frame by frame, but certain scenes with movement do. Using TDeint actually makes it look worse than the original file, the best result I've been able to get is with TomsMoComp, which gets rid of the lines but leaves the edges looking jaggy. I would be satisfied with this if it was the best I could get, except that it makes all movement jaggy looking, even parts that originally did not have visible interlacing, which makes it unwatchable to me.

http://rapidshare.com/files/44386611/Family_Guy_-_3x05.zip.html

HartleySan
6th August 2007, 11:30
Yeah. I'm still trying to tackle this problem. As anyone knows who's either watched the Family Guy DVDs or tried to encode them, the season 1 and 2 ones are the worst. Anyway, I'm gonna try and get some screenshots and post them.

MrAngles
6th August 2007, 18:24
After trying all kinds of different deinterlacing, the best result I've ended up with is just using Film - Vary - TIVTC. It gets rid of all interlacing, but certain scenes have jagged edges due to being heavily interlaced originally, and very often backgrounds seem to shift in and out of focus, or take on a Dr Katz-style squigglevision effect. This may be inherent to the original master, but I can't see why. Perhaps I just never noticed it before because I wasn't scrutinizing it as much as I am now. My next step I think is to switch my dvd player to 480i mode and watch the episodes from the DVD on my tv and see what it looks like.

HartleySan
9th August 2007, 00:22
Well, I've had a bit of a breakthrough. I'm still in the midst of checking, but I ran a couple new filters that I've never used before and while it took a lot longer to encode, the results are quite nice. The edges are nice and smooth and it looks real good. Anyway, the two new filters I used are Deen and TIsophote. Deen to denoise and TIsophote to smooth the jagged edges. I called both of the functions as listed below. Also, I added the "cpu=6" command to the mpeg2source function:

mpeg2source("D:\DVD\Projects\FAMILY_GUY_DISC1_VTS_03_PGC1\FAMILY_GUY_DISC1.d2v", cpu=6)
ConvertToYV12()
Deen("a3d",3,3,5)
TIsophote(4,0.2,2,false)

After that, I used the Telecide function and it looks quite nice. Still messing with the details, but it's a huge difference. Well, good luck all and more advice is always appreciated (provided I can understand it. Hehe!)

Blue_MiSfit
11th August 2007, 03:44
Family Guy has a lot of scenes that contain really bad deinterlacing in the source. I don't think there is much you can do to fix those scenes. They edited the show using Adobe Premiere 6 (I saw it in a behind the scenes thing), and one of Premiere's most renowned features was to make your video look like crap by utilizing an extremely ugly deinterlacing method on any clips that you slowed down


OMG, I know what you're talking about... DREADFUL.


I love how capable the deinterlacing algorithms in most NLEs are... :(

I can't believe they used Premiere 6!

And yes, I remember when I did Season 1 awhile ago, there were some really terrible artifacts in some scenes that were impossible to get rid of. I remember aliasing on diagonals being the biggest issue.

~MiSfit

Chainmax
11th August 2007, 19:16
If this needs same-rate deinterlacing and since it's a cartoon, I'd recommend using TDeint, EEDI2 and TMM in the following fashion:

For TFF Clips:
Interp = SeparateFields().SelectEven().EEDI2(field=1)
TDeint(order=1,field=1,type=1,edeint=Interp,emask=TMM(order=1,field=1))

For BFF Clips:
Interp = SeparateFields().SelectEven().EEDI2(field=0)
TDeint(order=0,field=0,type=1,edeint=Interp,emask=TMM(order=0,field=0))

As for antialiasing, what I usually do is using EEDI2().TurnRight().EEDI2().TurnLeft() followed by a resize to the original framesize. If that doesn't remove all jagginess, I insert an AAA() call after the aforementioned resize.

MrAngles
12th August 2007, 21:34
Is forcefilm on in your D2V(Field_Operation=1)? MeGUI automatically set that option for me and I've been playing around with turning it on and off.

burfadel
13th August 2007, 01:01
The episodes I encoded were in Pal, so I didn't have any of those problems... Telecining does cause lots of problems doesn't it?! Did you try playing around with the different settings with Tdeint etc? there's 5 different types of deinterlacing for example.
* 0 - cubic interpolation
* 1 - modified ELA interpolation
* 2 - kernel interpolation (can be normal or sharp, controlled by the sharp setting)
* 3 - modified ELA-2 interpolation
* 4 - blend interpolation
* 5 - bi-directional blend interpolation

default - 2 (int)

You coult try something like:
Tdeint(type=5,tryweave=true)
or
tdeint(type=3)
etc

Or even:
tdeint(type=5, tryweave=true, aptype=2, expand=5, slow=2, blockx=32, blocky=32, MI=96)

Catch-22
12th July 2008, 18:58
Figure I'd just post here instead of a new thread.
Long time reader, first time poster.
I have been doing my own rips for a while now, but I have got some Region 4 (PAL) Family Guy VOBs that I'm trying to encode and who would've thought it could such a pain!

I have tried so many different methods (mfToon, vmToon, LineDarken, DFMDeRainbow, LUTDeRainbow, mfRainbow, TomsMoComp and more), but after many hours, here is what I have ended up with in my AviSynth script (with comments for you to read):

DGDecode_mpeg2source("F:\Movies\FGRIPS\Season1\101\VTS_02_1.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)
Load_Stdcall_Plugin("C:\Program Files\megui\tools\yadif\yadif.dll")
Yadif() #Couldn't really get satisfactory results with TomsMoComp or TDeInt.
Convolution3D("animeHQ") #Just some denoise, seems to help a bit.
aWarpSharp(8, 4, 0.5, 1)
crop( 10, 2, -10, -2)
LanczosResize(720,544)
#Deen("a3d",3,3,5) - Couldn't notice much difference at all, aside from increased encode time.
#TIsophote(5,0.1,2,false) - Noticed a difference, made the lines smooth (sort of like a hqnx filter), but a major performance hit, and deviates from the original image too much for my liking (aWarpSharp does a pretty good job at getting me nice lines).

I think as far as my ideal outcome is, this is almost there. I would've like to have 24 fps instead of 30 but as far as I know, that seems to be out of the question. The only issue I am having now is some rainbow colours(colors) around black lines (particularly if they are intersecting lines). I'm not sure what the technical term is for this or if this is to do with the YV12 colorspace or the deinterlacing, or whatever, but can anyone share any clues as to how I could go about fixing it? I have tried some DeRainbow scripts but they don't really seem to do all that much :(

Perhaps adjusting the bframes setting in my x264 setup as burfadel suggested could help, but I don't really see how at this point because the avs still contains the strange rainbow artifacts.

Does anyone have any of their own opinions in regards to my script in general? I'm open to suggestions :)

Thanks

Edit: Also in case you can't guess from the script, I am going to be using megui to encode.

Blue_MiSfit
12th July 2008, 20:25
Try something like this:


DGDecode_mpeg2source("F:\Movies\FGRIPS\Season1\101\VTS_02_1.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)

NNEDI() #Set field order with AssumeTFF or AssumeBFF first

crop( 10, 2, -10, -2)
LanczosResize(720,544)

fft3dfilter(plane=4, sigma=3, sigma2=.5, sigma3=1.3, sigma4=1.8) #fft3dgpu in case you have a fast GPU. Otherwise use fft3dfilter and set ncpu parameter to multithread
Toon() #play with strength


This is my usual aliased/shitty toon source script these days. I'd be interested in seeing how it works with Family Guy. Basically it throws away half the fields, since usually aliasing is a result of one being a lot sharper than the other. Pick whichever field seems sharper (using the field parameter in NNEDI), and it will interpolate that to full height using EDI, which is the most badass interpolation method I've ever seen :) Then, we do a general cleaning with fft3dfilter, at moderate strength. Tweak the sigma values as you see fit.

Finally, we hit it with Toon(), which as I understand provides warp sharpening, and line darkening. I _love_ its results. You might have to back its strength off a bit - the defaults are pretty strong.

Anyway - let's see a couple hundred frames (M2V, unprocessed, cut using DGIndex), ideally a scene that displays aliasing even with your previous attempts.

~MiSfit

Can you post a little sample?

Catch-22
13th July 2008, 08:27
Thanks, I gave that script a shot and the results are pretty similar, perhaps your alternative is a little more noisy. I am uploading a sample as we speak, but my upload bandwidth is 64k so it's going to be about half an hour ;) I think the sample is perhaps a little bit hefty (~600 frames) but it gives you a good contrast between different scenes.

http://www.mediafire.com/?mcgmhvjfmcj

When you look at it, with either yours, or my script:

In the 1st section with Peter and Brian talking (without sound, heh): You'll notice some ghosting in the very first frame of Peter's arm, this happens with NNEDI(field=0) and NNEDI(field=1), just at different spots. The ghosting overall isn't too bad. What you should keep an eye on in this scene is the flickering rainbow noise especially on the "crosshatch" pattern of the flyscreen door.

The 2nd section, a closeup of Brian talking: This scene isn't too bad. You can still notice some of the rainbow effect on the black lines though. Toon(strength=1.0) seems to help a little with this, although not entirely.

3rd section, Peter comes to a conclusion, zooms to his face: Once again, not too bad, although there's a fair bit of ghosting going on when Peter stands up, you have to be looking for it.

4th section, outside the welfare office: Not bad, ever so slight amount of noise, but there's only so perfect you can get a deinterlaced video I guess.

5th section, Peter talks to the welfare worker: Check out the phone cord, once again a very noticeable rainbow effect, not flickering as much as it was in the 1st section. Noisy venetian blinds.

6th section, Peter's close up in the welfare office: Actually thought I cut this scene but oh well, you can see a lot of interlacing in the original video when Peter's mouth is moving. Doesn't look too bad in my script, you can still see the noisy venetian blinds in the corner.

I also had a quick look in to using MC_Spuds to see if that could help with the noise but it seems pretty complicated...

Prettz
13th July 2008, 12:14
It could be progressive.. I've seen Adult Swim stuff that was 30p.
Wait, what? I'm sorry if this is probably a really newb question, but... what is 30p? I wasn't aware such a creature ever existed. What the heck do you convert something like "30p" into!?

Leak
13th July 2008, 17:30
Wait, what? I'm sorry if this is probably a really newb question, but... what is 30p? I wasn't aware such a creature ever existed. What the heck do you convert something like "30p" into!?
I guess he rounded 29.97p... i.e. 29.97 progressive frames per second transmitted as the 59.94 fields per second NTSC needs.

Think anime without telecine, like Haibane Renmei...

np: Nine Inch Nails - Another Version Of The Truth (Year Zero)

Blue_MiSfit
13th July 2008, 22:30
That's indeed what I meant.

This Family Guy looks brutally hard. Let me take a look at the sample..

~MiSfit

Nightshiver
14th July 2008, 06:42
Wouldn't
telecide()
decimate()
work just fine? I downloaded the short clip and it seemed to get rid of the interlacing. There are other problems of heavy rainbows, aliasing and noise.

Catch-22
14th July 2008, 23:13
Wouldn't
telecide()
decimate()
work just fine? I downloaded the short clip and it seemed to get rid of the interlacing. There are other problems of heavy rainbows, aliasing and noise.

Hmm, for some reason I thought telecide only worked on an NTSC source, not a PAL that has been converted from NTSC. I tried it anyway, and it seems to handle things a little better (so far as there not being as much ghosting), unfortunately I have noticed parts that are still interlaced, such as brians mouth in the 2nd section of my sample.

Neither method is perfect, but does Telecide() Decimate() convert it back to ~24fps? This would probably give me a much smaller file size while retaining decent quality :)

fbgd
15th July 2008, 01:42
Telecide will deinterlace frames it detects as still combed. You can try setting the vthresh parameter lower to try to catch more of the combed frames.

Catch-22
17th July 2008, 22:56
Okay, I almost have a result I am happy with. Does anyone have a solution to the "rainbow" aliasing?

TheRyuu
17th July 2008, 23:53
Derainbow:
# Last updated 1/28/05
#
# By Scintilla, with the third line of themask's definition
# borrowed from Shodan's derainbower
#
###################
#
# Syntax:
# DFMDeRainbow(clip org, int "maskthresh", bool "mask")
#
# Requires YUY2 or YV12 input. Is kinda slow.
# Suggestions for improvement welcome: scintilla@aquilinestudios.org
#
# Required plugins:
# MSharpen, MaskTools, FluxSmooth, Deen
#
# Arguments:
# maskthresh (default=10) - This is MSharpen's threshold value.
# Lower values will increase the area in which the blurred chroma
# is allowed to come through, which catches more edges but may
# cause desaturation and/or chroma bleeding.
# Set this as high as you can while still catching all the edges
# that need to be derainbowed.
# mask (default=false) - When true, this displays the mask instead of
# the image. Use this to find the optimal value of maskthresh.
#
###################

function DFMDeRainbow(clip org, int "maskthresh", bool "mask")
{
Assert(org.IsYUV(),"DFMDeRainbow: YUV input only")

org_u=org.UtoY()
org_v=org.VtoY()

first_u=org_u.FluxSmoothT(17).Blur(1.5)
first_v=org_v.FluxSmoothT(17).Blur(1.5)

themask=subtract(org,YtoUV(first_u,first_v,org)).Levels(108,1,148,0,255)
\ .MSharpen(mask=true,threshold=default(maskthresh,10)).Invert()
\ .Blur(0.5).Levels(0,2,255,0,255).Blur(0.5)

fixed_u=org_u.FluxSmoothST(17,14).FluxSmoothT(17).Deen("a2d",4,14,14).Blur(1.0)
fixed_v=org_v.FluxSmoothST(17,14).FluxSmoothT(17).Deen("a2d",4,14,14).Blur(1.0)
fixed=YtoUV(fixed_u,fixed_v,org)

output=MaskedMerge(fixed,org,themask,y=2,u=3,v=3)

return (default(mask,false)?themask:output)
}

AA:
function EE(clip clip, int "str", string "cspace"){

str = default(str,80)
cspace = default(cspace,"useless")

yv12 = clip.isYV12() ? clip : clip.converttoyv12()
aa_clip = yv12.LanczosResize(width(clip)*2,height(clip)*2). \
UnsharpMask(strength=str,radius=2,threshold=2). \
LanczosResize(width(clip),height(clip))
maske = yv12.EdgeMask(7,7,5,5,"sobel").inflate()
semi = MaskedMerge(yv12,aa_clip,maske)
semi = overlay(yv12,semi,mode="darken")

aa_clip2 = semi.LanczosResize(width(clip)*2,height(clip)*2). \
TurnLeft().SangNom().TurnRight().SangNom(). \
LanczosResize(width(clip),height(clip))
maske2 = semi.EdgeMask(7,7,5,5,"sobel").inflate()
new = MaskedMerge(semi,aa_clip2,maske2)
new = overlay(semi,new,mode="darken").MergeChroma(yv12)

orig_cspace = clip.isRGB32() ? new.converttoRGB32() :
\ clip.isRGB24() ? new.converttoRGB24() :
\ clip.isYUY2() ? new.converttoYUY2() :
\ new

final = (cspace == "YV12") ? new :
\ (cspace == "YUY2") ? new.converttoYUY2() :
\ (cspace == "RGB24") ? new.converttoRGB24() :
\ (cspace == "RGB32") ? new.converttoRGB32() :
\ orig_cspace

return final }

Don't be afraid to use deen on family guy. THere's zero background detail so you can really crank it up sometimes.
I'd call awarpsharp(8,1) or something after the AA to combat some of the haloing. A stronger one like dehalo_alpha be be nessasary if you think the halong is still too strong afterwards.

deen()
DMFDerainbow()
EE()
awarpsharp(8,1)