VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. Hello, thanks in advance for any help, and Happy Friday! . Some years ago, kind folks here helped me transform my rather lacking NTSC DVD's of The Simpsons and Futurama into fine viewing on a 1080p TV. Thanks again . Recently I viewed a couple episodes of Futurama on Hula TV. In some ways they looked better than my encodes, in others they looked worse; the colors were sharp, but all the edges were blurry. Given my limited knowledge, it appeared Hula's upscaling was pretty good except for a poor job with the Gibbs noise (and at least they weren't cropped, as the early seasons of The Simpsons on HDTV were).

    Anyway, now that I know it's possible to improve my encodes by upscaling I've no choice but to do so .

    After searching this forum I've decided on a three-step process:

    1) Take the DVD sources and deinterlace-match fields-decimate, crop, Gibbs noise, denoise, and resize to a lossless format.

    2) Upscale these results, using an NNEDI3-aWarpSharp-Sharpen combo--aka, The jagabo Upscaling Method© (jUM©)
    --to a lossless format.

    3) Encode this result for a final file size.

    I'm planning to use VirtualDub with Ut Video for the two lossless steps and MeGUI with x264 for the final encode. After a couple tests the results are very encouraging, but I wanted to make sure I didn't miss anything. Also, perhaps those who know more than I would have suggestions to improve the encode, such as settings tweaks or a different ordering of filters.

    Here's my original MeGUI script for Futurama, from the thread linked above:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    AssumeTFF()
    TFM(Chroma=False,PP=0) 
    AssumeBFF()
    Interleave(TFM(Mode=1,PP=0,Field=1),TFM(Mode=1,PP=0,Field=0))
    TFM(Field=0,Clip2=Yadif())
    vInverse()
    SRestore(23.976)
    ### Adjust Color ###
    SmoothTweak(Saturation=1.01)
    ### 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=1,ThSAD=200,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=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=2,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)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    and here's the x264 command line for this script:

    Code:
    program --output-depth 10 --preset veryslow --tune animation --deblock 2:1 --ref 12 --qpmax 69 --rc-lookahead 120 --merange 32 --no-fast-pskip --stitchable --demuxer raw --input-depth 16 --input-res 640x480 --fps 23.976 --sar 1:1 --output "output" "input"
    For the upscaling I broke this down into three separate scripts. Step 1:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    AssumeTFF()
    TFM(Chroma=False,PP=0) 
    AssumeBFF()
    Interleave(TFM(Mode=1,PP=0,Field=1),TFM(Mode=1,PP=0,Field=0))
    TFM(Field=0,Clip2=Yadif())
    vInverse()
    SRestore(23.976)
    ### Adjust Color ###
    SmoothTweak(Saturation=1.01)
    ### 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=1,ThSAD=200,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=False)
    Step 2:

    Code:
    SOURCE INFORMATION HERE
    NNEDI3_RPow2(4,CShift="Spline64Resize",FWidth=960,FHeight=720)
    aWarpSharp2(Depth=5)
    Sharpen(0.2)
    and Step 3:

    Code:
    SOURCE INFORMATION HERE
    ### 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=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(Radius=16,ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    Step 3 has the same x264 command line as the original script above. I'm especially curious if anyone has suggestions for tweaking the FastLineDarkenMod-aWarpSharp2 or GradFun3 settings in Step 3, since those were originally recommended for 480p video and I'm not at all well versed in their intricacies. Thanks again for any help, I appreciate it.
    Last edited by LouieChuckyMerry; 15th Mar 2019 at 15:21. Reason: Clarity
    Quote Quote  
  2. You can sharpen the colors in the first step with something like MergeChroma(aWarpSharp2(depth=10 to 20)).

    Why are you downscaling the source to 640x480 before upscaling?

    Why use a lossy encoding between steps? Use a lossless codec.

    Why separate steps 1 and 2? Do them both in one script. Actually, I think you should be able to all three steps in one script.

    You should supply samples if you want more specific help.
    Quote Quote  
  3. jagabo: Thanks for your reply.


    Originally Posted by jagabo View Post
    You can sharpen the colors in the first step with something like MergeChroma(aWarpSharp2(depth=10 to 20)).
    Where would you suggest placing this in the script?


    Originally Posted by jagabo View Post
    Why are you downscaling the source to 640x480 before upscaling?
    This was from the original 480p encoding script; I'll remove it from the upscaling script.


    Originally Posted by jagabo View Post
    Why use a lossy encoding between steps? Use a lossless codec.
    I think you misread my original post; the steps go Ut Video, Ut Video, 10 bit x264.


    Originally Posted by jagabo View Post
    Why separate steps 1 and 2? Do them both in one script. Actually, I think you should be able to all three steps in one script.
    I separated steps 1 and 2 because I thought I read somewhere that NNEDI3 can only work with 8 bit input. Where would the upscaling step be placed, where the resizing is (was)? Or at the end? Or...?


    Originally Posted by jagabo View Post
    You should supply samples if you want more specific help.
    D'oh!:

    S1.E1-FuturamaSample[NSTC]

    and

    S2.E6-SimpsonsSample[NTSC]

    EDIT: Inspired by your suggestion, I came up with this script that outputs pretty good looking video:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    AssumeTFF()
    TFM(Chroma=False,PP=0) 
    AssumeBFF()
    Interleave(TFM(Mode=1,PP=0,Field=1),TFM(Mode=1,PP=0,Field=0))
    TFM(Field=0,Clip2=Yadif())
    vInverse()
    SRestore(23.976)
    ### Adjust Color ###
    MergeChroma(aWarpSharp2(Depth=15))
    SmoothTweak(Saturation=1.01)
    ### 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=1,ThSAD=200,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=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(Radius=16,ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###)
    # DitherPost()
    Dither_Out()
    Of course, I'm always looking for improvement so I'll run some tests with different MergeChroma settings; did I add it to the script in a good place? Any other tweaks are very welcome. Also, did I do the 16 bit to 8 bit back to 16 bit section correctly? Thanks.
    Last edited by LouieChuckyMerry; 16th Mar 2019 at 15:32. Reason: Information, Information.
    Quote Quote  
  4. Member
    Join Date
    Mar 2019
    Location
    Seattle
    Search Comp PM
    Originally Posted by LouieChuckyMerry View Post
    jagabo: Thanks for your reply.


    Originally Posted by jagabo View Post
    You can sharpen the colors in the first step with something like MergeChroma(aWarpSharp2(depth=10 to 20)).
    Where would you suggest placing this in the script?


    Originally Posted by jagabo View Post
    Why are you downscaling the source to 640x480 before upscaling?
    This was from the original 480p encoding script; I'll remove it from the upscaling script.


    Originally Posted by jagabo View Post
    Why use a lossy encoding between steps? Use a lossless codec.
    I think you misread my original post; the steps go Ut Video, Ut Video, 10 bit x264.


    Originally Posted by jagabo View Post
    Why separate steps 1 and 2? Do them both in one script. Actually, I think you should be able to all three steps in one script.
    I separated steps 1 and 2 because I thought I read somewhere that NNEDI3 can only work with 8 bit input. Where would the upscaling step be placed, where the resizing is (was)? Or at the end? Or...?


    Originally Posted by jagabo View Post
    You should supply samples if you want more specific help.
    D'oh!:

    S1.E1-FuturamaSample[NSTC]

    and

    S2.E6-SimpsonsSample[NTSC]

    EDIT: Inspired by your suggestion, I came up with this script that outputs pretty good looking video:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    AssumeTFF()
    TFM(Chroma=False,PP=0) 
    AssumeBFF()
    Interleave(TFM(Mode=1,PP=0,Field=1),TFM(Mode=1,PP=0,Field=0))
    TFM(Field=0,Clip2=Yadif())
    vInverse()
    SRestore(23.976)
    ### Adjust Color ###
    MergeChroma(aWarpSharp2(Depth=15))
    SmoothTweak(Saturation=1.01)
    ### 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=1,ThSAD=200,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=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(Radius=16,ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###)
    # DitherPost()
    Dither_Out()
    Of course, I'm always looking for improvement so I'll run some tests with different MergeChroma settings; did I add it to the script in a good place? Any other tweaks are very welcome. Also, did I do the 16 bit to 8 bit back to 16 bit section correctly? Thanks.
    How about something along the lines of:
    Code:
    mpeg2source(d2v="S2.E6-SimpsonsSample[NTSC].d2v")
    animeivtc(mode=1, ediandnn=3, killcomb=2, stabilize=true, aapel=4, thin=10).mcdaa3()
    smdegrain(tr=4,contrasharp=false,refinemotion=true,lsb=true,mode=6,pel=4,subpixel=3,prefilter=3,blksize=8,chroma=true,search=3,truemotion=true)
    eedi3_resize16(target_width=960, target_height=720, src_left=8, src_width=704, noring=true, kernel_u="spline64", kernel_d="spline64", tv_range=true)
    awarpsharp2(blur=4)
    levels(16,1,235,16,235,coring=false)
    Quote Quote  
  5. Yes, I got the scripts mixed up. And I didn't realize SMDegrain() was converting to 16 bits. It looks like you've got everything under control. How does it compare to the Hula (Hulu?) versions now? You might want to blur the Gibbs noise Mask. I usually try to smooth mask edges a to prevent obvious demarcations.
    Quote Quote  
  6. Am I a bit blind or is there no rec.601 to rec.709 colour conversion in the script?
    Quote Quote  
  7. Yes, generally you want to convert rec.601 to rec.709 and flag rec.709 when upscaling. Or you can flag rec.601 when you encode, but this is less reliable (players may or may not respond to the rec.601 flag).
    Quote Quote  
  8. Originally Posted by jagabo View Post
    Yes, I got the scripts mixed up. And I didn't realize SMDegrain() was converting to 16 bits. It looks like you've got everything under control. How does it compare to the Hula (Hulu?) versions now? You might want to blur the Gibbs noise Mask. I usually try to smooth mask edges a to prevent obvious demarcations.
    It looks waaay better than the Hula TV versions; the edges are much much clearer but they're still noticeably "demarcated", as if the outer edges were made of bits of graphite surrounding a magnet. Furry is a good adjective. How would you suggest I smooth mask edges within the all-in-one script?


    Originally Posted by hello_hello View Post
    Am I a bit blind or is there no rec.601 to rec.709 colour conversion in the script?
    When I was testing the original three-step solution--Ut Video to Ut Video to 10 bit x264--I noticed the Ut Video outputs' colors seemed "cooler", for lack of a better term. Could this be due to colorspace conversion reasons?


    Originally Posted by mawazi View Post
    How about something along the lines of:
    Code:
    mpeg2source(d2v="S2.E6-SimpsonsSample[NTSC].d2v")
    animeivtc(mode=1, ediandnn=3, killcomb=2, stabilize=true, aapel=4, thin=10).mcdaa3()
    smdegrain(tr=4,contrasharp=false,refinemotion=true,lsb=true,mode=6,pel=4,subpixel=3,prefilter=3,blksize=8,chroma=true,search=3,truemotion=true)
    eedi3_resize16(target_width=960, target_height=720, src_left=8, src_width=704, noring=true, kernel_u="spline64", kernel_d="spline64", tv_range=true)
    awarpsharp2(blur=4)
    levels(16,1,235,16,235,coring=false)
    With my latest one-step script Futurama tests appear much nicer than Simpsons tests, I'd think due to the respective sources' ages. I tried to use your above script, but received error messages accordingly (with the most recent version of all the requirements for AnimeIVTC listed here; however, the link to AvsRecursion no longer exists and I couldn't find it via searching):

    1) "Script error: animeivtc does not have a named argument 'ediandnn'."

    2) Removing "ediandnn=3" from the script, the error then becomes "Script error: there is no function named 'mcdaa3'."

    3) Changing "mcdaa3" to simply "daa3", the error then becomes "Script error: there is no function named 'eedi3_resize16'."

    4) Eliminating "eedi3_resize16(target_width=960, target_height=720, src_left=8, src_width=704, noring=true, kernel_u="spline64", kernel_d="spline64", tv_range=true)" from the script makes it viable.

    Any ideas? I'd be very curious to make this work so I can compare it to my current working script. Thanks.
    Quote Quote  
  9. Originally Posted by LouieChuckyMerry View Post
    How would you suggest I smooth mask edges within the all-in-one script?
    Just blur it a bit. Blur(1.0), BinomialBlur(1.5), something like that.

    Originally Posted by LouieChuckyMerry View Post
    When I was testing the original three-step solution--Ut Video to Ut Video to 10 bit x264--I noticed the Ut Video outputs' colors seemed "cooler", for lack of a better term. Could this be due to colorspace conversion reasons?
    The interpretation of color varies depending on the software and hardware. Some players always assume rec.601. Some always assume rec.709. In the absence of a matrix flag some will assume rec.601 for standard definition, rec.709 for high definition. When the matrix is flagged some player will follow the flag. The best practice is to use rec.601 for SD, rec.709 for HD and flag the matrix. Since you're upscaling rec.601 SD you should convert to rec.709 and flag it as such.

    In this post I showed what happens when the colors are interpreted incorrectly:
    https://forum.videohelp.com/threads/329866-incorrect-collor-display-in-video-playback#post2045830
    Quote Quote  
  10. Originally Posted by jagabo View Post
    Originally Posted by LouieChuckyMerry View Post
    How would you suggest I smooth mask edges within the all-in-one script?
    Just blur it a bit. Blur(1.0), BinomialBlur(1.5), something like that.
    I should've been more specific, being the AviSynth ignoramus that I am. Where, exactly, would I add the blurring in the all-in-one script?


    Originally Posted by LouieChuckyMerry View Post
    When I was testing the original three-step solution--Ut Video to Ut Video to 10 bit x264--I noticed the Ut Video outputs' colors seemed "cooler", for lack of a better term. Could this be due to colorspace conversion reasons?
    The interpretation of color varies depending on the software and hardware. Some players always assume rec.601. Some always assume rec.709. In the absence of a matrix flag some will assume rec.601 for standard definition, rec.709 for high definition. When the matrix is flagged some player will follow the flag. The best practice is to use rec.601 for SD, rec.709 for HD and flag the matrix. Since you're upscaling rec.601 SD you should convert to rec.709 and flag it as such.

    Originally Posted by jagabo View Post
    n this post I showed what happens when the colors are interpreted incorrectly:
    https://forum.videohelp.com/threads/329866-incorrect-collor-display-in-video-playback#post2045830
    Thanks for the explanation; I'll check out the post ASAP.
    Quote Quote  
  11. Originally Posted by LouieChuckyMerry View Post
    Where, exactly, would I add the blurring in the all-in-one script?
    To blur the mask:
    Code:
    Mask=MT_Logic(Edge.MT_Expand().MT_Expand().MT_Expand().MT_Expand(),Edge.MT_Inflate().MT_Inpand(),"xor").Blur(1.0)
    Scroll to the end of the line to see the change.
    Quote Quote  
  12. Originally Posted by jagabo View Post
    Originally Posted by LouieChuckyMerry View Post
    Where, exactly, would I add the blurring in the all-in-one script?
    To blur the mask:
    Code:
    Mask=MT_Logic(Edge.MT_Expand().MT_Expand().MT_Expand().MT_Expand(),Edge.MT_Inflate().MT_Inpand(),"xor").Blur(1.0)
    Scroll to the end of the line to see the change.
    Thank you, I can actually see the difference on my so-so 14" 1600 x 900 laptop screen (I'll get that HDTV someday...). I read your link on color correction and did some research. Did I place the Convert line in the correct place:

    Code:
    SOURCE INFORMATION HERE
    LoadPlugin("F:\InstalledPrograms\AviSynth 2.5\Plugins\TIVTC1_0_8_0.dll")
    ### Color Conversion ###
    ConvertToYV12(Interlaced=True)
    ### Deinterlace-Match Fields-Decimate ###
    AssumeTFF()
    TFM(Chroma=False,PP=0) 
    AssumeBFF()
    Interleave(TFM(Mode=1,PP=0,Field=1),TFM(Mode=1,PP=0,Field=0))
    TFM(Field=0,Clip2=Yadif())
    vInverse()
    SRestore(23.976)
    ### Adjust Color ###
    MergeChroma(aWarpSharp2(Depth=19))
    SmoothTweak(Saturation=1.01)
    ### 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=1,ThSAD=200,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=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(Radius=16,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()
    Also, how would one go about "flagging" this?
    Quote Quote  
  13. Your source is probably already YV12 so ConvertToYV12 won't do anything. If the source was RGB it would be converted to YV12 with a rec.601 matrix by default. To get rec.709 from RGB you would use ConvertToYV12(interlaced=true, matrix="rec709"). To go directly from rec.601 YV12 to rec.709 YV12 you would use ColorMatrix(mode="rec.601->rec.709") where you currently have ConvertToYV12(interlaced=true).

    You flag the color matrix in the encoder. For example, with x264 CLI you would add "--colorprim bt709 --transfer bt709 --colormatrix bt709" on the command line. If you're encoding rec.601 use "--colorprim smpte170m --transfer smpte170m --colormatrix smpte170m".
    Quote Quote  
  14. Originally Posted by jagabo View Post
    Your source is probably already YV12 so ConvertToYV12 won't do anything.
    That explains why I couldn't see any difference .


    Originally Posted by jagabo View Post
    If the source was RGB it would be converted to YV12 with a rec.601 matrix by default. To get rec.709 from RGB you would use ConvertToYV12(interlaced=true, matrix="rec709"). To go directly from rec.601 YV12 to rec.709 YV12 you would use ColorMatrix(mode="rec.601->rec.709") where you currently have ConvertToYV12(interlaced=true).
    Thank you. Now there is a quite noticeable difference:

    FuturamaScreenshots[ColorConversionVsNoColorConversion]

    and

    SimpsonsScreenshots[ColorConversionVsNoColorConversion]




    Originally Posted by jagabo View Post
    You flag the color matrix in the encoder. For example, with x264 CLI you would add "--colorprim bt709 --transfer bt709 --colormatrix bt709" on the command line. If you're encoding rec.601 use "--colorprim smpte170m --transfer smpte170m --colormatrix smpte170m".
    Thank you again. With or without the flag my usual player (MPC-BE) does right, but I reckon it should still be flagged.


    While running tests I eventually realized that I was using the original Futurama script for The Simpsons instead of the original Simpsons script (which looks much much nicer). So, in case someone finds this useful, The Final Futurama Upscaling Script is:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    AssumeTFF()
    TFM(Chroma=False,PP=0) 
    AssumeBFF()
    Interleave(TFM(Mode=1,PP=0,Field=1),TFM(Mode=1,PP=0,Field=0))
    TFM(Field=0,Clip2=Yadif())
    vInverse()
    SRestore(23.976)
    ### Color Conversion ###
    ColorMatrix(Mode="Rec.601->Rec.709")
    ### Adjust Color ###
    MergeChroma(aWarpSharp2(Depth=5),aWarpSharp2(Depth=19))
    SmoothTweak(Saturation=1.01)
    ### 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=2,ThSAD=400,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=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(Radius=16,ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ### Preview Source OR Send 16-bit Output To x264 10-bit ###
    # DitherPost()
    Dither_Out()
    and The Final Simpsons Upscaling Script is:

    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=5),aWarpSharp2(Depth=19))
    # SmoothTweak()
    ### 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=700,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=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(Radius=16,ThR=0.55,SMode=2,StaticNoise=True,Lsb_In=True,Lsb=True)
    ## Trim()
    SelectRangeEvery(1000,66)
    DitherPost()
    with the x264 custom command line:

    Code:
    --demuxer raw --input-depth 16 --sar 1:1 --colorprim bt709 --transfer bt709 --colormatrix bt709

    And, most importantly:

    Thanks jagabo . You never fail to help and you always teach me something(s) .

    EDIT: I've learned that the Color Conversion line should come after the Deinterlace-Match Fields-Decimate block. Also, I found a slight improvement to the "MergeChroma" call in the Adjust Color section and I've increased the strength of SMDegrain in both scripts.
    Last edited by LouieChuckyMerry; 2nd May 2019 at 20:18. Reason: Color Conversion Line Placement; Adjust Color Improvement; SMDegrain Strength
    Quote Quote  
  15. Happy Friday . Having recently utilized an HDTV, I learned that the above script could be improved:

    1) The Adjust Color block had a couple problems. It turns out the original MergeChroma line looks nicer--less blurry; more detailed--and the SmoothTweak line was overkill, I think because of the addition of the Color Conversion line.

    2) I lowered the strength of SMDegrain to "TR=2,ThSAD=200" (but raised it for The Simpsons to "TR=3,ThSAD=600").

    3) After quite a bit of testing, I learned that, in conjunction with the change in the MergeChroma line, the Darken-Thin Lines block looked noticeably better with "Depth=9". Everything--background and foreground--seemed clearer, and the edges are very much cleaner.

    There's always room for improvement, but the following looks pretty good to me and, as of now , is The Final Futurama Upscaling Script:

    Code:
    SOURCE INFORMATION HERE
    ### Deinterlace-Match Fields-Decimate ###
    TFM(Mode=7,UBSCO=False)
    ### 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=2,ThSAD=200,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 Final Simpsons Upscaling Script is:

    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()
    with the command line:

    Code:
    --demuxer raw --input-depth 16 --sar 1:1 --colorprim bt709 --transfer bt709 --colormatrix bt709
    Thanks again to all who helped .
    Last edited by LouieChuckyMerry; 3rd May 2019 at 08:23. Reason: Clarity
    Quote Quote  
  16. Will this script work for live action DVD to 4K resolution? I'm looking for a tutorial for upscaling live-action DVD to 4K resolution so that I use it for 4K video editing.

    edit: interesting links.
    http://hbbthinktank.blogspot.com/2011/11/upscaling-video.html
    http://www.infognition.com/articles/video_resize_shootout.html
    Last edited by digicube; 27th Feb 2020 at 14:10.
    Quote Quote  
  17. Is there a reason the The Final Simpsons Upscaling Script does not work with x265?
    This is the error I keep getting. x265 [error]: yuv: width, height, and FPS must be specified
    Some settings
    --pass 1 --bitrate 1500 --tune animation --output-depth 10 --sar 40:33 --videoformat ntsc --fps 24000/1001 --deblock 1:1
    Last edited by SD70ACEJM; 7th Mar 2020 at 15:13.
    Quote Quote  



Similar Threads

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