Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
2nd February 2018, 05:53 | #1 | Link |
Registered User
Join Date: Feb 2002
Posts: 303
|
SD to HD, BT.601 to BT.709 Conversion in AVS+
Hello all! I have captured some old VHS tapes in YUY2 and I want to upscale it to HD using nnedi3. I've read a lot of information on converting BT.601 to BT.709 and I know the transfer between them is the same but the primaries and matrix are different. I was wondering if the following method is correct way in AVS+. I have seen a way in Dither tools, but I rather just use what's there in AVS+. Since I'm going to encode to 10-bit x264, my finally output will be 4:2:2 10-bit.
Code:
#AVI Source in YUY2 720x480 res ConvertToYV16() ConvertBits(bits=16) ConvertBits(bits=32) ConvertToYUV444(chromaresample="point") ConvertToRGB48(matrix="Rec601") ConvertToYUV444(matrix="Rec709") ConvertToYV16(chromaresample="point") ConvertBits(bits=16) ConvertToStacked() top = last.crop(0, 0, -0, -480).nnedi3_rpow2(rfactor=4, cshift="lanczosresize", fwidth=1440, fheight=1080, ep0=2, nsize=0, nns=4, qual=2, pscrn=4, opt=4) bottom = last.crop(0, 480, -0, -0).nnedi3_rpow2(rfactor=4, cshift="lanczosresize", fwidth=1440, fheight=1080, ep0=2, nsize=0, nns=4, qual=2, pscrn=4, opt=4) #return bottom last = stackvertical(top, bottom) ConvertFromStacked() ConvertBits(bits=10, dither=0) Last edited by Aktan; 2nd February 2018 at 15:45. Reason: Found that 32 float is less lossy when converting to RGB |
2nd February 2018, 07:48 | #2 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Not sure how Avisynth+ works (I use standard Avisynth 2.6.1).
Code:
#assuming it's 720x480 anamorphic flagged 4:3 #crop 8 pixel to get rid of the safe area garbage #crop 60 top and bottom to get 16:9 crop(8, 60, -8, -60) #bring everything to 16bit Dither_convert_8_to_16() #upscale using NNEDI3 to HD with 16bit precision nnedi3_resize16(target_width=1280, target_height=720, mixed=true, thr=1.0, elast=1.5, nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true) #convert from BT601 to BT709 with 16bit precision Dither_convert_yuv_to_rgb(matrix="601", output="rgb48y", lsb_in=true) r = SelectEvery(3, 0) g = SelectEvery(3, 1) b = SelectEvery(3, 2) Dither_convert_rgb_to_yuv(r, g, b, matrix="709", lsb=true) #Dithering down to real 10bit Dither_quantize(bitdepth=10, reducerange=true) Dither_out() This assuming it's a progressive capture, 'cause if it's interlaced, you should deinterlace it first. Last edited by FranceBB; 2nd February 2018 at 07:53. |
2nd February 2018, 15:10 | #3 | Link |
Registered User
Join Date: Feb 2002
Posts: 303
|
Thanks for the help! I was trying to avoid using dither tools and use pure AVS+ (if possible) but I appreciate your help. I have a few comments/question:
- My source is really 4:3 so cropping top/bottom 60 for 16:9 doesn't apply, but how much should I crop for just 4:3? Is it 8 pixels? - nnedi3_resize16 also uses dither tools, is it possible to just use nnedi3_resize16? - I thought standard AVS only supports 8-bit, so does that mean the output is in Stack16 format? If so, how do you output that to x264? - Yep, I'm setting --input-depth 10 with AVS+ and yep, I have deinterlaced it with QTGMC. - Does this method change the color primaries between BT.601 and BT.709? Last edited by Aktan; 2nd February 2018 at 15:17. |
2nd February 2018, 16:18 | #4 | Link | ||||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Quote:
Quote:
It's gonna take an 8bit input and upscale it at 16bit. Quote:
Quote:
You can output 16bit stacked with just Dither_Out() or you can dither it down to 10bit using Dither_quantize(bitdepth=10, reducerange=true) Dither_out() This way you'll send 10bit video to x264 and all you need is to add --input-depth 10. |
||||
2nd February 2018, 16:25 | #5 | Link | |||
Registered User
Join Date: Feb 2002
Posts: 303
|
Quote:
Quote:
Quote:
|
|||
Thread Tools | Search this Thread |
Display Modes | |
|
|