VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Hi!
    I have a video from Amazon (WED-DL). He has problems, is it possible to remove pixelation, do color correction?
    Maybe add grain, contrast? What do you think? Tell me please.

    Sample - sample_vh_amzn.mkv (77.1 Mb).

    Image
    [Attachment 60582 - Click to enlarge]

    Image
    [Attachment 60583 - Click to enlarge]
    Quote Quote  
  2. is it possible to remove pixelation, do color correction?
    Maybe add grain, contrast? What do you think? Tell me please.
    Sure.

    Looks like someone upscaled some sd conten to hd using a linear or bilinear resizer, so by downscaling to SD resolution and upscaling back to hd you get something like:


    I used RealESRGAN for upscaling, but you get rid of the artifacts with most decent resizers.

    For color grading one can do tons of stuff,...



    (used some free available LUTs)

    personally I wouldn't add grain,...

    Cu Selur

    Ps.: Above can be done using Vapoursynth or Avisynth and should also be possible with most NLE tools.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. A wider variety of shots would have been better. But try something like this:

    Code:
    LWLibavVideoSource("sample_vh_amzn.mkv") 
    
    # brightness, contrast, gamma, saturation
    ColorYUV(gain_y=150, off_y=-22, gamma_y=50, cont_u=250, cont_v=250)
    ColorYUV(off_y=14)
    
    # downscale to original size and clean
    BilinearResize(704, 480)
    Santiag(1,1)
    HQDN3D(ls=1.0, cs=1.0, lt=2.0, ct=2.0)
    Sharpen(0.5)
    
    # upscale back to 1080p
    nnedi3_rpow2(4, cshift="Spline36Resize", fwidth=1920, fheight=1080)
    aWarpSharp(depth=5)
    CAS(0.7)
    Image Attached Thumbnails Click image for larger version

Name:	adjusted.jpg
Views:	52
Size:	133.5 KB
ID:	60586  

    Quote Quote  
  4. to Selur,
    Alas, this quality is officially available on the Japanese Amazon with a Prime subscription.
    Thanks for the answer, can I ask for an example script for Avisynth?

    to jagabo,
    Thanks, I added another sample. Is the brightness a little too high or does it seem to me so?
    sample_vh_amzn_v2.mkv
    Quote Quote  
  5. Yes, the adjustments were definitely too bright for those outdoor shots. Something like this is better for those:

    Code:
    ColorYUV(gain_y=75, cont_u=250, cont_v=250)
    Quote Quote  
  6. to jagabo,
    Okay, thanks again.

    ---
    Do I understand correctly that the Japanese took the DVD and made an upscale 1080 of dubious quality?
    Quote Quote  
  7. Originally Posted by girod2033 View Post
    Do I understand correctly that the Japanese took the DVD and made an upscale 1080 of dubious quality?
    Somebody did.
    Quote Quote  
  8. Originally Posted by jagabo View Post
    Originally Posted by girod2033 View Post
    Do I understand correctly that the Japanese took the DVD and made an upscale 1080 of dubious quality?
    Somebody did.
    Alas, these are original video from the Japanese Amazon.

    PM.
    Quote Quote  
  9. The video was made from an analog SD recording, poorly captured, then poorly deinterlaced and poorly upscaled.
    Quote Quote  
  10. The DVD source you sent was far better than the amazon upscaled version. Here's what I came up with:

    Code:
    ######################################################
    
    function GreyRamp()
    {
       BlankClip(color=$000000, width=1, height=256, pixel_type="RGB32")
       StackHorizontal(last, last.RGBAdjust(rb=1, gb=1, bb=1))
       StackHorizontal(last, last.RGBAdjust(rb=2, gb=2, bb=2))
       StackHorizontal(last, last.RGBAdjust(rb=4, gb=4, bb=4))
       StackHorizontal(last, last.RGBAdjust(rb=8, gb=8, bb=8))
       StackHorizontal(last, last.RGBAdjust(rb=16, gb=16, bb=16))
       StackHorizontal(last, last.RGBAdjust(rb=32, gb=32, bb=32))
       StackHorizontal(last, last.RGBAdjust(rb=64, gb=64, bb=64))
       StackHorizontal(last, last.RGBAdjust(rb=128, gb=128, bb=128))
    }
    
    ######################################################
    
    LWLibavVideoSource("sample_vh_DVD.mkv", cache=false, prefer_hw=2) 
    TFM()
    TDecimate()
    Crop(4,0,-4,-8)
    src = last
    
    ColorMatrix(mode="rec.601->rec.709")
    
    # even out brightness across the frame
    alpha = Greyramp().PointResize(width, height).ConvertToYV12(matrix="pc.601")
    Overlay(ColorYUV(gain_y=20), last, mask=alpha)
    
    # adjust brightness, saturation
    ColorYUV(gain_y=75, cont_u=250, cont_v=250)
    
    # automatic gain, tempered a bit
    Overlay(last, ColorYUV(autogain=true), opacity=0.50)
    
    # dehalo only the strongest edges
    emask = mt_edge(mode="hprewitt", thy1=150, thy2=150).mt_expand().Blur(1.0)
    Overlay(last, dehalo_alpha(rx=2.0, ry=2.0, brightstr=1.0), mask=emask)
    CAS(0.5)
    
    SMDegrain()
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1280, fheight=720)
    aWarpSharp(depth=3)
    Sharpen(0.2)
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1920, fheight=1080)
    aWarpSharp(depth=5)
    CAS(0.7)
    
    prefetch(8)
    The video is overall brighter at the right than the left so I evened it out a bit. Then I adjusted the brightness and contrast manually to get it in the ballpark. I used ColorYUV's automatic gain option but that usually overdoes it. So I tempered it by blending the result with the original. Play around with the opacity variable to get closer to one or the other. Removing halos can be very damaging so I limited it to the strongest halos. The two step upscale is a little sharper than a single step upscale.

    Image
    [Attachment 60617 - Click to enlarge]
    Last edited by jagabo; 6th Sep 2021 at 17:30.
    Quote Quote  
  11. Thanks for the answer, can I ask for an example script for Avisynth?
    Didn't use Avisynth, used Vapoursynth:
    Here's the script without color changes:
    Code:
    # Imports
    import vapoursynth as vs
    # getting Vapoursynth core
    core = vs.core
    # Loading Plugins
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
    # source: 'C:\Users\Selur\Desktop\sample_vh_amzn.mkv'
    # current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
    # Loading C:\Users\Selur\Desktop\sample_vh_amzn.mkv using LWLibavSource
    clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample_vh_amzn.mkv", format="YUV420P8", cache=0, prefer_hw=0)
    # making sure input color matrix is set as 709
    clip = core.resize.Bicubic(clip, matrix_in_s="709",range_s="limited")
    # making sure frame rate is set to 23.976
    clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
    # Setting color range to TV (limited) range.
    clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
    # cropping the video to 1920x1076
    clip = core.std.CropRel(clip=clip, left=0, right=0, top=2, bottom=2)
    # adjusting resolution before resizing 
    clip = core.fmtc.resample(clip=clip, w=768, h=430, kernel="lanczos", interlaced=False, interlacedd=False)
    from vsrealesrgan import RealESRGAN
    # adjusting color space from YUV420P16 to RGBS for VsRealESRGAN
    clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_s="limited")
    # resizing using RealESRGAN
    clip = RealESRGAN(clip=clip, device_type="cuda", device_index=0)
    # adjusting resizing to hit target resolution 
    clip = core.fmtc.resample(clip=clip, w=1920, h=1076, kernel="lanczos", interlaced=False, interlacedd=False)
    # adjusting output color from: RGB48 to YUV420P10 for x265Model
    clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited")
    # set output frame rate to 23.976fps
    clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
    # Output
    clip.set_output()
    and here's one where i Use the PresetPro binary code-LUT:
    Code:
    # Imports
    import vapoursynth as vs
    # getting Vapoursynth core
    core = vs.core
    # Loading Plugins
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/vscube.dll")
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
    # source: 'C:\Users\Selur\Desktop\sample_vh_amzn.mkv'
    # current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
    # Loading C:\Users\Selur\Desktop\sample_vh_amzn.mkv using LWLibavSource
    clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample_vh_amzn.mkv", format="YUV420P8", cache=0, prefer_hw=0)
    # making sure input color matrix is set as 709
    clip = core.resize.Bicubic(clip, matrix_in_s="709",range_s="limited")
    # making sure frame rate is set to 23.976
    clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
    # Setting color range to TV (limited) range.
    clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
    # adjusting color space from YUV420P8 to RGB24 for vsTimeCube
    clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="limited")
    # color adjustment using TimeCube
    clip = core.timecube.Cube(clip=clip, cube="I:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/color/Presetpro - Binary Code.cube")
    # cropping the video to 1920x1076
    clip = core.std.CropRel(clip=clip, left=0, right=0, top=2, bottom=2)
    # adjusting resolution before resizing 
    clip = core.fmtc.resample(clip=clip, w=768, h=430, kernel="lanczos", interlaced=False, interlacedd=False)
    from vsrealesrgan import RealESRGAN
    # adjusting color space from RGB48 to RGBS for VsRealESRGAN
    clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
    # resizing using RealESRGAN
    clip = RealESRGAN(clip=clip, device_type="cuda", device_index=0)
    # adjusting resizing to hit target resolution 
    clip = core.fmtc.resample(clip=clip, w=1920, h=1076, kernel="lanczos", interlaced=False, interlacedd=False)
    # adjusting output color from: RGB48 to YUV420P10 for x265Model
    clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited")
    # set output frame rate to 23.976fps
    clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
    # Output
    clip.set_output()
    Here's an example of using the above on the second clip:

    Code:
    # Imports
    import vapoursynth as vs
    # getting Vapoursynth core
    core = vs.core
    # Loading Plugins
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/vscube.dll")
    core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
    # source: 'C:\Users\Selur\Desktop\sample_vh_amzn_v2.mkv'
    # current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
    # Loading C:\Users\Selur\Desktop\sample_vh_amzn_v2.mkv using LWLibavSource
    clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample_vh_amzn_v2.mkv", format="YUV420P8", cache=0, prefer_hw=0)
    # making sure input color matrix is set as 709
    clip = core.resize.Bicubic(clip, matrix_in_s="709",range_s="limited")
    # making sure frame rate is set to 23.976
    clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
    # Setting color range to TV (limited) range.
    clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
    # adjusting color space from YUV420P8 to RGB24 for vsTimeCube
    clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="limited")
    # color adjustment using TimeCube
    clip = core.timecube.Cube(clip=clip, cube="I:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/color/Presetpro - Binary Code.cube")
    # cropping the video to 1920x1070
    clip = core.std.CropRel(clip=clip, left=0, right=0, top=4, bottom=6)
    # adjusting resolution before resizing 
    clip = core.fmtc.resample(clip=clip, w=768, h=428, kernel="lanczos", interlaced=False, interlacedd=False)
    from vsrealesrgan import RealESRGAN
    # adjusting color space from RGB48 to RGBS for VsRealESRGAN
    clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
    # resizing using RealESRGAN
    clip = RealESRGAN(clip=clip, device_type="cuda", device_index=0)
    # adjusting resizing to hit target resolution 
    clip = core.fmtc.resample(clip=clip, w=1920, h=1070, kernel="lanczos", interlaced=False, interlacedd=False)
    # adjusting output color from: RGB48 to YUV420P10 for x265Model
    clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited")
    # set output frame rate to 23.976fps
    clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
    # Output
    clip.set_output()

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  12. jagabo, Selur

    Thank you very much for your help.
    Quote Quote  



Similar Threads

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