VideoHelp Forum
+ Reply to Thread
Page 4 of 4
FirstFirst ... 2 3 4
Results 91 to 111 of 111
Thread
  1. For noise reduction I most often use TemporalDegrain(), hardly ever with settings above SAD1=200, SAD2=150, sigma=8, usually half of that. For sharpening I use aWarpSharp() with depth around 5 for SD, 10 for HD, and Sharpen(0.3) or so. I almost never use line darkeners or edge enhancers for anything other than cartoons. I usually don't bother upscaling DVD sources, but when I do I use nnedi3_rpow2(), often in two steps. Try something like this with the DVD sample you posted earlier:

    Code:
    Mpeg2Source("Will & Grace S1 D1 Ep2 - A New Lease on Life vob untouched.d2v", CPU2="ooooxx", Info=3) 
    
    TFM(d2v="Will & Grace S1 D1 Ep2 - A New Lease on Life vob untouched.d2v") 
    TDecimate() 
    
    ColorMatrix(mode="rec.601->rec.709") # HD colors for upscaled video
    deblock_qed(quant1=28, quant2=28) # reduce DCT blocking
    vInverse() # blur away mild residual comb-like artifacts from interlaced MPEG encoding
    TemporalDegrain(SAD1=100, SAD2=75, sigma=4)
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=960, fheight=720)
    aWarpSharp(depth=3)
    Sharpen(0.2)
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    aWarpSharp(depth=5)
    Sharpen(0.3)
    
    AddGrainC(0.5, 0.5)
    the CPU2="ooooxx" in Mpeg2Source() applies a DCT ringing filter. It can also apply deblocking filters but I find those are too strong -- it removes too much detail. deblock_qed() is better.
    Quote Quote  
  2. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    For noise reduction I most often use TemporalDegrain(), hardly ever with settings above SAD1=200, SAD2=150, sigma=8, usually half of that. For sharpening I use aWarpSharp() with depth around 5 for SD, 10 for HD, and Sharpen(0.3) or so. I almost never use line darkeners or edge enhancers for anything other than cartoons. I usually don't bother upscaling DVD sources, but when I do I use nnedi3_rpow2(), often in two steps. Try something like this with the DVD sample you posted earlier:

    Code:
    Mpeg2Source("Will & Grace S1 D1 Ep2 - A New Lease on Life vob untouched.d2v", CPU2="ooooxx", Info=3) 
    
    TFM(d2v="Will & Grace S1 D1 Ep2 - A New Lease on Life vob untouched.d2v") 
    TDecimate() 
    
    ColorMatrix(mode="rec.601->rec.709") # HD colors for upscaled video
    deblock_qed(quant1=28, quant2=28) # reduce DCT blocking
    vInverse() # blur away mild residual comb-like artifacts from interlaced MPEG encoding
    TemporalDegrain(SAD1=100, SAD2=75, sigma=4)
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=960, fheight=720)
    aWarpSharp(depth=3)
    Sharpen(0.2)
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    aWarpSharp(depth=5)
    Sharpen(0.3)
    
    AddGrainC(0.5, 0.5)
    the CPU2="ooooxx" in Mpeg2Source() applies a DCT ringing filter. It can also apply deblocking filters but I find those are too strong -- it removes too much detail. deblock_qed() is better.
    I "sort of" tried out the code. By that, I meant unfortunately I had to modify some stuff so it's not a true representation of the actual code.

    In AVSPmod 32bit and I discovered that aWarpSharp caused some type of green border on playback. I couldn't get Deblock_QED and Vinverse to work on the 64bit AVSPmod, so I kind of jump to the 32bit version. There was a "DFTfilter" function error with the 64bit. I ran an internet search and found multiple DFTfilter, both the x64 and x86 version and the error message persisted; Deblock_QED needed the DFTfilter. TemporalDegrain dropped the FPS to about 3, so I kind of abandoned that approach including dropping aWarpSharp altogether because of the green neon borders. I substituted in some other light sharpeners at the lowest settings and simply omitted any Denoiser. And I had to run the ffmpeg through a CRF 24 encode. Had to take into consideration needing the smallest file size possible.

    In other words, my settings deviated from the recipe, and unfortunately the image wasn't sharp as I needed it to be (when factoring file size) on the 512GB 12.9 ipad.

    I'm still going to use the Vinverse, Deblock I think and other stuff that's part of the code, but will be creating a personal recipe that will fit the required parameters needed on my end. I will be keeping your code handy though. It'll be stored as reference.


    Video attached.
    Click image for larger version

Name:	Green Borders a.png
Views:	124
Size:	1.19 MB
ID:	45548


    Another issue that I came across today while skimming through the test encoded footage is a jagged aliasing effect due to TFM(). I had to add TFM(pp=1) to resolve the issue. I thought it could be the filter plugins, or their respective orders. Test each filter separately. Test the filter orders as well. None of them made any difference. I even tried adding some antialiasing filter and pushed them to the max, and nothing tamed the jagged lines. Last resort, TFM() and TDecimate. With TDecimate only, the footage looked clean, but the video was all interlaced, so that wasn't going to work. The addition of TFM() removed the interlaced but left me with a jagged desk. Wikipeda'd TFM()'s settings solved the issue ....

    .. however, I'm not sure if that's going to affect any other part of the video.



    I settled on pp=1. That was the most stable straight line. No flicker or shimmer.

    There are 7 pp levels. pp= 1, 2, 3, 4, 5, 6, or 7.

    1: straight line - stable, clean line
    2: straight line - flicker shimmering straight line
    3. jagged line
    4. jagged line
    5. straight line - flicker shimmering straight line
    6. jagged line
    7. jagged line


    Video attached.
    Click image for larger version

Name:	TFM() PP c.png
Views:	93
Size:	500.5 KB
ID:	45553

    TFM(pp=1)
    Click image for larger version

Name:	TFM() PP a.png
Views:	144
Size:	851.5 KB
ID:	45549

    TFM()
    Click image for larger version

Name:	TFM() PP b.png
Views:	104
Size:	736.4 KB
ID:	45550
    Quote Quote  
  3. If you put on TFM(Display=True), it'll tell you if it's being deinterlaced rather than being field matched. If deinterlaced, it's using its built-in deinterlacer which isn't so good and could be responsible for the aliasing. You can have it use any deinterlacer you like, even QTGMC. If the aliasing is being caused by the deinterlacer used, you might want to figure out how to use a different one when TFM doesn't find a good field match.
    Quote Quote  
  4. TFM sometimes sees thin horizontal lines as interlacing. I bet the shades in the top left corner are confusing it, kicking in it's deinterlacer. You can try reducing the deinterlace threshold -- cthresh. The default is 9, higher values will cause the deinterlacer to kick in less often.

    If aWarpSharp() is giving you problems try aWarpSharp2() instead.
    Quote Quote  
  5. Here's what I got with the filter sequence for the Will and Grace clip:

    Click image for larger version

Name:	wg.png
Views:	717
Size:	3.42 MB
ID:	45558

    Compare that the your processed image in post #88. Mine is sharper with virtually no oversharpening halos (even though it's upscaled more), has more detail, and it has the correct aspect ratio.
    Quote Quote  
  6. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by manono View Post
    If you put on TFM(Display=True), it'll tell you if it's being deinterlaced rather than being field matched. If deinterlaced, it's using its built-in deinterlacer which isn't so good and could be responsible for the aliasing. You can have it use any deinterlacer you like, even QTGMC. If the aliasing is being caused by the deinterlacer used, you might want to figure out how to use a different one when TFM doesn't find a good field match.

    TFM(Display=True). Not exactly sure how to interpret this nor what actions may need to be applied (other than setting TFM(pp=1). It mostly says "combed - deinterlaced," and there would be random "clean frame." Frame 192 never shows up. I guess it's dropped or something.

    Notice the white line that stretches from the table past the leather chair. It might be a good indicator of interlacing. It is a piece of long tape that's part of the scene. Whenever the tape looks jagged (as well as the table line mentioned in the above post), the frame would display the message "combed - deinterlaced.' Whenever it says "Clean" frame, that piece of tape or the table would be a straight line.

    As far as interpreting what that means, I'm not sure.


    Regardless, TFM(pp=1) solved this issue. But again, not sure if TFM(pp=1) has any negative effects.

    I'll have to do some research on QTMGC. I've heard that it's suppose to be great, but slow as heck. That's all I know about it.


    Image
    [Attachment 45554 - Click to enlarge]
    Image
    [Attachment 45555 - Click to enlarge]
    Image
    [Attachment 45556 - Click to enlarge]
    Image
    [Attachment 45557 - Click to enlarge]




    http://avisynth.nl/index.php/TIVTC/TFM
    PP -

    Sets the post-processing mode. This controls how TFM should handle (or not handle)
    any combed frames that come out of the field matching process. Possible options
    are:

    0 - nothing (don't even look for combed frames)
    1 - find/hint combed frames but don't deinterlace
    2 - dumb blend deinterlacing
    3 - dumb cubic interpolation deinterlacing
    4 - dumb modified-ela deinterlacing
    5 - motion-adaptive blend deinterlacing
    6 - motion-adaptive cubic interpolation deinterlacing
    7 - motion-adaptive modified-ela deinterlacing




    Originally Posted by jagabo View Post
    Here's what I got with the filter sequence for the Will and Grace clip:

    Image
    [Attachment 45558 - Click to enlarge]


    Compare that the your processed image in post #88. Mine is sharper with virtually no oversharpening halos (even though it's upscaled more), has more detail, and it has the correct aspect ratio.
    I finally managed to find the missing 64bit plugins that I needed (for anyone else following along), so now I'm back on the 64bit AVSPMod:
    hqdn3d 64bit (https://forum.doom9.org/showthread.php?p=1374605#post1374605)
    vinverse 64bit (http://avisynth.nl/index.php/AviSynth%2B_x64_plugins)
    DCTfilter 64bit (http://avisynth.nl/index.php/AviSynth%2B_x64_plugins) ... I think this is the proper link.

    TemporalDegrain 64bit needed the hqdn3d plugin
    Deblock_QED 64bit needed the DCTfilter plugin

    Also had to load the needed plugins before loading TemporalDegrain or Deblock in AVSPMod. That helps to make them work.



    I'm going to re-test your code/script because now I actually have all the filter plugins working in 64bit AVSPmod. AWarpSharp also doesn't create any green borders on the 64bit AVSPMod, so that's good. The 32 bit awarpsharp however does still create the neon green borders. Briefly though, I did notice that if I add both of the following two filters to the script once at the end before AddGrainC, it help to bring out the "eyes" more. This was on Zoomed view 400%. FastlineDarkenMOD added a subtle touch while LimitedSharpenFaster pushed it a bit more.

    LimitedSharpenFaster(ss_x=1.5, ss_y=1.5, edgemode=1, strength=100)
    FastlineDarkenMOD(strength=25)

    I'm going to do the following test tonight, or tomorrow, or later in the week:
    (1) Jagabo's Script alone
    (2) Jagabo's Script + FastlineDarkenMOD
    (3) Jagabo's Script + LimitedSharpenFaster
    (4) Jagabo's Script + FastlineDarkenMOD + LimitedSharpenFaster.



    EDIT: There seems to be a conflict or something.

    There is no function named Deblock_QED when I run the batch script. But when previewing inside AVSPMod it works. For some reason, having LimitedSharpenFaster causes the error message. But it still doesn't make sense why it wouldn't throw up an error message when I remove LimitedSHarpenFaster. Should the error message persist regardless?
    Last edited by strawberryshortcake; 7th May 2018 at 19:22.
    Quote Quote  
  7. Originally Posted by strawberryshortcake View Post
    Regardless, TFM(pp=1) solved this issue. But again, not sure if TFM(pp=1) has any negative effects.
    With the post processor disabled you will be left with interlaced frames whenever the field matching can't produce a progressive frame. That happens when there's an orphaned field (a field for with the complimentary fields is missing -- usually because the video was edited, sped up, or slowed down after being telecined).

    I already explained how the post processor can misidentify picture content as comb artifacts and how you can raise the cthresh value to reduce these errors. Of course, raising the threshold too high will let some truly interlaced frames pass through too.
    Quote Quote  
  8. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    Originally Posted by strawberryshortcake View Post
    Regardless, TFM(pp=1) solved this issue. But again, not sure if TFM(pp=1) has any negative effects.
    With the post processor disabled you will be left with interlaced frames whenever the field matching can't produce a progressive frame. That happens when there's an orphaned field (a field for with the complimentary fields is missing -- usually because the video was edited, sped up, or slowed down after being telecined).

    I already explained how the post processor can misidentify picture content as comb artifacts and how you can raise the cthresh value to reduce these errors. Of course, raising the threshold too high will let some truly interlaced frames pass through too.
    I just tried cthresh=8,9,10,11, or 12 (those are the ranges), and none of those take care of the issue.


    So would pp=5 be better. Only 1 and 5 maintain the straight line, everything else results in a jagged line. With pp=5, the line does sort of shimmers though. Or do I find a deterinlacer to pair up with TFM and TDecimate?

    Note: I'll go with the shimmer with PP=5 if that's better though.

    0 - nothing (don't even look for combed frames)
    1 - find/hint combed frames but don't deinterlace
    2 - dumb blend deinterlacing
    3 - dumb cubic interpolation deinterlacing
    4 - dumb modified-ela deinterlacing
    5 - motion-adaptive blend deinterlacing
    6 - motion-adaptive cubic interpolation deinterlacing
    7 - motion-adaptive modified-ela deinterlacing
    Last edited by strawberryshortcake; 7th May 2018 at 19:51.
    Quote Quote  
  9. Originally Posted by strawberryshortcake View Post
    I just tried cthresh=8,9,10,11, or 12 (those are the ranges), and none of those take care of the issue.
    I had to go all the way up to 36 with the sample clip. I don't think I've ever had to go higher than 20 before.
    Quote Quote  
  10. In addition to adjusting cthresh, you usually need to adjust MI too . You don't want it so high that it never deinterlaces anything , that would be similar to PP=0. Ideally you would find sections that have orphan fields to figure out what settings to use

    You can specify QTGMC.SelectEven() for clip2 , so that when / if it meets the criteria for combing for an individual frame, it uses QTGMC instead of the lower quality deinterlace

    eg
    TFM(some settings, clip2=QTGMC().SelectEven() )

    But in that sample clip, nothing should be deinterlaced. All fields have a valid match. If you wanted to , you can specify an overrides file too
    Quote Quote  
  11. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    Originally Posted by strawberryshortcake View Post
    I just tried cthresh=8,9,10,11, or 12 (those are the ranges), and none of those take care of the issue.
    I had to go all the way up to 36 with the sample clip. I don't think I've ever had to go higher than 20 before.
    That worked, but if it's going to cause issues like poisondeathray mention, I might just go with TFM(PP=5), because at least according to what's written below at least it's going to "motion-active blend" deinterlace the material. And simply not go with PP=1 because accordingly PP=1 "finds combed frames but don't deinterlace."

    I even tried the following, and the lines were still jagged, probably because I'm not setting up QTGMC correctly
    TFM()
    TDecimate()
    QTGMC()


    0 - nothing (don't even look for combed frames)
    1 - find/hint combed frames but don't deinterlace
    2 - dumb blend deinterlacing
    3 - dumb cubic interpolation deinterlacing
    4 - dumb modified-ela deinterlacing
    5 - motion-adaptive blend deinterlacing
    6 - motion-adaptive cubic interpolation deinterlacing
    7 - motion-adaptive modified-ela deinterlacing


    And for some reason, I just can't get Deblock_QED or even the standard Deblock to work. I might just leave it out. In AVSPmod Deblock_QED seems to work because there isn't any errors, but when I run your jagobo .bat batch script it keeps returning something about no function named Deblock.

    [avisynth @ 00000000004c2d40] Script error: There is no function named 'Deblock_
    QED'.

    Originally Posted by poisondeathray View Post
    In addition to adjusting cthresh, you usually need to adjust MI too . You don't want it so high that it never deinterlaces anything , that would be similar to PP=0. Ideally you would find sections that have orphan fields to figure out what settings to use

    You can specify QTGMC.SelectEven() for clip2 , so that when / if it meets the criteria for combing for an individual frame, it uses QTGMC instead of the lower quality deinterlace

    eg
    TFM(some settings, clip2=QTGMC().SelectEven() )

    But in that sample clip, nothing should be deinterlaced. All fields have a valid match. If you wanted to , you can specify an overrides file too
    As mentioned above, I think I'm just going to keep it simple and go with TFM(pp=5), at least I think what it means is that it'll deinterlace anything when it deems necessary.





    For some reason, this one doesn't work (it triggers the deblock error). The bottom code after this worked, even though the only difference is me removing "LimitedDarkenFaster." In other words, I'm not even sure if the first code actually is using Deblock at all.



    EDIT: Mystery solved (in the next post)

    So if it makes things (probably easier to digest) is that when I remove these two lines of code below, the script works. But having the following two codes in there simply causes a "no function named Deblock_QED"

    echo Import("C:\Program Files\AviSynth+\plugins64\LimitedSharpenFaster.avs i"^) > "%%~A.avs"
    echo LimitedSharpenFaster(ss_x=1.5, ss_y=1.5, edgemode=1, strength=100^) >> "%%~A.avs"
    Last edited by strawberryshortcake; 7th May 2018 at 22:34.
    Quote Quote  
  12. With pp=5 any frames that TFM thinks are interlaced after field matching will have the two fields blended together. For the shot being discussed that's not such a bad problem. But in the cases where you have orphaned fields, usually at scene changes, you will get frames that look like a double exposure. If the video was important to me I would special case this particular video. But if you're going to batch process many episodes that's not practical.
    Quote Quote  
  13. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    With pp=5 any frames that TFM thinks are interlaced after field matching will have the two fields blended together. For the shot being discussed that's not such a bad problem. But in the cases where you have orphaned fields, usually at scene changes, you will get frames that look like a double exposure. If the video was important to me I would special case this particular video. But if you're going to batch process many episodes that's not practical.

    If it turns out that I don't like the double exposure look, if I simply stick with PP=1, would that happen? I know that with PP=1 (as you already mentioned above), I would simply be seeing some remaining interlace "artifacts" or "remnants." But that might be acceptable. S

    So it's either pp=5 .... possible double exposure; pp=1 ... some footage with a few seconds of interlace footage?



    As far as the Deblock error is concerned, I finally figured it out. Had to do some Sherlock Holmes magic.

    It was missing ">>".

    echo Import("C:\Program Files\AviSynth+\plugins64\LimitedSharpenFaster.avsi"^) > "%%~A.avs"
    echo LimitedSharpenFaster(ss_x=1.5, ss_y=1.5, edgemode=1, strength=100^) >> "%%~A.avs"


    Should have been:

    echo Import("C:\Program Files\AviSynth+\plugins64\LimitedSharpenFaster.avs i"^) >> "%%~A.avs"
    echo LimitedSharpenFaster(ss_x=1.5, ss_y=1.5, edgemode=1, strength=100^) >> "%%~A.avs"





    Here's the code that I might be going with (I'll decide between Pp=1 or pp=5). And the reason why I'm likely going to keep the FastLineDarkenMOD and LimitedSharpenFaster is because they did help to enhance and sharpen and make the eyes pop.


    Code:
    if not exist WithGrain__________23copyaudio(removeTWEAK)(pp1)NEWDARKMODwithSHARP md WithGrain__________23copyaudio(removeTWEAK)(pp1)NEWDARKMODwithSHARP
    for %%A in ("*.VOB") do (
        "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
        echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
        echo TFM(pp=1, d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
    echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\DCTFilter.dll"^) >> "%%~A.avs"
    echo Import("C:\Program Files\AviSynth+\plugins64\Deblock_QED_MT2Mod.avsi"^) >> "%%~A.avs"
    echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\vinverse.dll"^) >> "%%~A.avs"
    echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\hqdn3d.dll"^) >> "%%~A.avs"
    echo Import("C:\Program Files\AviSynth+\plugins64\TemporalDegrain.avs"^) >> "%%~A.avs"
    echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\nnedi3.dll"^) >> "%%~A.avs"
    echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\aWarpsharpMT.dll"^) >> "%%~A.avs"
    echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\AddGrainC.dll"^) >> "%%~A.avs"
    
    echo Import("C:\Program Files\AviSynth+\plugins64\LimitedSharpenFaster.avsi"^) >> "%%~A.avs"
    
    echo Import ("C:\Program Files\AviSynth+\plugins64\FastLineDarkenMOD.avsi"^) >> "%%~A.avs"   
    echo Deblock_QED(quant1=28, quant2=28^) >> "%%~A.avs"
    echo Vinverse(^) >> "%%~A.avs"
    echo TemporalDegrain(SAD1=100, SAD2=75, sigma=4^) >> "%%~A.avs"
    echo nnedi3_rpow2(2, nsize=4, cshift="Spline36Resize", fwidth=960, fheight=720^) >> "%%~A.avs"
    echo aWarpSharp(depth=3^) >> "%%~A.avs"
    echo Sharpen(0.2^) >> "%%~A.avs"
    echo nnedi3_rpow2(2, nsize=4, cshift="Spline36Resize", fwidth=1440, fheight=1080^) >> "%%~A.avs"
    echo aWarpSharp(depth=5^) >> "%%~A.avs"
    echo Sharpen(0.3^) >> "%%~A.avs"
    echo nnedi3_rpow2(2, nsize=4, cshift="Spline36Resize", fwidth=720, fheight=480^) >> "%%~A.avs"
    echo aWarpSharp(depth=3^) >> "%%~A.avs"
    echo Sharpen(0.2^) >> "%%~A.avs"
    
    echo LimitedSharpenFaster(ss_x=1.5, ss_y=1.5, edgemode=1, strength=255^) >> "%%~A.avs"
    
    echo FastlineDarkenMOD(strength=50^) >> "%%~A.avs"
    echo AddGrainC(0.5, 0.5^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryslow -tune film -crf 23 -vf setsar=sar=8/9 -acodec copy "WithGrain__________23copyaudio(removeTWEAK)(pp1)NEWDARKMODwithSHARP\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    pause
    Last edited by strawberryshortcake; 7th May 2018 at 22:31.
    Quote Quote  
  14. After field matching, with pp=1, remaining interlaced frames will pass through unchanged rather than being blended. Ie, they'll be combed instead of blended.
    Quote Quote  
  15. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    After field matching, with pp=1, remaining interlaced frames will pass through unchanged rather than being blended. Ie, they'll be combed instead of blended.
    Just for the sake of completion (in case other users are reading), two concerns:

    (1) If 2 minutes into a video, the fields are matched with pp=1, when you say the "remaining interlaced frames will pass through unchanged" does that mean from 2 minutes onward til the end of the video, everything will remain interlaced unchanged?

    (2) if someone legitimately wants to properly deinterlace or inverse telecine the video, would it take a couple to a few more steps to fix it? And how time consuming would it be? Would someone have to scrub through the entire video to find out what's combed and blended and designate exact time points for Avisynth/AVSPMod to fix?




    I ran a brief youtube scanned for deinterlacing videos, and stumbled across the following two. Not sure if I could also go this route after I've encoded the video through Avisynth using TFM(pp=1) TDecimate(), or TFM(pp=5) TDecimate().


    How To Properly De interlace Videos To 50 or 60 Fps Progressive
    https://www.youtube.com/watch?v=UkKaVyx1ukU

    How to Remove Interlacing/Frame Blending In Sony Vegas Pro 11
    https://www.youtube.com/watch?v=OqF3isW6Sok
    Quote Quote  
  16. Originally Posted by strawberryshortcake View Post
    (1) If 2 minutes into a video, the fields are matched with pp=1, when you say the "remaining interlaced frames will pass through unchanged" does that mean from 2 minutes onward til the end of the video, everything will remain interlaced unchanged?
    No. It means any frames detected as interlaced after trying to be field-matched don't get deinterlaced as they usually would. PP=1 is one of the worst choices. If, as I mentioned earlier, the deinterlacer is responsible for the aliasing, use a different deinterlacer. If, as jagabo mentioned earlier, something else mimics interlacing to TFM, then raise the cthresh. And no, QTGMC used as a post-processor doesn't slow the whole thing down, only those frames needing post-processing (deinterlacing). You can figure most of this out yourself by just reading the docs. They're pretty good.

    if someone legitimately wants to properly deinterlace or inverse telecine the video, would it take a couple to a few more steps to fix it? And how time consuming would it be? Would someone have to scrub through the entire video to find out what's combed and blended and designate exact time points for Avisynth/AVSPMod to fix?
    Well, there are override files so you can tell TIVTC what to do for each difficult frame or series of frames. But most don't do that. If it's difficult, then, yes it might take more time than usual. One solution to the leftover interlacing problem is adding Vinverse after the TIVTC. It deinterlaces those parts of frames that escaped being made progressive and leaves the already progressive frames alone.

    And for the particularly difficult films (like VHS tapes where the fields just don't line up properly), you can always use a good bobber (like QTGMC) followed by TDecimate or even SRestore to remove the dupe frames. That's a last resort, though.
    Quote Quote  
  17. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by manono View Post
    Originally Posted by strawberryshortcake View Post
    (1) If 2 minutes into a video, the fields are matched with pp=1, when you say the "remaining interlaced frames will pass through unchanged" does that mean from 2 minutes onward til the end of the video, everything will remain interlaced unchanged?
    No. It means any frames detected as interlaced after trying to be field-matched don't get deinterlaced as they usually would. PP=1 is one of the worst choices. If, as I mentioned earlier, the deinterlacer is responsible for the aliasing, use a different deinterlacer. If, as jagabo mentioned earlier, something else mimics interlacing to TFM, then raise the cthresh. And no, QTGMC used as a post-processor doesn't slow the whole thing down, only those frames needing post-processing (deinterlacing). You can figure most of this out yourself by just reading the docs. They're pretty good.

    if someone legitimately wants to properly deinterlace or inverse telecine the video, would it take a couple to a few more steps to fix it? And how time consuming would it be? Would someone have to scrub through the entire video to find out what's combed and blended and designate exact time points for Avisynth/AVSPMod to fix?
    Well, there are override files so you can tell TIVTC what to do for each difficult frame or series of frames. But most don't do that. If it's difficult, then, yes it might take more time than usual. One solution to the leftover interlacing problem is adding Vinverse after the TIVTC. It deinterlaces those parts of frames that escaped being made progressive and leaves the already progressive frames alone.

    And for the particularly difficult films (like VHS tapes where the fields just don't line up properly), you can always use a good bobber (like QTGMC) followed by TDecimate or even SRestore to remove the dupe frames. That's a last resort, though.


    So I'm guessing the "best" preliminary approach would be to go with the traditional standard ...

    TFM()
    TDecimate()

    .... because it usually works pretty well. Then if upon watching any of the episodes something like the jagged desk appears, then I would go ahead and apply the appropriate deinterlace schemes and encode the VOB files again. Because as it stands, doing pp=1 or pp=5 drastically increases the file size. I'll forever skip pp=1 as it is not recommended. When I get a chance, I'll find time to learn how to do it properly.

    When i was simply concerned about various plugins to make the image look pleasing [ and using default TFM().TDecimate() ], the file size for each Will & Grace episode were in the range of 140 to 160mb. And if I compress the audio from 192k to 128k (using ffmpeg) it drops the file size by another 10 mb. Using pp=1 and pp=5 pushes the file size to 180mb to 200mb to 210mb.


    My line of thinking is if I use pp=5 that could cause more issue over default TFM().TDecimate() especially for those that simply works already with TFM().TDecimate() with no issues.

    Hopefully that's the "proper" approach for the time being.



    EDIT: Actually looking back at some of the pp=1 encode files, they were also in the range of 140 to 160mb.
    Last edited by strawberryshortcake; 8th May 2018 at 03:55.
    Quote Quote  
  18. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Was hoping to edit the previous post to include a video attachment of the pp=1 encoded file. There wasn't an attachment tab at all on edits.

    EDIT
    Test Part 1: Yep. Barebones, no filter plugin.

    (A) TFM().TDecimate. .... Jagged lines,
    (B) TFM(pp=1).TDecimate .... clean lines.






    So here's two of the same clip with different encoding. Same scene for both.

    (1) TFM().
    TDecimate(). = lots of jagged edges everywhere. Not just the table, it's seen most frequently in the office.

    (2) TFM(pp=1).
    TDecimate(). = everything looks proper and clean.

    (3) including an m2v file as well. Not sure if it's going to help though.

    So now, I'm kind of confused if I should simply stick with pp=1 despite the potential issues? Secondly, still as a novice to all of this, if issues are to be introduced with pp=1 encoding, would they have made their presence visibly known during those 2 minutes and 30 seconds somewhere at least?

    I'm guessing the problem with pp=1 encoding is that it'll leave parts of the video still interlaced, combed or whatever the proper terminology is. But if I don't happen to see them for the entire run of the episode, is there something else that I should be concerned about?
    Last edited by strawberryshortcake; 8th May 2018 at 06:05.
    Quote Quote  
  19. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    And here's the vob file in case it makes any difference.
    Image Attached Files
    Quote Quote  
  20. Originally Posted by strawberryshortcake View Post

    I'm guessing the problem with pp=1 encoding is that it'll leave parts of the video still interlaced, combed or whatever the proper terminology is.
    It's risky, yes, unless you've carefully gone over the entire thing to make sure. And even then something you missed might trip you up.

    And, yes, there's big problems in the office. I got rid of the aliasing from being deinterlaced by raising the CThresh way high. I made the D2V (I called it Test.d2v) using Honor Pulldown Flags) and then used this script:

    TFM(D2V="Test.d2v",CThresh=35).TDecimate()

    I think I could also get rid of it by using a different and better deinterlacer, but I didn't check.

    Using the D2V setting is useful when there's a mix of film and video (hard and soft telecine). Your sample is 96% film.
    Quote Quote  
  21. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    I was able to fiddle with the code below to sharpen a video. But I'm curious how I'm suppose to get the sharpened video to output using jagabo's .bat batch (posted way below, second code) file setup. I did an extreme s=148 to push it to the extreme to "see" exactly what the code does. My .bat batch output file encoded video doesn't show the "extreme sharpened video." Where am I going wrong with the .bat batch code? How do I modified the .bat batch file to output the sharpened video.




    https://forum.doom9.org/showthread.php?t=76257

    Code:
    x=xxxsource("blabla.xxx")
    # apply sharpening strength here 0 = lowest
    s=48
    
    # apply edge limiting here 127 = lowest limiting
    w=5
    
    i=x.blur(1.58)
    j=subtract(i,x).levels(0+s,1,255-s,0,255)
    w=w*(128/s)
    k=j.levels(127-w,1,128+w,127-w,128+w)
    l=subtract(x,k).subtitle("limited")
    m=subtract(x,j).subtitle("normal")
    stackhorizontal(x.subtitle("original"),l,m)

    Click image for larger version

Name:	sharpen filtera.png
Views:	92
Size:	189.3 KB
ID:	45628Click image for larger version

Name:	sharpen filterb.png
Views:	73
Size:	1.41 MB
ID:	45629





    Side remark: I simply couldn't find anything better than TNLmeans for de-noising. At default, TNLmeans was crawling at about 0.5 - 1.0 FPS. When I changed the two values ( Ax=4, Ay=4 .. changed to Ax=1, Ay=1) I was able to get fairly solid enough results pushing 10 FPS. The higher the Ax and Ay value the lowered the FPS with TNLmeans. With other filters thrown into the mix, I'm getting at around 5-8 FPS. In other words, I can actually use NLmeans and it's one of the more effective denoise filters I've tested.

    Also not exactly sure what "Edgemask" is suppose to do. Still doing research on it.


    Code:
    if not exist ______PERFECT__NEXT___TNLMEANS(BEST) md ______PERFECT__NEXT___TNLMEANS(BEST)
    for %%A in ("*.mkv") do (
        echo LWLibavVideoSource("%%A",format="YUV420P8"^) > "%%~A.avs"
    
    #echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\MosquitoNR.dll"^) >> "%%~A.avs"
    #echo MosquitoNR(strength=32, restore=1, radius=1^) >> "%%~A.avs"
    
    
    echo Edgemask = mt_edge(^).mt_expand(^).mt_inpand(^).mt_inpand(^).mt_expand(^).mt_expand(chroma="-128"^) >> "%%~A.avs"             
    
        echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\TNLMeans.dll"^) >> "%%~A.avs"                                                       
        echo Import("C:\Program Files\AviSynth+\plugins64\FastLineDarkenMOD.avsi"^) >> "%%~A.avs"
        echo Import("C:\Program Files\AviSynth+\plugins64\Hysteria.avsi"^) >> "%%~A.avs"
        echo Import("C:\Program Files\AviSynth+\plugins64\Santiag.avs"^) >> "%%~A.avs"
        echo LoadPlugin("C:\Program Files\AviSynth+\plugins64\RgTools.dll"^) >> "%%~A.avs"
        echo Import("C:\Program Files\AviSynth+\plugins64\SPresso.avs"^) >> "%%~A.avs"
    
        echo tnlmeans(ax=1, ay=1, sx=2, sy=2, bx=1, by=1, sse=true, a=1, h=8^) >> "%%~A.avs"
        echo FastLineDarkenMOD(strength=255, luma_cap=1, thinning=1^) >> "%%~A.avs"
        echo Hysteria(strength=12, usemask=false, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        echo RemoveGrain(mode=1, planar=false^) >> "%%~A.avs"   
        echo Function SPresso(clip clp, int "limit", int "bias", int "RGmode", int "limitC", int "biasC", int "RGmodeC"^){^} >> "%%~A.avs"
        echo Spresso(limit=2, bias=33, RGmode=4, limitC=4, biasC=50, RGmodeC=0^) >> "%%~A.avs"
        echo Santiag(strh=3,strv=3^) >> "%%~A.avs"   
    
    
    echo (# apply sharpening strength here 0 = lowest
    s=148(^) 
    # apply edge limiting here 127 = lowest limiting
    w=5(^) 
    i=x.blur(1.58^) 
    j=subtract(i,x^).levels(0+s,1,255-s,0,255^) 
    w=w*(128/s^) 
    k=j.levels(127-w,1,128+w,127-w,128+w^) 
    l=subtract(x,k^).subtitle("limited"^) 
    m=subtract(x,j^).subtitle("normal"^) >> "%%~A.avs"             
    
    
    
    
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryslow -tune animation -crf 25 -vf hqdn3d,setsar=sar=8/9 -c:a ac3 -ac 2 -b:a 128k "______PERFECT__NEXT___TNLMEANS(BEST)\%%~nA.mp4"
        del "%%A.AVS"
        del "%%~nA*.LWI"
    )
    pause
    
    
    
    



    Update/EDIT:


    Still not fully successful, but managed to inch closer. I turned the script into a .avs file (Simplesharpen.avs) and placed it into my Avisynth plugin folder. Initially the encoding/video output was three videos line up next to each other running side by side. Made a simple code modification and was able to "return output" one video.


    But can anyone help me figure out how to change the value in my batch script so that it affects the settings. I know I'm suppose to further fiddle with the Simplesharpen.avs file (and that's what I will be trying to do) using Wiki Avisynth, but if anyone has a clue how to do it, it would be much appreciative. Thanks.


    if not exist ______PERFECT__NEXT___TNLMEANS(BEST) md ______PERFECT__NEXT___TNLMEANS(BEST)
    for %%A in ("*.mkv") do (
    echo LWLibavVideoSource("%%A",format="YUV420P8"^) > "%%~A.avs"

    echo c=LWLibavVideoSource("%%A",format="YUV420P8"^) >> "%%~A.avs"
    echo Import("C:\Program Files\AviSynth+\plugins64\simplesharpen.avs"^) >> "%%~A.avs"
    echo Function simplesharpen(c, int "s", int "w"^){^} >> "%%~A.avs"
    echo SimpleSharpen(s=248, w=5^) >> "%%~A.avs"





    Code:
    Function simplesharpen(clip c, int "s", int "w")
    {
    s = default ( s, 48 )
    w = default ( w, 5 )
    
    
    x=c
    # apply sharpening strength here 0 = lowest
    s=48
    
    # apply edge limiting here 127 = lowest limiting
    w=5
    
    i=x.blur(1.58)
    j=subtract(i,x).levels(0+s,1,255-s,0,255)
    w=w*(128/s)
    k=j.levels(127-w,1,128+w,127-w,128+w)
    l=subtract(x,k).subtitle("limited")
    m=subtract(x,j).subtitle("TEST")
    stackhorizontal(x.subtitle("original"),l,m)
    
    output=m
    
    
    return output
    }
    Last edited by strawberryshortcake; 14th May 2018 at 03:54.
    Quote Quote  



Similar Threads

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