11-19-2024, 07:33 AM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
I was deinterlacing+upscaling analog PAL captures in vapoursynth with following commands, which works well:
clip = haf.QTGMC(clip, Preset='Slower', TFF=True)
clip = core.resize.Lanczos(clip, 1440, 1080 ,matrix_in="6",matrix="1")
The stairstepping/jagged lines/aliasing go away which is nice.
But now when I do it on PAL DV, as follows:
clip = haf.QTGMC(clip, Preset='Slower', TFF=False)
clip = core.resize.Lanczos(clip, 1440, 1080 ,matrix_in="6",matrix="1")
there's still some aliasing visible, see attached zoomed example:
vlcsnap-2024-11-19-14h16m40s986.png
It is also present in the DV source so probably due to the DV codec itself.
Is there a way to fix this without blurring?
|
Someday, 12:01 PM
|
|
Ads / Sponsors
|
|
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
11-19-2024, 12:23 PM
|
|
Free Member
|
|
Join Date: Dec 2015
Location: USA
Posts: 3,631
Thanked 629 Times in 578 Posts
|
|
I would input the DV file into vdub2 and output as lossless AVI or compressed lossless HuffYUV AVI yuv2 or similar codec to get rid of the DV codec first, then proceed with your normal script as if it was an analog capture, Also when you resize to 1440x1080 make sure to switch to rec.709.
https://www.youtube.com/@Capturing-Memories/videos
|
The following users thank latreche34 for this useful post:
ThumperStrauss (01-05-2025)
|
11-19-2024, 12:47 PM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
Do you think there's something going wrong when feeding DV directly to vapoursynth?
I'll try the preconversion to lossless and let you know...
matrix 1 is already rec.709, according to http://www.vapoursynth.com/doc/funct...resize.Lanczos
When I compare the colors of the source/input and the output, it's the same, so that should be already correct.
|
11-20-2024, 02:46 AM
|
|
Free Member
|
|
Join Date: Feb 2011
Location: France
Posts: 573
Thanked 123 Times in 107 Posts
|
|
try this:
Code:
main=last
main
Santiag() # reduce aliasing
filtered=last
main
mt_edge().mt_expand
mymask=last
mt_merge(main, filtered, mymask)
|
11-20-2024, 07:07 AM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
I did the conversion to lossless first and then vapoursynth, same result.
Quote:
Originally Posted by themaster1
try this:
|
This looks something for avisynth, but I'm using vapoursynth.
I'll have to lookup and install the equivalent for that...
-- merged --
I did it with this and it looks better now: clip = xaa(clip,mode="di2 znedi3", mask=0, chroma=1)
But should I do it before or after de-interlacing(QTGMC) ?
|
11-20-2024, 12:28 PM
|
|
Free Member
|
|
Join Date: Dec 2015
Location: USA
Posts: 3,631
Thanked 629 Times in 578 Posts
|
|
I would investigate the root cause first, I see this in forums all the time when someone presents a problem everyone jumps in with a patch solution instead of focusing on addressing the root cause of the problem. Maybe post few seconds sample of the raw DV so we can examine.
https://www.youtube.com/@Capturing-Memories/videos
|
11-20-2024, 01:15 PM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
OK here it is attached: test.avi
I was briefly thinking it could be something to do with the camera'a digital zoom, but it's also visible in wide/zoomed out shots.
|
11-20-2024, 02:23 PM
|
|
Free Member
|
|
Join Date: Jan 2016
Posts: 427
Thanked 86 Times in 77 Posts
|
|
PAL DV uses 4:2:0 chroma subsampling and so the reds and blues will have less resolution than the greens.
In my experience, Topaz AI works well on NTSC DV, you might try it with your PAL DV.
-- merged --
I tried to upscale the video in Topaz AI but it did not satisfactorily resolve the aliasing issues. It's a tough problem.
|
11-21-2024, 03:51 PM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
Thanks for the input. I'll do it with the xaa antialiasing in vapoursynth.
Rests the question, is it best before or after deinterlacing?
|
11-21-2024, 04:39 PM
|
|
Site Staff | Video
|
|
Join Date: Dec 2002
Posts: 14,389
Thanked 2,606 Times in 2,217 Posts
|
|
AA must come after, but noting QTGMC has some built in.
|
11-22-2024, 01:18 AM
|
|
Free Member
|
|
Join Date: Dec 2015
Location: USA
Posts: 3,631
Thanked 629 Times in 578 Posts
|
|
I just looked at the sample, The problems you are facing are baked in the original DV file, They are not caused by Vapoursynth, Thick vertical lines, image overexposed, not sure what happens during the shooting of the footage. One thing for sure, you can't bring back the over exposed areas like her face, Also it's hard to fix those vertical lines in post.
https://www.youtube.com/@Capturing-Memories/videos
|
11-22-2024, 04:03 AM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by latreche34
They are not caused by Vapoursynth
|
Of course not, you can also see it in the source DV I posted... I just mentioned Vapoursynth/QTGMC because in analog footage it also removes a lot of aliasing/stairstepping, but not here in this DV.
Quote:
Originally Posted by latreche34
you can't bring back the over exposed areas
|
I know, and I'm not trying to, it's just a part of the recording. Only the aliasing bothers me.
Quote:
Originally Posted by latreche34
Also it's hard to fix those vertical lines in post.
|
The "mice teeth" in the curtain or what do you mean, the aliasing itself?
I did the AA after QTGMC + resizing and it looks better, see test.avi.mp4
So if the camera(Sony TRV-620E) recorded the aliasing, is there a problem with it, or is it just a DV codec problem due to low resolution etc?
I also noticed that the DV rec has only 32Khz audio, which is a bit crappy... Should I convert it to 48Khz AAC in MP4 or leave it 32Khz?
|
11-30-2024, 03:32 PM
|
|
Free Member
|
|
Join Date: Feb 2022
Posts: 118
Thanked 31 Times in 28 Posts
|
|
After QTGMC, I would try fixing the chroma shift, apply Santiag with in a vertical flipped video, adjust the colors then try denoising,... https://imgsli.com/MzIzMTE0/0/3 and only after that think about upscaling.
|
11-30-2024, 04:00 PM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
Looks better indeed, for this clip at least. I see you also did a lower gamma. What syntax did you use for these?
|
11-30-2024, 08:19 PM
|
|
Free Member
|
|
Join Date: Sep 2020
Location: Perth, Western Australia
Posts: 672
Thanked 129 Times in 116 Posts
|
|
Quote:
Originally Posted by latreche34
I just looked at the sample, The problems you are facing are baked in the original DV file,... Thick vertical lines, image overexposed, not sure what happens during the shooting of the footage.
|
Yes, this isnt cine film where we didnt see over or under exposure until the film came back from lab processing and was projected. That wildly overexposed face would have looked like that in the DV camera's viewfinder at the time of the event. The camera operator either didnt notice or for whatever reason didnt do anything about it. Some things, many things, we must get right at time of shooting.
|
11-30-2024, 09:08 PM
|
|
Free Member
|
|
Join Date: Sep 2020
Location: Perth, Western Australia
Posts: 672
Thanked 129 Times in 116 Posts
|
|
Quote:
Originally Posted by iseevisions
..I also noticed that the DV rec has only 32Khz audio, which is a bit crappy... Should I convert it to 48Khz AAC in MP4 or leave it 32Khz?
|
It helps to relate these abstract numbers to actual sound in the real world. The camera's original audio sample rate determines only the upper frequency limit which at 32 kHz sample rate is around 15 kHz, higher than many people can hear, and probably higher than anybody over 50 will ever hear. Professional FM radio has the same upper limit of around 15 kHz.
As to the audio recording of the speaker onstage it's typical of an amateur recording with a "from the audience" camera and onboard mic. That's the basic limitation here, not the audio sample rate.
Converting to 48 kHz sample rate wont bring back audio between 15 kHz and 23 kHz which was never recorded, and even if it could, it would make essentially no difference.
|
12-01-2024, 02:50 AM
|
|
Free Member
|
|
Join Date: Feb 2022
Posts: 118
Thanked 31 Times in 28 Posts
|
|
Quote:
What syntax did you use for these?
|
I used 0.85
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=0.85)[/code]
|
12-01-2024, 01:34 PM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by timtape
The camera operator either didnt notice or for whatever reason didnt do anything about it.
|
I did not shoot this myself but I assume the camera was just set to "AUTO" and the operator didn't know better or did not bother.
The overexposed face part is also a small portion of the full recording, I just chose this part deliberately to upload here because the face isn't recognizable
Quote:
Originally Posted by timtape
Converting to 48 kHz sample rate wont bring back
|
I don't mind the 15Khz limit, only am worried about possible player compatibility issues. Is 32Khz (instead of the "standard" 48Khz) AAC with H264 inside .mp4 playable everywhere?
Quote:
Originally Posted by Selur
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
|
Converting to RGB? I thought that was a "no-no" for these types of video?
Also then I have to do something like this now to convert it back to YUV for the next processes in line:
Code:
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=0.85)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="limited")
Can you also share the others because did you use avisynth or vapoursynth, these often have different plugins?
|
12-02-2024, 06:41 AM
|
|
Free Member
|
|
Join Date: Feb 2022
Posts: 118
Thanked 31 Times in 28 Posts
|
|
Without BasicVSR++ on the chroma:
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# loading plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libsangnom.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import mvsfunc
import chromashift
import havsfunc
import validate
# Source: 'C:\Users\Selur\Desktop\test.avi'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg, format: DV
# Loading C:\Users\Selur\Desktop\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/test.avi", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: bottom field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_BOTTOM) # bff
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 50
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# adjusting color space from YUV420P8 to RGB24 for vsLevels
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
# adjusting color using Levels on RGB24 (8 bit)
clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=0.85)
# adjusting color space from RGB24 to YUV444P16 for vsChromaShiftSP
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
# Chroma adjustment using ChromaShiftSP
clip = chromashift.ChromaShiftSP(clip=clip, X=-1.50, jeh=False)
# applying anti aliasing using santiag
clip = core.std.FlipVertical(clip)
clip = havsfunc.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True)
clip = core.std.FlipVertical(clip)
# adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
# set output frame rate to 50fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
# output
clip.set_output()
with BasicVSR++ applied on the chroma:
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# loading plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libsangnom.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import mvsfunc
import chromashift
import havsfunc
import validate
# Source: 'C:\Users\Selur\Desktop\test.avi'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg, format: DV
# Loading C:\Users\Selur\Desktop\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/test.avi", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: bottom field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_BOTTOM) # bff
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 50
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# adjusting color space from YUV420P8 to RGB24 for vsLevels
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
# adjusting color using Levels on RGB24 (8 bit)
clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=0.85)
# adjusting color space from RGB24 to YUV444P16 for vsChromaShiftSP
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
# Chroma adjustment using ChromaShiftSP
clip = chromashift.ChromaShiftSP(clip=clip, X=-1.50, jeh=False)
clipMerge = clip
# adjusting color space from YUV444P16 to RGBH for vsBasicVSRPPFilter
clipMerge = core.resize.Bicubic(clip=clipMerge, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
# Quality enhancement using BasicVSR++
from vsbasicvsrpp import basicvsrpp as BasicVSRPP
clipMerge = BasicVSRPP(clip=clipMerge, model=4)
clipMerge = core.resize.Bicubic(clip=clipMerge, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
clip = core.std.Merge(clip,clipMerge,[0, 1, 1]) # merge filtered and unfiltered by plane
# applying anti aliasing using santiag
clip = core.std.FlipVertical(clip)
clip = havsfunc.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True)
clip = core.std.FlipVertical(clip)
# adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
# set output frame rate to 50fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
# output
clip.set_output()
in both cases I did not apply any denoising.
Cu Selur
|
The following users thank Selur for this useful post:
iseevisions (12-02-2024)
|
12-12-2024, 02:01 PM
|
|
Free Member
|
|
Join Date: Nov 2023
Posts: 49
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by Selur
BasicVSR
|
Is BasicVSR (which uses GPU cuda/opencl) also very slow in your setup?
I'm playing with your config and using BasicVSR (this line to be specific: clipMerge = BasicVSRPP(clip=clipMerge, model=4) ), it runs 1 full minute on the same test.avi, versus only 6 seconds if disabled...
My GPU = nvidia 1080ti
For other comparison, my own old config including upscaling + encoding is only 2 seconds.
Last edited by iseevisions; 12-12-2024 at 02:56 PM.
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Is this aliasing?
|
JACFIS |
Encode, Convert for discs |
0 |
01-06-2022 01:45 PM |
Upscaling VHS before or after capture, which is best?
|
BIGMEDIADINO |
Capture, Record, Transfer |
3 |
10-23-2020 12:51 PM |
VHS upscaling to HD?
|
waloshin |
Capture, Record, Transfer |
5 |
06-10-2019 03:16 PM |
Anti-Aliasing Jaggies on chalk lines of race track with Avisynth?
|
VideoFanatic |
Restore, Filter, Improve Quality |
1 |
01-23-2014 11:02 PM |
Wanted to buy Blu-ray player for upscaling VHS
|
Giana |
Capture, Record, Transfer |
2 |
01-08-2013 11:59 PM |
Thread Tools |
Search this Thread |
|
|
All times are GMT -5. The time now is 02:34 PM
|