PDA

View Full Version : Encoding NGE the Remastered Platinum Edition


Nightshiver
7th May 2008, 13:44
I'm encoding some of my anime and was just wondering if anyone happened to have any better settings for my script I'm using. I'm encoding NGE the Remastered Platinum Edition, and I will post 2 samples. The first will be the unfiltered original, and the second will be the filtered one. Following those links will be my script.

UNFILTERED: http://www.megaupload.com/?d=I9KH3JK9
FILTERED: http://www.megaupload.com/?d=831L55IV


Scipt:

MPEG2Source("E:\test.d2v")
deint = TDeint(mode=2, mtnmode=3, blim=100)
TFM(order=-1,mode=5,PP=7,field=-1,slow=2, clip2=deint)
TDecimate(mode=1)
source=last
backward_vec2 = source.MVAnalyse(isb = true,blksize=8, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
backward_vec1 = source.MVAnalyse(isb = true,blksize=8, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec1 = source.MVAnalyse(isb = false,blksize=8, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = source.MVAnalyse(isb = false,blksize=8, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
source.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=1000,idx=1)
removegrain (mode=5)
dfttest()
Dedot ()
LimitedSharpenFaster(ss_x=1.5, ss_y=1.5, smode=3, strength=125, overshoot=1, undershoot=1)
Tweak(cont=1.1,sat=1.3,bright=0, hue=0)

Mystery Keeper
7th May 2008, 17:13
Using both PP and clip2 parameters of TFM doesn't make sense. You can remove PP.

thetoof
7th May 2008, 20:10
A few issues: combing still present, over-denoised (reveals banding), bad aspect ratio.

Could you upload a smaller m2v with a lot of motion? It will be easier to know which type of IVTC/deinterlacing is needed.
You can do some small denoise with dfttest to remove the annoying noise and keep the good gradient grain and then stabilize it to transform it into some dithering that will be kept by x264
grainy=dfttest(smode=0,sbsize=5,tbsize=5,sigma=3.5)
clean=dfttest(smode=0,sbsize=5,tbsize=5,sigma=20)
grainoptimizer(grainy,clean,tdist=9999)
Consider cropping the overscan and resizing, or cropping and using a custom anamorphic flag in mkvmerge.

Nightshiver
8th May 2008, 00:56
Over denoising meaning I should get rid of removegrain and LSF? I did resize the original down to 640x480, and I'll crop it on the next time also. I use AutoMKV to encode the whole thing. So would my edited script read something like this:

MPEG2Source("E:\nge.d2v")
deint = TDeint(mode=2, mtnmode=3, blim=100)
TFM(order=-1,mode=5,field=-1,slow=2, clip2=deint)
TDecimate(mode=1)
source=last
backward_vec2 = source.MVAnalyse(isb = true,blksize=8, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
backward_vec1 = source.MVAnalyse(isb = true,blksize=8, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec1 = source.MVAnalyse(isb = false,blksize=8, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = source.MVAnalyse(isb = false,blksize=8, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
source.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=1000,idx=1)
dfttest(smode=0,sbsize=5,tbsize=5,sigma=20)
Dedot ()
Tweak(cont=1.1,sat=1.3,bright=0, hue=0)
Crop(4,0,-4,0)

And by smaller d2v do you mean you want me to upload the actual .d2v file or just another test vob?
After cropping in Vdubmod, the simple function I had to do was Crop(4,0,-4,0).

thetoof
8th May 2008, 07:23
Over denoising means that your denoising settings are so high that you lose details and screw up your color gradients. Instead of having nice transitions between colors (like in the sky), you get stripes of color. The settings I gave you will help preserve all that detail and will also make your source more compressible (not as much as overdenoising would do, but I don't consider that a valid option). Sharpening should be kept. Also, lowering the contrast to 0.9 is imo better than increasing it, since the buildings in the background are more visible this way.

You could use:
MPEG2Source("E:\nge.d2v")
#IVTC (I need the clip to know which type would work better
grainy=dfttest(smode=0,sbsize=5,tbsize=5,sigma=3.5)
clean=dfttest(smode=0,sbsize=5,tbsize=5,sigma=20)
dull=grainoptimizer(grainy,clean,tdist=9999)
sharp=dull.limitedsharpenfaster(2,2,720,480,3,200)
soothe(sharp,dull)
#any other filters you want, like tweak, crop and resize...
By smaller m2v, I mean a m2v that is easier to transfer (5-10MB max) than your previous 20MB file that would give me a sample of your episode with a lot of motion, so that I can spot which type of IVTC is more appropriate. Drag and drop your vob in DGIndex, select "honor pulldown flags" & "IEEE-1180 reference" in the video options, set "disable" for the audio output method, select a small part with a lot of motion (like an action scene) and "save and demux video". Upload the m2v it'll output to mediafire.com and post the link.

Nightshiver
8th May 2008, 13:37
Hey. I'll post the m2v when I get back. I'm leaving right now to go to Darlington and watch the race on Saturday. I'll post back either Sunday or Monday.

Nightshiver
12th May 2008, 02:45
Back. Here's the file: http://www.mediafire.com/?tem9oxdrnow
Sorry that it's 20mb again, but I felt it had a lot going in those short 30 seconds.

cestfait
12th May 2008, 03:43
that dfttest isn't helping... you shouldn't need more denoising than removegrain(1) and mvdegrain (maybe mvd3 if you want to be more meticulous).

why is dedot there, again?

and I wouldn't use automkv, if I were you... doesn't it use a very old revision of x264? you won't have any vaq or speed optimizations. you could try megui.

thetoof
12th May 2008, 04:27
I think the denoising + sharpening stage is quite well covered in my previous post and I'll post later about the color correction (when I'll have the time to compare some settings).

Regarding IVTC, you may want to follow this (http://forum.doom9.org/showthread.php?p=1134073#post1134073) thread as your source fits in the "proper hard telecine" category. I'd recommend the same thing as I did to Nealhon : use
telecide()
decimate()
and read more about hard telecined sources (and the decomb documentation) to find something to remove the residual combing.

Nightshiver
12th May 2008, 13:16
Why use telecide? I prefer TFM and Tdecimate over telecide. I don't think AutoMKV has an oudated version of x264, not in the beta. Besides, I once again prefer AutoMKV to MeGUI because it yeilds better results.

cestfait
12th May 2008, 19:42
that sounds like a groundless argument. remember that your encoder is much more pivotal than your filters. are you familiar with x264 settings that don't have little checkboxes?

thetoof
12th May 2008, 20:11
Why use telecide? I prefer TFM and Tdecimate over telecide.
No special reason... use whatever you want, but the problem lies in the residual combing, so if either of them could remove it, use it. In your first try in x264 and with the settings I gave, the problem remains. So, we'll have to find how to tweak them properly or use another plugin.

are you familiar with x264 settings that don't have little checkboxes?
Had a good laugh :p Nightshiver, don't mix "easy to use" and "quality encode". Megui gives a LOT of settings to tweak that, when you know how they work, will produce awesome encodes (++ adapted to your source than profiles).

Nightshiver
12th May 2008, 21:10
So the mildly insulting comment was of high humor? Anyway, now regarding MeGUI, how would I go about encoding dual-audio, because in AutoMKV, there was an option to add a second audio track. Would I simply insert the first audio track, make sure that it retains the original 5.1 audio, click "enqueue" and then load and que the second audio track?

cestfait
13th May 2008, 00:46
encode the video and the audio separately then mux with mkvtoolnix. you can add as many audio tracks as you want. you could even throw in some styled subtitles. :)

I'm sorry you found that offensive, but I certainly needed comments like that when I started (to show me that ruling out anything because I didn't understand it was not getting me anywhere). I had to accept that I am a perfectionist (as much as that is possible when you're degrading quality by compressing video). At some point you're just going to have to learn your codec more intimately than you would like.

Same goes for scripting of course! ;)

...and obviously I still have a lot to learn, too.

Nightshiver
13th May 2008, 01:33
Thnx. Constructive criticism is needed.

TheRyuu
13th May 2008, 03:40
Why use telecide? I prefer TFM and Tdecimate over telecide. I don't think AutoMKV has an oudated version of x264, not in the beta. Besides, I once again prefer AutoMKV to MeGUI because it yeilds better results.

Decomb works better with yatta and pattern guidance, that's one reason to use telecide.

However in most cases, while using an IVTCer stand alone, like in your case, TIVTC is better.

MeGui, once you get use to it is superior to AutoMKV once you know how to use it. However, for beginners, it may be easier to use AutoMKV. That being said, both use x264 so there's no possible way one can look better then the other unless the settings differed THAT much.

thetoof
13th May 2008, 07:55
I found a simple way to remove the combing. Here is my "complete" script. x264 sample (http://www.mediafire.com/?d15qzlxzeyi)

#IVTC... use TFM + TDecimate if you want, but I didn't see any visual difference between them and the following.
telecide()
Decimate()

#Removes aliasing and residual combing
aaa()

#denoise + grain stabilizing (helps compressibility)
grainy=dfttest(smode=0,sbsize=5,tbsize=5,sigma=3.5)
clean=dfttest(smode=0,sbsize=5,tbsize=5,sigma=20)
dull=grainoptimizer(grainy,clean,tdist=9999)

#sharpen
sharp=dull.limitedsharpenfaster(2,2,720,480,3,200)
soothe(sharp,dull)

#chroma denoise... could be removed since it doesn't affect visual quality much, but it helps compressibility and works with the gpu, so you don't lose cpu power
fft3dgpu(sigma=4, bw=32, bh=32, bt=4, plane=3, precision=2)

#what looks good to my eyes... change if you want
tweak(cont=0.95, bright=7, sat=1.3)
coloryuv(off_u=3,off_v=-1)

#remove the overscan + resize to mod16 for encoding
crop(4,0,-2,-0)
spline36resize(720,480)

My x264 commandline (quite basic... it was only to show you that you can have good quality without having insane bitrates for SD (you had something like 2500kbps on your first encoded sample)). Since this is an action scene, the bitrate of 800kbps is not enough to get close to transparency, but it could be fine with the complete movie since some scenes don't have a lot of motion and will have a lower bitrate, thus increasing high motion scenes' bitrate.

--pass 2 --bitrate 800 --stats ".stats" --keyint 999 --min-keyint 8 --ref 16 --mixed-refs --no-fast-pskip --bframes 16 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -2,-1 --subme 7 --trellis 2 --partitions all --8x8dct --ratetol 3.0 --me tesa --threads auto --thread-input --progress --no-dct-decimate --no-psnr --no-ssim --output "output" "input"

The aspect ratio was altered during the cropping process, so you have 2 options: crop 4 to the height to preserve the AR or encode anamorphic by specifying a Display Aspect Ratio of 1.3222222222222222222222222222222 in mkvmerge.

Nightshiver
13th May 2008, 21:06
I want to resize to 640x480. Can I do that or should I go with 640x432?

thetoof
13th May 2008, 21:46
I strongly recommend encoding anamorphic because it will produce an encode with a much higher quality than a downsized one.

If you still want to resize to 640x480, replace the crop call in my script with crop(4,2,-2,-2) to keep the correct AR. (and of course, use spline36resize(640,480) instead of 720x480)

Nightshiver
14th May 2008, 01:19
At the end, the credits sort of "crawl". How do I fix this? In other words, they drag/lag.

thetoof
14th May 2008, 01:47
dot crawl and jaggies are 2 different problems... could you upload a small m2v of the credits? 30 frames is enough.

Nightshiver
14th May 2008, 02:14
It's not the original episode that has the jaggies. Once I encode the entire episode, or even just encode a small clip of the credits, it gives me the jaggies. So I think some filter or process is doing this, I just don't know which. Also, how do you tell what a correct AR is? Such as, how did you know to make the crop(4,2,-2,-2)?

thetoof
14th May 2008, 02:43
Yeah, I got that. The reason I asked for a m2v was to test various settings to avoid those jaggies you're talking about.

To remove the overscan, you need crop(4,0,-2,-0), but this would mess up the AR since what should be 720 to 640 is now 714 to 640. So, to avoid this problem, you need to crop the height by an equal value relatively to the original AR.
In other words, 480 = 0.666666 x 720, so when you crop 6 to 720, you need to crop 0.66666 x 6 to 480 = 4.

Nightshiver
14th May 2008, 03:23
http://www.mediafire.com/?dvtjntx4dnl

Very, very short clip of the credits. I have a little bit longer one if you need it.

thetoof
14th May 2008, 03:51
This is just... stupid. The episode is 24 fps telecined to 29,97 with a regular 3:2 pulldown, but the credits are pure interlaced. They had the great ideo to put 30i credits on 24p telecined material

This means you need something like mcbob() that'll give you 59.94 progressive fps with motion on every frame to properly deinterlace the credits. You could also use mcbob().selecteven() to keep a 29.97 framerate without jerkiness.

So, you can't decimate that part of the episode because it'll become jerky and therefore you'll have to create a VFR (Variable Frame Rate) encode. I only know it exists and I never had to use it before, so all I can say is : read about vfr on avisynth's wiki and learn how to use mkvmerge because you'll have to put a timecode file in it to create your vfr clip.

Another alternative would be to use trim to cut the credits :p

Xicor
16th May 2008, 05:53
You mind as well ignore the credits. What you're describing is a widespread problem when it comes to anime DVDs, and trying to fix it will just give you headaches.

martino
16th May 2008, 12:30
http://www.mediafire.com/?dvtjntx4dnl

Very, very short clip of the credits. I have a little bit longer one if you need it.
SeparateFields()
SelectOdd()
nnedi(field=1,dh=true)

or just

nnedi(field=0)

The scrolling isn't smooth just with nnedi(), but at least you are getting rid of the evil interlacing. Nothing is worse to me personally than leaving interlaced footage no matter how fucked up it is where it shouldn't be. And preferably do not decimate that section (looking at YATTA may be out of interest, it'll make your job much simpler). Else you can always do the decimated and non-decimated sections yourself in the script, just count with a lot of manual work in regards to timecode creation and frame counting.

thetoof
19th May 2008, 01:22
Other solution: convert the framerate of the credits after deinterlacing.
Change the IVTC part with this:
raw=mpeg2source("yourd2v.d2v")
a=raw.telecide().Decimate().aaa().trim(0,x) # Use your prefered IVTC method, as long as you add .aaa().trim(0,x) at the end, where x is the last frame before the credits. Be sure to check what is the number of that frame after ivtc.
source=raw.mcbob() #or any other deinterlacer you want... but for pure interlaced material, this is by far the best (well, imo ;))
backward_vec = source.MVAnalyse(isb = true, pel=4, idx=1,search=3, overlap=6)
forward_vec = source.MVAnalyse(isb = false, pel=4, idx=1,search=3, overlap=6)
b=source.MVFlowFps(backward_vec, forward_vec, num=24000, den=1001, ml=100, idx=1).trim(first frame of the credits,last frame of the credits) #Be sure to check those numbers after the framerate conversion
#and, if you have something after the credits (like a preview)
c=raw.telecide().Decimate().aaa().trim(frame after the credits,0)
a+b+c
I strongly recommend that you do a rendering pass with this part only and then reload the resulting clip in another script because the framerate conversion is freaking slow.

TheRyuu
19th May 2008, 22:57
This is just... stupid. The episode is 24 fps telecined to 29,97 with a regular 3:2 pulldown, but the credits are pure interlaced. They had the great ideo to put 30i credits on 24p telecined material

This means you need something like mcbob() that'll give you 59.94 progressive fps with motion on every frame to properly deinterlace the credits. You could also use mcbob().selecteven() to keep a 29.97 framerate without jerkiness.

So, you can't decimate that part of the episode because it'll become jerky and therefore you'll have to create a VFR (Variable Frame Rate) encode. I only know it exists and I never had to use it before, so all I can say is : read about vfr on avisynth's wiki and learn how to use mkvmerge because you'll have to put a timecode file in it to create your vfr clip.

Another alternative would be to use trim to cut the credits :p

They're actually not.
It's basically two fields. You have the credits and the background overlapping in most cases which is what causes the credits to look the way they do. It is very common in scrolling anime credits.
You could vfr it and use nnedi to try and make it look better, but that can be a lot of work especially for a beginner since there's pretty much only yatta that I know of that can do a vfr ed the way he wants it.

You can use nnedi to try and clean it up, the scrolling motion will never be smooth since you SHOULD set the pattern to the background material and then postprocess the scrolling credits somehow. You can use nnedi, or yadifmod with nnedi, or smart bob nnedi with tdeint, they all work for what you need.

Or you can just leave it interlaced since does it really matter what the credits are? (or splice in a creditless version?)

Mug Funky
20th May 2008, 15:15
why is it stupid to have interlaced credits? you can run them faster and they look better - this means more room for the show itself...

also, back in the day (remember how old this series is), there was no choice in the matter. the animation was shot on film, run through a telecine, then edited and onlined in a system that works in 60i. if it never was intended to play in a cinema there's no shame in doing it that way.

i had a shot at handling this stuff using tdeint in fieldmatch mode, and blendbob if you want to take it to 24fps. the film parts in the closing will come out sharp, and the scrolling credits will be deinterlaced (and you'll have to put up with juddery and unreadable credits considering the speed they run, unless you want to re-type them and reconstruct them from the textless closing in the extras part of the disc, and do it all in slo-mo).

you could always leave it interlaced and use a playback chain that supports real video

thetoof
20th May 2008, 20:34
you can run them faster and they look better - this means more room for the show itself...
True, but it becomes a problem when you need a CFR clip with no telecining or interlacing.

The method I mentionned before *works*, but the credits run quite fast and they are harder to read than a deinterlaced version of the same clip.

also, back in the day (remember how old this series is), there was no choice in the matter
Hmmm, not so sure about this. It could have happened on the first release of this anime, but since this is a recent remastered version, they could have done it better. The first improvement being soft telecine. (Not impossible; something as old as the 1979's Gundam was properly encoded with soft telecine for all the episodes)

dbzgundam
21st May 2008, 07:49
why is it stupid to have interlaced credits? you can run them faster and they look better - this means more room for the show itself...

also, back in the day (remember how old this series is), there was no choice in the matter. the animation was shot on film, run through a telecine, then edited and onlined in a system that works in 60i. if it never was intended to play in a cinema there's no shame in doing it that way.
Opinions will always be opinions, but I'll leave my stance as ALL interlacing being stupid. :)

Regardless though, I too have these discs and became enraged at the immediate difference from the R2s (Progressive, though the R2s still have messed up field issues in many shots). The show itself is interlaced on the R1 release, which I can somewhat deal with, although it kind of defeats the remastering.

And no, the animation wasn't always run through a telecine and edited in a 60i environment. Even if it was, film masters for the individual shots still exist (as these have been scanned in from 16mm prints for Eva, 35mm on the OP/ED). Although this terrible practice is commonplace in american animation (and modern anime as well), older cel shows were often edited during photography afaik. Granted, not always of course, and I can't cite specific shows, but a remaster should not contain such problems. To ruin the job with interlaced credits is something that should have never happened.

Leak
21st May 2008, 12:21
and you'll have to put up with juddery and unreadable credits considering the speed they run, unless you want to re-type them and reconstruct them from the textless closing in the extras part of the disc, and do it all in slo-mo.
Shouldn't it be possible to build a mask for the text by comparing the ED with credits to the creditless ED, then removing everything but the masked text, doing proper rate conversion on it then overlaying the converted text on the creditless ED?

(Not that I would do such a thing, but... :p)

np: The Notwist - One With The Freaks (Neon Golden)

dbzgundam
22nd May 2008, 06:06
Shouldn't it be possible to build a mask for the text by comparing the ED with credits to the creditless ED, then removing everything but the masked text, doing proper rate conversion on it then overlaying the converted text on the creditless ED?

(Not that I would do such a thing, but... :p)

np: The Notwist - One With The Freaks (Neon Golden)
Or better yet, is it possible to OCR the text and just overlay it onto a textless version?... Or would the combing throw off the OCR too much?

thetoof
22nd May 2008, 09:15
Opinions will always be opinions, but I'll leave my stance as ALL interlacing being stupid. :)
Interlacing is a way to put 2 frames in one and display some kind of virtual 60p (for NTSC) while still complying to the TV/DVD standard, so no, interlacing is not that stupid.

BTW, the framerate conversion is done in the alternative I gave above... and it affected the text's readability (they became "juddery and unreadable" as Mug Funky said) because a movement that should be displayed at 29,97 fps is now displayed at 23,976.
If you want to keep an equivalent readability, you need to slow them down... but with a 20% slowdown even females singers would sound like tenors.

@Nightshiver
You have two options:
- Do the framerate conversion
- Splice in a creditless version

egrimisu
24th June 2008, 09:23
I have the same problem with the R2 anime dvd's, all seem to be encoded in the same tehnique. I'm hoping that somone will make a script that could fix these all. I'm a newbie and it would be nice if someone will give us a metod to fix it and not things to try. For example for a mixed footage(interlnaced opening,progestive middle at 29.97, and interlanced end that have all the frames interlanced(like the m2v exemple up in the page)) i just don't know what to do to encode it porperly. So please help.