VideoHelp Forum
+ Reply to Thread
Page 2 of 5
FirstFirst 1 2 3 4 ... LastLast
Results 31 to 60 of 122
Thread
  1. Originally Posted by jagabo View Post
    The pulldown pattern is very irregular at the start of the clip. But it decimates down to 23.976 fps smoothly with:

    Code:
    Mpeg2Source("S8.E2-TestClip.d2v", Info=3) 
    TFM(d2v="S8.E2-TestClip.d2v") 
    TDecimate(Cycle=30, CycleR=6)
    You might be able to get away with "Cycle=15, CycleR=3" or even "Cycle=10, CycleR=2" with a longer clip.
    As always thanks for your help (and your patience), jagabo. I'll run an episode from Season 8 tonight and check it in the morning, applying your suggestion if necessary .

    I've another question related to this project, but it's more of a general AviSynth question so if you think it's better let me know and I'll start a new thread. The question: as I've encountered random single frames or small sections of frames not properly encoded by my general script, I've used AviDemux to cut out (on i-frames) the small sections containing this-these frames, reencoded the small sections with your super script (from a few posts back), then remuxed the sections back into the main file using MKVMerge. My thought was that this way I can avoid reencoding the 99+% of the encode that looks fine and only reencode the flawed bits. This works reasonably well, but usually there's a difference of several hundred milliseconds in the length of the section from the source and the length of this section after reencoding, which throws the audio out of sync. After trial and (much) error I've gotten pretty good at cutting, reencoding, remuxing with audio, cutting again, syncing the audio for each section, then re-remuxing the parts into a synced whole. Needless to type, this is extremely tedious. Then it dawned on me: I should be able to replace frames with AviSynth, as thus:

    1) Create the full encode.

    2) If there are bad frame(s), then cut out the appropriate section(s) with AviDemux (easier than Trim, I think, at least for me) and reencode it with jagabo's super script.

    3) View the original encode and note the bad frame(s)'s number(s); view the reencoded section and note the matching good frame(s)'s numbers(s).

    4) Replace the bad frame(s) in the original encode with the good frame(s) from the reencoded section using AviSynth.

    5) Audio syncs perfectly because the original encode is essentially the same.

    My problem is, how to replace frames in AviSynth when the BaseClip and the SourceClip aren't the same length (thus the frame numbers don't match)? As far as I could understand, ClipClop and ReplaceFramesSimple don't have this ability; they require that the BaseClip and the SourceClip are the same length due to their mapping schemes, which to me defeats the purpose of replacing frames if you have to reencode the entire file anyway. Surely I'm missing something, which wouldn't be a first , and I honestly hope others get a good chuckle out of my ignorance. Seriously . Anyway, what I'm wondering is how to replace frames when :

    Code:
    # A is the entire original encode, thousands of frames, with occasional bad frame(s)
    # B is a few hundred frames, a reencode of a section of A to make good replacement frame(s)
    
    # Make believe there's a single bad frame in A, 13666, and a good replacement frame in B, 333; what's the script to replace frame number 13666 in A with frame 333 in B?
    
    A=DirectShowSource("D:\BaseClip.mkv")
    B=DirectShowSource("D:\SourceClip.mkv")
    
    # The Proper Script (please stop laughing at my idiocy; I know the answer will be obvious once seen)
    Thanks for any help, sorry if your head exploded .
    Last edited by LouieChuckyMerry; 26th May 2015 at 21:21. Reason: Grammar & Lucidity
    Quote Quote  
  2. So you want to replace frame 13666 of A with frame 333 of B? Here's one way:

    Code:
    A1=A.Trim(0,13665)
    A2=A.Trim(13667,0)
    B1=B.Trim(333,333)
    A1+B1+A2
    You could do that all in one line:

    Code:
    A.Trim(0,13665)+B.Trim(333,333)+A.Trim(13667,0)
    Quote Quote  
  3. Originally Posted by jagabo View Post
    So you want to replace frame 13666 of A with frame 333 of B? Here's one way:

    Code:
    A1=A.Trim(0,13665)
    A2=A.Trim(13667,0)
    B1=B.Trim(333,333)
    A1+B1+A2
    You could do that all in one line:

    Code:
    A.Trim(0,13665)+B.Trim(333,333)+A.Trim(13667,0)
    That's so awesome, jagabo, thank you! It makes perfect sense, now that I see it. Doh! . And I suppose there can be as many lines-trims as desired, including sections of contiguous frames? Something like:

    Code:
    # A is the entire original encode, thousands of frames, with occasional bad frame(s)
    # B is a few hundred frames, a reencode of a section of A to make good replacement frame(s)
    
    # Make believe there's a single bad frame in A, 13666, and a good replacement frame in B, 333; also, there's a section of bad frames in A, 11111-11117, and a section of good replacement frames in B, 222-228, thus:
    
    A=DirectShowSource("D:\BaseClip.mkv")
    B=DirectShowSource("D:\SourceClip.mkv")
    
    A.Trim(0,11110)+B.Trim(222,228)+A.Trim(11118,13665)+B.Trim(333,333)+A.Trim(13667,0)
    
    # Add-subtract as necessary (and make a template, idiot!)
    Ahhh, I suppose there could be multiple SourceClips as well, B, C, D, Etc, as long as the script is clearly written?

    While checking out RemapFrames what threw me off is the wording in the RemapFrames html:

    Code:
    # Replaces frames 10..20, 25, and 30 from baseClip with the
    # corresponding frames from sourceClip.
    ReplaceFramesSimple(baseClip, sourceClip, mappings="[10 20] 25 30")
    I took "corrosponding" to mean "having the same number" and can't figure out how to "choose" whatever replacement frames I want from the SourceClip. I have the same difficulty understanding ClipClop; the simplest example I found was by the author, StanlessStephen (StainlessS on Doom9), on an old VideoHelp thread:

    Code:
    a=avisource("C:\filteredvideo.avi")
    b=avisource("C:\derainbowed.avi")
    
    SCMD="
    1 1510,3551
    1 3789,4600
    "
    ClipClop(a,b,scmd=SCMD)
    Although, I reckon I should head to the ClipClop thread at Doom9 to ask questions. Thanks again for a real moment of clarity, jagabo, I really appreciate it (and I'm making a template as I type this... ).
    Last edited by LouieChuckyMerry; 27th May 2015 at 03:15. Reason: An Epiphany
    Quote Quote  
  4. Yes, you can use multiple sources and any lengths with Trim(). ReplaceFramesSimple() replaces only the same frame numbers as you surmised. I've never used ClipClop and don't know anything about it. Something else you may occasionally find useful is replacing a damaged frame with either the frame before or the frame after:

    Code:
    ######################################################
    
    function ReplaceFrameNext(clip Source, int N)
    {
      # Replace frame at N with a copy of frame N+1
      # N is the frame to replace
      # with frame at N+1
    
      loop(Source, 0, N, N)
      loop(last, 2, N, N)
    }
    
    ######################################################
    
    function ReplaceFramePrev(clip Source, int N)
    {
      # Replace frame at N with a copy of frame N-1
      # N is the frame to replace
      # with frame at N-1
    
      loop(Source, 0, N, N)
      loop(last, 2, N-1, N-1)
    }
    
    ######################################################
    It won't work well for animation but ReplaceFramesMC() replaces a frame (or multiple consecutive frames) with motion interpolated from the surrounding frames.

    https://forum.videohelp.com/threads/352741-Frame-interpolation?p=2226119&viewfull=1#post2226119

    That post also includes InsertFramesMC() which can be used to insert missing frames with motion interpolation.
    Last edited by jagabo; 27th May 2015 at 06:25.
    Quote Quote  
  5. Originally Posted by jagabo View Post
    Yes, you can use multiple sources and any lengths with Trim(). ReplaceFramesSimple() replaces only the same frame numbers as you surmised. I've never used ClipClop and don't know anything about it.
    Thanks for the verifications .


    Originally Posted by jagabo View Post
    Something else you may occasionally find useful is replacing a damaged frame with either the frame before or the frame after:

    Code:
    ######################################################
    
    function ReplaceFrameNext(clip Source, int N)
    {
      # Replace frame at N with a copy of frame N+1
      # N is the frame to replace
      # with frame at N+1
    
      loop(Source, 0, N, N)
      loop(last, 2, N, N)
    }
    
    ######################################################
    
    function ReplaceFramePrev(clip Source, int N)
    {
      # Replace frame at N with a copy of frame N-1
      # N is the frame to replace
      # with frame at N-1
    
      loop(Source, 0, N, N)
      loop(last, 2, N-1, N-1)
    }
    
    ######################################################
    It won't work well for animation but ReplaceFramesMC() replaces a frame (or multiple consecutive frames) with motion interpolated from the surrounding frames.

    https://forum.videohelp.com/threads/352741-Frame-interpolation?p=2226119&viewfull=1#post2226119

    That post also includes InsertFramesMC() which can be used to insert missing frames with motion interpolation.
    Thanks again for that. You showed me the above code a dozen-or-so posts ago, but I'm really really glad you mentioned it again because when I made my original template I ignorantly combined the frame before-frame after scripts into a single script that, well, essentially cancelled itself out (which I guess explains why it didn't appear to do much good ). Sigh. At least now I can sort it out and try it again, so, really, thank you very much (as always).

    After you pointed me in the right direction, I was able to write a functional script for one of my frame replacement needs:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    A=FFVideoSource("D:\BaseClip.mkv", fpsnum=24000, fpsden=1001, threads=1)
    B=FFVideoSource("D:\SourceClip.mkv", fpsnum=24000, fpsden=1001, threads=1)
    
    A.Trim(0,19011)+B.Trim(138,138)+A.Trim(19013,19031)+B.Trim(145,146)+A.Trim(19034,0)
    The above viewed in MeGUI's video preview window looks great but, er, how do I save the video? That is, how do I simply have the three bad frames in the BaseClip replaced by the three good frames in the SourceClip without reencoding the video (which to me would be the entire point of doing it this way)? Both the BaseClip and SourceClip were encoded with the same settings (and are stitchable), so that shouldn't be an issue. VirtualDub's "Direct stream copy" spits out a 14.1 GB avi file (the original BaseCopy is only 263 MB). Once again I'm sure there's a simple, obvious solution that'll have me shaking my head, but on the bright side at least my idiocy is good for a laugh .

    Ahhh, I ran an episode of Season 8 with your suggestion and it looks great, thanks. Hopefully there won't be any oddball blending-interlaced frames-sections in the last few seasons. "A man can dream, a man can dream."
    Last edited by LouieChuckyMerry; 28th May 2015 at 03:53. Reason: "[/Code]" & "."
    Quote Quote  
  6. Originally Posted by LouieChuckyMerry View Post
    The above viewed in MeGUI's video preview window looks great but, er, how do I save the video? That is, how do I simply have the three bad frames in the BaseClip replaced by the three good frames in the SourceClip without reencoding the video (which to me would be the entire point of doing it this way)?
    You can't. Any time you use AviSynth you are decompressing the source video(s).

    You can't replace arbitrary frames in a long GOP compressed video. The best you can do is replace entire GOPs. You'll need to use a non-reencoding video editor that cuts at I frames to cut the video into separate files, encode the sections that you're replacing, then use the editor to paste the files back together. Open GOPs can cause problems when you do this -- always use closed GOPs if you intend to edit this way.

    For example, say you need to replace frame 1000 of a video. And the nearest I frames are at 900 and 1100. You first save frames 0-899 as one file1, and frames 1100-end as file3. Encode a new video with frames 900 to 1099 as file2. Then append file1, file2, and file3.

    It's usually easier to encode the entire video from the source again!
    Quote Quote  
  7. Originally Posted by jagabo View Post
    It's usually easier to encode the entire video from the source again!
    Now you tell me, ha ha. Ahhh, Happy Friday . Thanks for the short tutorial; that's exactly what I was doing before my epiphany regarding ReplaceFrame. And I was so excited (hey, it is called ReplaceFrame, not ReplaceFrameButOnlyWhenUncompressed ). I guess it's back to Avidemux, chop-chop! Hopefully there won't be too many more glitches...
    Quote Quote  
  8. As I started Season 9 I bumped into the reality of 10-bit x264 and, after I made the mistake of comparing its output quality to that of 8-bit x264, I've decided to upgrade to 10-bit. However, I'm not quite sure how this changes my script:

    Code:
    # Set DAR in encoder to 6480 : 4739. The following line is for automatic signalling
    global MeGUI_darx = 6480
    global MeGUI_dary = 4739
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    FFVideoSource("SourcePath", fpsnum=30000, fpsden=1001, threads=1)
    ### Deinterlace ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    TFM(Order=-1,Mode=5,Slow=2,CThresh=6).TDecimate(Mode=1,Cycle=15,CycleR=3)
    Vinverse()
    ### Deshaker ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### Resize ###
    RatioResize(10/11.0,"PAR")
    ### 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(dfttest(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(tr=2,thSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2)
    ### Debanding ###
    GradFun3(thR=0.55,Radius=12,Mask=2,SMode=1,Lsb=True,Lsb_In=True, StaticNoise=True,Y=3,U=3,V=3)
    DitherPost(Stacked=True,Prot=False,Mode=0)
    ### Line Darkener And Thinner ###
    FastLineDarkenMod(Strength=20,Prot=6,Thinning=0)
    aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    From what I understand 10-bit x264 doesn't need dithering. So in the above script SMDegrain is converting to 16-bit with Lsb=True, then sending this 16-bit output to GradFun3 with Lsb_Out=True, then GradFun3 is processing this 16-bit input with Lsb_In=True and outputing 16-bit to Dither for conversion to 8-bit before sending it to x264 10-bit. What I can't figure out is how to skip the Dither conversion to 8-bit and instead send the GradFun3 16-bit output directly to x264 10-bit. Or is the Dither 16-bit-->8-bit necessary for the line darkening and thinning? Thanks for any help .
    Quote Quote  
  9. If I were you I would recommend you to encode in 8-bit. There's nothing you can't do in 8-bit x264 that you can do in 10-bit. Do some wise bitrate shaping (ie aq-strength) and increase bitrate a bit more and you are done. In 10 or 20 years you will thank yourself for not encoding in a non standard codec (if bluray for Simpsons is not released before)

    In case you still want to encode in 10-bit, delete the Ditherpost line and use at the end of your script Dither_Out().
    The 8-bit line filters are not limited but recommended to do in 8-bit, still you can try some methods to mix 8-bit and 16-bit filtering, in the Dither tools documentation you have two examples in the section "Combining 8- and 16-bit processing". Use the second example first where it says "Filtering in 16 bits with basic sharpening", move ditherpost at the end of your script (without Dither_Out ) to check everything looks fine like it did before, then remove Ditherpost and replace with Dither_Out() at the end to encode.
    Quote Quote  
  10. Originally Posted by Dogway View Post
    If I were you I would recommend you to encode in 8-bit. There's nothing you can't do in 8-bit x264 that you can do in 10-bit. Do some wise bitrate shaping (ie aq-strength) and increase bitrate a bit more and you are done. In 10 or 20 years you will thank yourself for not encoding in a non standard codec (if bluray for Simpsons is not released before)
    The quality gain with 10-bit is so noticeable on my 14" 1600x900 laptop screen that I was thinking about future playback on that hoped for large screen TV. Is your concern strictly compatibility? If I ever do have a large screen TV I'd be using a computer with an HDMI cable for playing my files; I've never burned discs for playback. Regardless (now I have to think about it some more), I was planning to up the bit rate to ~2000. How would you suggest tweaking aq-strength?

    Originally Posted by Dogway View Post
    In case you still want to encode in 10-bit, delete the Ditherpost line and use at the end of your script Dither_Out().
    The 8-bit line filters are not limited but recommended to do in 8-bit, still you can try some methods to mix 8-bit and 16-bit filtering, in the Dither tools documentation you have two examples in the section "Combining 8- and 16-bit processing". Use the second example first where it says "Filtering in 16 bits with basic sharpening", move ditherpost at the end of your script (without Dither_Out ) to check everything looks fine like it did before, then remove Ditherpost and replace with Dither_Out() at the end to encode.
    Thank you very much for the information. I searched about for an answer to my question but was seemingly not using the correct terms. I'll attack the Dither tools documentation tomorrow when I've some free time and see if I can make it work.
    Quote Quote  
  11. Laptop screens are normally over-brighten, so it's very easy to see all the flaws in the dark range which are commonly hard to encode. With that said use what you find best but I was trying to give you all kind of perspectives since you seem to care so much about details. My opinion is you can get by with ordered dither out of GradFun3, and encode at about 2000kbps (I rarely encode at less for SD).

    Try the 16-bit and 8-bit filtering mix and ask if you got any issues my it should be quite straight forward.
    Quote Quote  
  12. After reading the Dither tools documentation and a bit of trial-and-error I came up with:

    Code:
    # Set DAR in encoder to 6480 : 4739. The following line is for automatic signalling
    global MeGUI_darx = 6480
    global MeGUI_dary = 4739
    SetMemoryMax(256)
    SetMTMode(3,3)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    FFVideoSource("SourcePath", fpsnum=30000, fpsden=1001, threads=1)
    ### Deinterlace ###
    SetMTMode(5)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    TFM(Order=-1,Slow=2,PP=0).TDecimate(Mode=1)
    SetMTMode(2)
    Vinverse()
    ### Deshaker ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### Resize ###
    RatioResize(10/11.0,"PAR")
    ### 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(dfttest(),Mask,Luma=True)
    ### Overall Temporal Denoise, Could Probably Be Optimized ###
    SMDegrain(tr=2,thSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2)
    ### Debanding ###
    GradFun3(thR=0.55,SMode=1,Lsb=True,Lsb_In=True,StaticNoise=True)
    ### Line Darkener And Thinner ###
    DFTTest(Lsb=True)
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=24,Prot=13,Thinning=0).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F)
    DitherPost()
    MT_AddDiff(Last,D,U=2,V=2)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    which output wrong color space, wrong aspect ratio video. However, adding:

    Code:
    --demuxer raw --input-depth 16 --input-res 640x480 --fps 23.976 --sar 10:11
    to the x264 command line output video with the proper color space and proper display aspect ratio (although MediaInfo shows an aspect ratio of 1.212, not sure why). Unfortunately, this doubles the encoding time .

    When I ran the original script with x264 10-bit the encoding time was much faster, so I wonder if I made a mistake somewhere above or if this is, in fact, the proper way so it takes twice as long?

    Is there a way to speed up the "### Line Darkener And Thinner ###" line, perhaps by tweaking the "FastLineDarkenMod" and-or "aWarpSharp" settings?

    Or is there a more efficient way to feed the 16-bit from "GradFun3" to the "DitherPost(Mode=-1)" line other than "DFTTest(Lsb=True)"? I read the GradFun3 docs but there's no "Lsb_Out=True" feature as far as I could tell.
    Quote Quote  
  13. There are many things wrong there. You included Dfttest from the example, which is a denoiser. Also I forgot that example 2 assumes you output to 8-bit, you are using Dither_Out on 8-bit material. I fixed the code to work on 16-bit, haven't tested though so check everything looks fine otherwise test example 1 in documentation. BTW, GradFun3(lsb=true) is the same as lsb_out=true.

    Code:
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=24,Prot=13,Thinning=0).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_convert_8_to_16 ()
    Dither_add16(last,D,dif=true,u=2,v=2)
    
    Dither_Out()
    Quote Quote  
  14. Originally Posted by Dogway View Post
    There are many things wrong there.
    No surprise there. .

    Originally Posted by Dogway View Post
    You included Dfttest from the example, which is a denoiser. Also I forgot that example 2 assumes you output to 8-bit, you are using Dither_Out on 8-bit material. I fixed the code to work on 16-bit, haven't tested though so check everything looks fine otherwise test example 1 in documentation. BTW, GradFun3(lsb=true) is the same as lsb_out=true.

    Code:
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=24,Prot=13,Thinning=0).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_convert_8_to_16 ()
    Dither_add16(last,D,dif=true,u=2,v=2)
    
    Dither_Out()
    Thanks for straightening that out, and for the clarification about GradFun3 (that explains a lot). Looking again at the two examples after reading the above helps them make way more sense. I was able to make functional scripts based on your above code and the first example, and they both seem to output same-quality video at similar bit rates and similar encoding speeds (speeds similar to simply running the original script with x264 10-bit). In case this helps someone in the future. Method One:

    Code:
    # Set DAR in encoder to 6480 : 4739. The following line is for automatic signalling
    global MeGUI_darx = 6480
    global MeGUI_dary = 4739
    SetMemoryMax(256)
    SetMTMode(3,3)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    FFVideoSource("D:\Temp\zSimpTemp\S1.E1-[I-4028].mkv", fpsnum=30000, fpsden=1001, threads=1)
    ### Deinterlace ###
    SetMTMode(5)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    TFM(Order=-1,Slow=2,PP=0).TDecimate(Mode=1)
    SetMTMode(2)
    Vinverse()
    ### Deshaker ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### Resize ###
    RatioResize(10/11.0,"PAR")
    ### 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(dfttest(),Mask,Luma=True)
    ### Overall Temporal Denoise, Could Probably Be Optimized ###
    SMDegrain(tr=2,thSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2)
    ### Debanding ###
    GradFun3(thR=0.55,SMode=1,Lsb=True,Lsb_In=True,StaticNoise=True)
    ### Line Darkener And Thinner ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=20,Prot=6,Thinning=0).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    and Method Two:

    Code:
    # Set DAR in encoder to 6480 : 4739. The following line is for automatic signalling
    global MeGUI_darx = 6480
    global MeGUI_dary = 4739
    SetMemoryMax(256)
    SetMTMode(3,3)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    FFVideoSource("D:\Temp\zSimpTemp\S1.E1-[I-4028].mkv", fpsnum=30000, fpsden=1001, threads=1)
    ### Deinterlace ###
    SetMTMode(5)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    TFM(Order=-1,Slow=2,PP=0).TDecimate(Mode=1)
    SetMTMode(2)
    Vinverse()
    ### Deshaker ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### Resize ###
    RatioResize(10/11.0,"PAR")
    ### 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(dfttest(),Mask,Luma=True)
    ### Overall Temporal Denoise, Could Probably Be Optimized ###
    SMDegrain(tr=2,thSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2)
    ### Debanding ###
    GradFun3(thR=0.55,SMode=1,Lsb=True,Lsb_In=True,StaticNoise=True)
    ### Line Darkener And Thinner ###
    S16=Last
    DitherPost(Mode=-1)
    FastLineDarkenMod(Strength=20,Prot=6,Thinning=0).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    Dither_Convert_8_To_16()
    S16.Dither_Limit_Dif16(Last,Thr=1.0,ELast=2.0)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()

    I've one (ha ha ha) more problem for which I can't find a solution. As I typed a couple posts ago, I need to add

    Code:
    --demuxer raw --input-depth 16 --input-res 640x480 --fps 23.976 --sar 10:11
    to the x264 command line in order to output video with proper color space and aspect ratio. However, I realized that the aspect ratio is actually off a little bit. If I run the original script with x264 10-bit and no command line additions, then the resulting video file, according to MediaInfo, is:

    Code:
    Width                                    : 640 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Original display aspect ratio            : 3:2
    and playback looks correct. However, if I run either of the two new, updated-for-16-bit-output scripts with x264 10-bit plus the command line additions, then the resulting video file, according to MediaInfo, is:

    Code:
    Width                                    : 640 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 1.212
    and playback looks not wide enough. No pixels are missing, they just seem a bit squeezed, left to right. If I remove "--sar 10:11" from the command line, then the displayed video is very very tall and thin, so I seem to need something there but I don't know exactly what. I could always remux all the videos with MkvMerge and force the aspect ratio, but it'd be nicer to learn why it's like this and how to fix it at the encoding stage.
    Quote Quote  
  15. Your video is no longer anamorphic, you fixed it with RatioResize(10/11.0,"PAR"), (BTW I recommend you to use LinearResize() using the resolution RatioResize gives you out)

    Use --sar 1:1 in x264, as in square pixel.
    Quote Quote  
  16. Ha ha! It works! Replacing "RatioResize(10/11.0,"PAR")" with "LinearResize(640,480,Kernel="Spline36",Mode=0 )" outputs 640x480, 4:3 video. I actually had tried "--sar 1:1" but it output video with an aspect ratio of 0.684 (that was before switching to LinearResize). And I thought I knew the definitions of "ratio" and "linear" . Anyway, to update:

    Code:
    # Set DAR in encoder to 6480 : 4739. The following line is for automatic signalling
    global MeGUI_darx = 6480
    global MeGUI_dary = 4739
    SetMemoryMax(256)
    SetMTMode(3,3)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    FFVideoSource("D:\Temp\zSimpTemp\S1.E1-[I-4028].mkv", fpsnum=30000, fpsden=1001, threads=1)
    ### Deinterlace ###
    SetMTMode(5)
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    TFM(Order=-1,Slow=2,PP=0).TDecimate(Mode=1)
    SetMTMode(2)
    Vinverse()
    ### Deshaker ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### Resize ###
    LinearResize(640,480,Kernel="Spline36",Mode=6)
    ### 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(dfttest(),Mask,Luma=True)
    ### Overall Temporal Denoise, Could Probably Be Optimized ###
    SMDegrain(tr=2,thSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2)
    ### Debanding ###
    GradFun3(thR=0.55,SMode=1,Lsb=True,Lsb_In=True,StaticNoise=True)
    ### Line Darkener And Thinner ###
    S16=Last
    DitherPost(Mode=-1)
    FastLineDarkenMod(Strength=20,Prot=6,Thinning=0).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    Dither_Convert_8_To_16()
    S16.Dither_Limit_Dif16(Last,Thr=1.0,ELast=2.0)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    and command line additions:

    Code:
    --demuxer raw --input-depth 16 --input-res 640x480 --fps 23.976 --sar 1:1

    Thanks Dogway! . Would you favor one of the two DitherPost(Mode=-1) methods for the sharpening over the other, in the sense of quality-consistency? And I'm still debating 8-bit vs 10-bit. I understand your points (I think, ha ha), but for ~5% in encoding speed loss I see ~15% in video quality gain on a small screen and can't help but extrapolate to a (hopeful) future large screen.
    Last edited by LouieChuckyMerry; 25th Jun 2015 at 03:48. Reason: LinearResize Change From Mode=0 To Mode=6
    Quote Quote  
  17. 8-bit vs 10-bit IMO is not about speed vs quality, it's about future proof vs quality, anyway you already know my opinion.

    I certainly don't know what you are doing, but replacing RatioResize with LinearResize should yield the same results. For instance you shouldn't be setting MeGUI_darx or anything, that's borking your output. Also use mode -1 or 6 for LinearResize.
    Quote Quote  
  18. Originally Posted by Dogway View Post
    8-bit vs 10-bit IMO is not about speed vs quality, it's about future proof vs quality, anyway you already know my opinion.
    Do you think that software players will stop supporting 10-bit at some point?

    Originally Posted by Dogway View Post
    I certainly don't know what you are doing...
    That makes two of us .

    Originally Posted by Dogway View Post
    ...but replacing RatioResize with LinearResize should yield the same results.
    Honest, running the above script with 10-bit and the additions to the command line posted below the script outputs proper 640x480, 4:3 video; running the above script with "RatioResize(10/11.0,"PAR")" replacing "LinearResize(640,480,Kernel="Spline36",Mode=0 )" and the additions to the command line (either "--sar 1:1" or "--sar 10:11") outputs proper 640x480 video that has an aspect ratio of 0.684 (if "--sar 1:1") or 1.212 (if "--sar 10:11"). I thought you'd recommended LinearResize to fix this issue .

    Originally Posted by Dogway View Post
    For instance you shouldn't be setting MeGUI_darx or anything, that's borking your output.
    I've no idea what "setting MeGUI_darx" means. To view a proper preview in MeGUI the script's last line needs to be "DitherPost()", but to actually run the script and output proper video the script's last line needs to be "Dither_Out=True" and I need to add the command line extras.

    Originally Posted by Dogway View Post
    Also use mode -1 or 6 for LinearResize.
    Thanks, I've edited the above script to read "Mode=6". There's no docs, so when I opened the .avsi in Notepad++ I just copied and pasted the example...

    Edit: ahhh, OK, the darx. I'll run a test without and see what happens. Thanks!
    Last edited by LouieChuckyMerry; 25th Jun 2015 at 04:30.
    Quote Quote  
  19. Originally Posted by Dogway View Post
    For instance you shouldn't be setting MeGUI_darx or anything, that's borking your output
    Yep, it was the:

    Code:
    global MeGUI_darx = 6480
    global MeGUI_dary = 4739
    lines that was screwing up the aspect ratio; once I eliminated them the script with the RatioResize line and "--sar 1:1" in the command line output proper 640x480, 4:3 video. Thanks again, Dogway. Seriously, is there anything you don't know about encoding video ?
    Quote Quote  
  20. After lucking into a really effective deinterlacing-field matching-decimating-line doubled fields fixer script here (seriously, given the horrid quality of the source material I'm really happy with how well this works; thanks again Scythe42 ), I'm just about ready to restart encoding episodes:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
    DGSource("SourcePath")
    ### Deinterlace-Match Fields-Decimate-Fix Line Doubled Fields ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Stabilize ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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(DFTTest(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=2,ThSAD=400,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2,Chroma=False)
    ### Resize ###
    LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
    ### Darken-Thin Lines ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(Thr=0.55,SMode=2,Lsb=True,Lsb_In=True,StaticNoise=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    Before beginning, however, I was hoping to improve the line (edge?) quality, if possible. This S5.E21-TestClip is a fine example; everything looks good after running the above script, but the front edge of the dining room table and the birthday cake (among other things) suffer from what I think is called aliasing (shimmering?). The use of NNEDI3 for the line doubled fields has a major positive effect on the overall aliasing (and is why I lowered SMDegrain's ThSAD from 600 to 400), but I was hoping that there's an adjustment or an addition to the above script to make it look even better. Thanks .
    Last edited by LouieChuckyMerry; 10th Jul 2015 at 01:59. Reason: FixedTestClipLink; ScriptLineOrder
    Quote Quote  
  21. The link to the S5.E21 clip is wrong -- it points to the doom9 post.
    Quote Quote  
  22. Thanks, jagabo, I fixed the S5.E21-TestClip link above and added it here.
    Quote Quote  
  23. OK, I've tried adding QTGMC(InputType=1) and QTGMC(InputType=2) to the script, here:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
    DGSource("SourcePath")
    ### Deinterlace-Match Fields-Decimate-Fix Line Doubled Fields ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Reduce Shimmering ###
    QTGMC(InputType=1or2)
    ### Stabilize ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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(DFTTest(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=2,ThSAD=400,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2,Chroma=False)
    ### Resize ###
    LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
    ### Darken-Thin Lines ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(Thr=0.55,SMode=2,Lsb=True,Lsb_In=True,StaticNoise=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    and the results are quite nice. InputType=1 is slightly faster than InputType=2, and according to the docs is less detail unfriendly, but they both slow down the speed by ~25%. Does anybody know any other viable method(s) for reducing shimmering that are faster and-or better? Thanks.

    Edit: after testing various combinations, the NNEDI3-QTGMC combo is easily the best, much better than with either alone and waaay better than with neither. Also, the QTGMC default preset ("Slower") gives noticeably better results than "Medium" and "Fast", and the change in encoding speed is less than five percent. There's still a wee bit of shimmer, especially in line-busy frames, but the end result is excellent given the source. Thus, the final script is:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
    DGSource("SourcePath")
    ### Deinterlace-Match Fields-Decimate ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    ### Fix Line-Doubled Fields ###
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Reduce Shimmering ###
    QTGMC(InputType=1)
    ### Stabilize ###
    Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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(DFTTest(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=2,ThSAD=400,ContraSharp=True,RefineMotion=True,Plane=0,Lsb=True,Lsb_Out=True,PreFilter=2,Chroma=False)
    ### Resize ###
    LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
    ### Darken-Thin Lines ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(thR=0.55,SMode=2,Lsb_In=True,Lsb=True,StaticNoise=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    
    ### !!!Minus The Quotation Marks, "--demuxer raw --input-depth 16 --input-res 640x480 --fps 23.976 --sar 1:1" Must Be Added To The x264 Cmd Line For The Output Video To Be Correct!!! ###
    The addition of QTGMC means no AviSynth MT (someday I'll figure out how to multi-thread QTGMC...), which is OK because from what I've read and experienced MPEG2 in Mkv can be inconsistent.

    Running the above script on my dual-core (i5 3320M, 4GB RAM) laptop takes 7-12 hours per episode, and running two episodes simultaneously maxes out the CPU while doubling production (two episodes overnight). Finally, using 10-bit x264 at CRF 13.0 results in a video bit rate of ~1850 Kbps for Season 1. Starting with Season 2 the source quality improves enough that CRF 12.0 is required for an ~1850 Kbps video bit rate. I'm targeting ~1850 Kbps for the video bit rate so that the Bits/(Pixel*Frame) is ~0.250.

    A hearty thanks and Happy Friday! to everyone willing to give their precious time to help a relative noob: I really appreciate it .

    Edit: I've finally finished encoding Season 1 of The Simpsons with the CRF 13.0: with 320 Kbps combined main and commentary audios, the file sizes vary from 325-405 MB and the encoding times varied from 7-20 hours per episode . I'm not sure why some episodes took so much longer than others--the source? my laptop? the script? running 2 episode simultaneously? gremlins?--but the results are very nice indeed. I've started encoding Season 2 with CRF 12.0 and, with the same 320 Kbps audio combo, file sizes have varied from 301-451 MB and encoding times have varied from 7-10 hours after 17 episodes. Guess I'm trading wildly inconsistent encoding times for wildly inconsistent file sizes, ha ha. Anyway, I hope that as the sources improve (slightly, ha ha, very slightly) encoding time will become more consistent.
    Last edited by LouieChuckyMerry; 22nd Jul 2015 at 20:46. Reason: x264 Cmd Line; Information, Information
    Quote Quote  
  24. As I began reencoding Season 3 I learned of a way to improve the encoding quality while actually speeding things up, so I figured I'd post it here in the event anyone finds this thread useful someday.

    --The deinterlacing-field matching-decimating-line doubled fields fixer is still the same because it's about as good as an automated method could be for this low quality source.

    --After running more tests for comparison, I've eliminated the QTGMC line that reduced aliasing (not shimmering, as I'd wrongly thought before). Someone helpfully pointed out to me that QTGMC is NNEDI3-based and, with the necessary NNEDI3 line for the line-doubled fields already in the script, using QTGMC on top of this was really killing details (and quite possibly adding ghosting artifacts). Also, as soon as I move to viewing distance from my screen (as opposed to typing distance), the aliasing doesn't appear nearly as bothersome and the overall video looks crisper.

    --I also removed the Stab(Mirror=15) call. At the beginning of this project it happened that the very first test clip I uploaded while asking for help had a bit of shaking, but after paying closer attention and spot-checking episodes there's really not much shaking going on. Possibly I'll notice some (if I ever get a chance to watch any of the episodes, ha ha) in the future; if so, then I'll simply rereencode any offensive episodes.

    --Replacing the Gibbs noise block and the SMDegrain line with KNLMeansCL makes for much higher encoding speed but doesn't, to my eyes at least, look any different. Really, it's a toss-up so I went with the faster choice and, in conjunction with the removal of QTGMC, allows for a three (3) times improvement in fps.

    --Everything else is the same although, unlike SMDegrain, KNLMeansCL requires a call to convert the input video to 16-bit. For some "unknown exception" I can't use Dither_Crop16 and KNLMeansCL together, so a bit of script rearrangement was necessary, with the Crop line coming before the conversion to 16-bit.

    Finally, I'm still using CRF 13.0 for Season 1 and CRF 12.0 for Seasons 2-10. And don't forget the necessary x264 10-bit command line additions:

    Code:
    --demuxer raw --input-depth 16 --input-res 640x480 --fps 23.976 --sar 1:1
    Thus The Final Final (No Really) Script is:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
    DGSource("SourcePath")
    ### Deinterlace-Match Fields-Decimate ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    ### Fix Line-Doubled Fields ###
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Stabilize, If Necessary ###
    # Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### Convert Source To Stacked ###
    Dither_Convert_8_To_16()
    ### Overall Spatio-Temporal Denoise (Including Gibbs Noise) ###
    KNLMeansCL(D=1,A=1,h=5.0,Lsb_InOut=True,Device_Type="GPU")
    ### Resize ###
    LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
    ### Darken-Thin Lines ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(thR=0.55,SMode=2,Lsb_In=True,Lsb=True,StaticNoise=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()

    Again, a hearty thanks for all the help I've received .

    Edit: It seems I was wrong. After the initial excitement of Three Times Faster! encoding wore off I took a closer look. From viewing distance it's hard to see a difference, but from typing distance, and especially when comparing individual frames, the Gibbs noise block-SMDegrain method just looks better than the KNLMeansCL way. So, thinking about that hoped for future large screen TV, it's back to the original, minus QTGMC. Thus, The Final Final Oh So Final That It Hurts Script is:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
    DGSource("SourcePath")
    ### Deinterlace-Match Fields-Decimate ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    ### Fix Line-Doubled Fields ###
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Stabilize, If Necessary ###
    # Stab(Mirror=15)
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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(DFTTest(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=2,ThSAD=400,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,Lsb=True,Lsb_Out=True)
    ### Resize ###
    LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
    ### Darken-Thin Lines ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # Trim()
    # DitherPost()
    Dither_Out()
    This outputs video with about the same bit rate (+/- 5%) as with the old QTGMC line, but it's much more consistent when it comes to encoding time. I'm beginning Season 2 tonight and will update this post accordingly. Happy Saturday .

    Edit: with a 224 Kbps main audio and a 96 Kbps commentary track combination, running two episodes simultaneously overnight:

    Season 1: at CRF 13.0, episodes took from 7.5-10 hours to encode and averaged 380 MB in size, ranging from 332 MB to 424 MB.

    Season 2: at CRF 12.0, episodes took from 7-8.5 hours to encode and averaged 349 MB in size, ranging from 282 MB to 436 MB.

    Season 3: at CRF 12.0, episodes took from 6.5-7.5 hours to encode and averaged 330 MB in size, ranging from 246 MB to 346 MB.

    Since it seems that the source quality is leveling out, I'm lowering the CRF to 11.0 starting with Season 4 so as to return the video bit rate to ~1850 Kbps. Also, I'll probably redo the episodes from Season 2 and Season 3 that were less than 340 MB (~1735 Kbps), just so I never have to think about them again .

    FinalEdit: Happy Saturday! I've finally finished Season 10 and, given what I've learned, if I were starting from the beginning then I'd simply use The Final Final Oh So Final That It Hurts Script above with CRF 12.0 for Season 1 and CRF 10.0 for Seasons 2-10 and call it a day. This would make for a reasonably consistent average video bit rate of ~2100 Kbps per episode, perhaps a bit higher than I'd originally planned but I reckon better a bit too much bit rate than a bit too little. Also, given the fluctuation in file size this would make the episodes with the lowest video bit rate closer to my original goal of ~1850 Kbps (some of the Season 2-10 episodes were resulting in video bit rates ~1500 Kbps at CRF 13.0).

    NeverSayFinalEdit: As I'm attacking my Futurama NTSF DVD's I've learned (thanks to all who've helped ) new tricks that are also applicable to encoding The Simpsons NTSF DVD's. So I thought I'd--again--edit The Final Final Oh So Final That It Hurts Script above to reflect this in the event that someone finds it useful.

    The changes--in blue below--are the addition of SmoothTweak (for a very slight color enhancement that looks good to me, at least) and tweaks to the Gibbs Noise Block (replacing DFTTest with Minblur for faster, cleaner results), the resizing line (utilizing Didée's Bicubic Resize Trick), and the Darken-Thin Lines line (upping the Strength from 20 to 24). Since I've not (yet, ha ha) redone The Simpsons I'm not sure how the new script will affect the output video bit rate; however, a half dozen SelectRangeEvery(66,1000) comparisons would be a relatively quick and simple way to check this. Anyway, The Finalª (ª=4, But Subject To Change) Script is now:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
    DGSource("SourcePath")
    ### Deinterlace-Match Fields-Decimate ###
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    ### Fix Line-Doubled Fields ###
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Stabilize, If Necessary ###
    # Stab(Mirror=15)
    ### Adjust Color ###
    SmoothTweak(Saturation=1.03)
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=2,ThSAD=400,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,Lsb=True,Lsb_Out=True)
    ### Resize ###
    LinearResize(640,480,Kernel="Bicubic",A1=-0.5,A2=0.25,Lsb_In=True,Lsb_Out=True)
    ### Darken-Thin Lines ###
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=24,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # Trim()
    # DitherPost()
    Dither_Out()
    YetAgainAnotherEdit: Having--finally--had an opportunity to view the results of the above script on a large screen HDTV, I'd highly recommend lowering the Saturation in the SmoothTweak line, or even eliminating it altogether. Using Saturation=1.03 proved to be entirely too much, well, color (at least to my eyes). Certainly this is personal preference; check different Saturation settings and encode to taste .

    LiveAndLetEdit: Having recently seen some upscaled Futurama episodes on Hula TV, I decided to upscale my NTSC Futurama DVD's, which led to upscaling my PAL Futurama DVD's, which means I now have to upscale my NTSC Simpsons DVD's . In case someone finds this useful I'll post the script below. There are a few changes-improvements from the The Finalª (ª=4, But Subject To Change) Script above:

    1) A move from SEt's AviSynth MT to pinterf's AviSynth+.

    2) The addition of a Color Conversion line.

    3) An improvement to the Adjust Color line.

    4) An improvement to the Gibbs Noise Block.

    5) An increase in strength to the Overall Temporal Denoise line.

    6) A revamped Resize line with The jagabo Upscaling Method© (jUM©).

    7) An improvement to the Darken-Thin Lines Block

    If you're not interested in upscaling but still want the improvements, then simply use the above Resize section to replace the below Resize section. Thus, the upscaling script:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    Function FieldMatch(Clip C) {
      Global PP = C.DuplicateFrame(0)
      Global CC = C
      Global NN = C.DeleteFrame(0)
      P2 = PP.SeparateFields()
      C2 = CC.SeparateFields()
      N2 = NN.SeparateFields()
      Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
      Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
      Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
      Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
      Global Deint = QTGMC(CC).SelectEven()
      Return ScriptClip(CC, \
        "!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
        "!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
        "!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
        "!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
        "!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
        "!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
        "!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    ### Fix Line-Doubled Fields ###
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Color Conversion ###
    ColorMatrix(Mode="Rec.601->Rec.709")
    ### Adjust Color ###
    MergeChroma(aWarpSharp2(Depth=16))
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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").Blur(1.0)
    MT_Merge(Minblur(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=3,ThSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,Lsb=True,Lsb_Out=False)
    ### Resize ###
    NNEDI3_RPow2(4,CShift="Spline64Resize",FWidth=960,FHeight=720)
    aWarpSharp2(Depth=5)
    Sharpen(0.2)
    ### Darken-Thin Lines ###
    Dither_Convert_8_To_16()
    F=DitherPost(Mode=-1)
    S=F.FastLineDarkenMod(Strength=24,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=9,Chroma=2)
    D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
    Dither_Add16(Last,D,Dif=True,U=2,V=2)
    ### Deband ###
    GradFun3(Radius=16,ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ## Trim()
    SelectRangeEvery(1000,66)
    DitherPost()
    and the new x264 custom command line:

    Code:
    --demuxer raw --input-depth 16 --sar 1:1 --colorprim bt709 --transfer bt709 --colormatrix bt709
    Last edited by LouieChuckyMerry; 3rd May 2019 at 07:38. Reason: Upscaling!; Improvements
    Quote Quote  
  25. I'm really really sorry to dig this thread up, but I've been encoding my Simpsons NTSC dvds myself and this script is by far the closest I've got to making them look good.

    I'm a total noob at this but I have taught myself enough of AviSynth to bodge my way through (had to remove the LSB comment from SMDegrain for example). I've used this most recent script and the output I get is actually really quite nice. However I want to use the non upscaled point so when I comment this in:

    Code:
    ### Resize ###
    LinearResize(640,480,Kernel="Bicubic",A1=-0.5,A2=0.25,Lsb_In=True,Lsb_Out=True)
    I get this:

    Image
    [Attachment 74946 - Click to enlarge]


    As you can see, not ideal.

    If I leave it upscaled I do get the correct output, I think, but I'll be honest, I have no idea when it comes to using CRF or the command lines mentioned.

    Sorry for the necro again, just looking for some help.
    Quote Quote  
  26. Hi drojman, thanks for the painful memories, ha ha. I, as you, was learning on the fly with MUCH help from the geniuses here (and elsewhere) and, after all these years, I've forgotten quite a bit being a mere hobbyist (I still encode Blu-ray sources regularly but haven't dealt with DVDs & interlacing in ages). I used MeGUI as a front end for AviSynth (that's where I made the CRF and command line changes); what are you using? Also, why are you unwilling to upscale your sources? I'd happily upload my stand alone version of MeGUI with all my presets and plugins if you think it would help you, and I'll try to wrap my head around your issue.

    Edit: Maybe try:

    Code:
    ### Resize ###
    LinearResize(640,480,Kernel="Bicubic",A1=-0.5,A2=0.25)
    without the "LSB" bits or, if not wanting to upscale, just delete the resize line.

    EditEdit: This is my current NTSC Simpsons script after making changes to various versions of various things:

    Code:
    <input>
    ### Deinterlace-Match Fields-Decimate ###
    Function FieldMatch(Clip C) {
        PP = C.DuplicateFrame(0)
        CC = C
        NN = C.DeleteFrame(0)
        P2 = PP.SeparateFields
        C2 = CC.SeparateFields
        N2 = NN.SeparateFields
        PC = Interleave(P2.SelectEven,C2.SelectOdd).Weave
        CP = Interleave(C2.SelectEven,P2.SelectOdd).Weave
        CN = Interleave(C2.SelectEven,N2.SelectOdd).Weave
        NC = Interleave(N2.SelectEven,C2.SelectOdd).Weave
        Deint = CC.QTGMC.SelectEven
        SSS="""
            \   !CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC
            \ : !NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN
            \ : !CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN
            \ : !NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC
            \ : !PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP
            \ : !CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP
            \ : !PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC
            \ : Deint
        """
        Args="CC,NN,CN,NC,PP,CP,PC,Deint"
        Return CC.GScriptClip(SSS,Args=Args,Local=True)
    }
    TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,UBSCO=False,CThresh=12,Chroma=True)
    TDecimate(Mode=1)
    ### Fix Line-Doubled Fields ###
    NNEDI3(Field=-2)
    Merge(SelectEven(),SelectOdd())
    ### Color Conversion ###
    ColorMatrix(Mode="Rec.601->Rec.709")
    ### Adjust Color ###
    MergeChroma(aWarpSharp2(Depth=16))
    ### Crop ###
    Crop(8,0,-8,0)
    ### 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").Blur(1.0)
    MT_Merge(Minblur(),Mask,Luma=True)
    ### Overall Temporal Denoise ###
    SMDegrain(TR=3,ThSAD=600,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,n16=True,n16_Out=True)
    ### Resize ###
    Spline64ResizeMT(960,720)
    aWarpSharp4xx(Depth=5)
    ### Darken-Thin Lines ###
    FastLineDarkenMod4(Strength=24,Prot=6)
    aWarpSharp4xx(Blur=4,Type=1,Depth=8,Chroma=2)
    ### Deband ###
    F3KDB(Y=100,Cb=100,Cr=100,GrainY=0,GrainC=0)
    ## Trim()
    # SelectRangeEvery(1000,66)
    I'll check it out...

    EditEditEdit: Well, it seems I've made so many changes with plugins, etc. that my latest above script causes MeGUI to crash. More testing...
    Last edited by LouieChuckyMerry; 18th Nov 2023 at 18:57. Reason: Information, Information
    Quote Quote  
  27. I think I am now you from the past! I'm very happy you still post here

    Part of the problem I think is I was using standalone AviSynth + and MeGUI, even the script with upscaling that was working for me would just crash or not open in MeGUI, so I would be absolutely thrilled if you could share your setup, that (hopefully) would save me a huge headache.

    As for why I like to keep the non upscaled version...I'm not honestly sure I can give you a good reason, it's just something I've been trying to do for so long that now I feel like I just need to get my head around it. I realise that's ridiculous, and I fully intend on also having upscaled versions for Plex - the Disney plus versions for me go too far in the filtering and look very off. The script that I was able to run earlier looked great to me, if only I could get it working properly!

    Thank you.
    Quote Quote  
  28. Give me some time; I need to finish a couple things this afternoon but will attack this evening .
    Quote Quote  
  29. I appreciate you even taking a look
    Quote Quote  
  30. The perfect cure for a MASSIVE self-inflicted hangover . Anyway, it turns out that the crash isn't caused by my script, it's a couple additions made by DGIndex (I used the .m2v video as my source at first and MeGUI defaults to DGIndex for that file type). DGIndex adds two lines, one to load the DGDecoder.dll and one to load the ColorMatrix.dll, despite the fact that they auto load. Neither FFMS nor L-SMASH adds those line so they work fine. Keeping the source in an .mkv container makes L-SMASH the default indexer and all is well (Just don't inform jagabo that I did that, ha ha). So the last script I posted works well...oops, not so fast. As I was typing I was running four tests with the same thousand frame section of the source: the .m2v indexed with DGIndex (with the problematic lines corrected), the .m2v indexed with FFMS, the .m2v indexed with L-SMASH, and the .mkv indexed with L-SMASH. And now I remember why jagabo had me strip my sources to .m2v files and use DGIndex: the L-SMASH and FFMS .m2v indexes and the L-SMASH .mkv index all cause problems that lead to audio sync issues. Arggg! Anyway, I'll head to the MeGUI "General Questions And Troubleshooting" thread at doom9.org and ask if it's possible to have DGIndex stop adding those lines. In the meantime, a (somewhat inelegant) workaround would be to index all your sources as .m2v with DGIndex then use a combination of a search program like Everything and source editor like Notepad++ to batch correct the offensive lines (you'd use Everything to search your main source folder and subfolders, then specify ".avs", then open all of those with Notepad++, then use "Find-Replace" to fix all the lines at once). Yea haw! Ahhh, I'll upload my stand alone MeGUI with presets and my AviSynth plugins folder and PM you a link. As for the bad lines, I'll edit my above script so that the bits that need to be deleted are in red.

    Edit: Er, I forgot that the above script doesn't include those lines, just a moment...
    Last edited by LouieChuckyMerry; 18th Nov 2023 at 20:04. Reason: General Idiocy
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!