First of all I would like to thank you all for your contributions. I've recently embarked on a rather large project to digitize my VHS and 8mm tape collection and I've learned a ton from reading these forums, especially from posts by lordsmurf and lollo.
I've tried a bunch of capture cards from Amazon but had various issues with each.. some tracked well but output was very grainy video, others had good quality video but did not track causing dropped frames and/or AV sync issues. I finally tried my old Sony DV camcorder and it seems to do the best job of tracking while still producing a decent picture, and most of all, keeping video and audio in sync which became a huge issue with some other capture devices. I unfortunately do not have access to a TBS device and although I own a JVC HR-S7600U with TBS, it only worked for one tape and now suffers from the famous shutdown issue whenever I load a tape. I'm therefore stuck using my old Hitachi VCR as the source, which actually produces a decent picture albeit only over composite output.
Anyways, I'm now able to capture and output to MP4 with good results, however my last remaining issue is this.. how can I improve the color in my final video? When I run the AviSynth+ script through FFmpeg the colors are altered.. the resulting video is different than in the AvsPmod preview. I've pulled my hair out trying to figure out why. What am I doing wrong?
I've attached a short sample AVI video along with my AviSynth+ script (much of it based on samples provided by @lollo5468 on YouTube). How would you improve the colors in the final video by modifying my script? The reds are kind of intense yet the video seems washed out and somewhat dull overall. I'm reducing RGB values by about 10% in the Matrix function as otherwise the whites are completely blown off the scale. FFmpegSource2 seems to bring in full range values vs AVISource which brings limited range. When Frame Serving from VirtualDub I have to use AVISource, finally figured out I can fix this variance by setting Matrix values a=16, b=235 instead of a=0, b=255.
I want to upload the final to YouTube hence I'm up-scaling to 1080p and changing color profile to Rec.709.
This is the FFmpeg command I use to create the final MP4. I've tried to hard code bt709 color space as otherwise FFmpeg for some reason defaults to something else and the end result looks worse.
For a serious color correction task, AviSynth has limited feature, you may want to try someting like DaVinci Resolve.
However, find thereafter a quick attempt from my side on your video. Always check the levels and the right colorspace when moving inside AviSynth and feeding VirtualDub. It's easy to introduce errors.
The script, based just on level correction, marginal color correction through saturation and contrast, deinterlace, denoise and upscale; splitted in 3 parts to speed-up processing time:
Code:
video_org=DirectShowSource("street.avi")
# separate fields tff
video_org_sep_tff=video_org.AssumeTFF().separateFields()
# separate fields bff
video_org_sep_bff=video_org.AssumeBFF().separateFields()
# separate fields tff even
video_org_sep_tff_even=video_org_sep_tff.SelectEven()
# separate fields tff odd
video_org_sep_tff_odd=video_org_sep_tff.SelectOdd()
# to check if progressive or interlaced
#return(video_org_sep_tff)
#return(video_org_sep_bff)
# to check if TFF or BFF for interlaced segments
#stackhorizontal(\
#subtitle(video_org_sep_tff,"video_org_sep_tff",size=28,align=2),\
#subtitle(video_org_sep_bff,"video_org_sep_bff",size=28,align=2)\
#)
# cropping
crop_left=4 # | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto
crop_top=2 # | 720-(4+8)x480-(8+8)=708x470
crop_right=8
crop_bottom=8
video_org_crop=video_org.crop(crop_left,crop_top,-crop_right,-crop_bottom)
# convert to YV16 (required for Histogram)
video_org_crop_yv16=video_org_crop.ConvertToYV16()
# analysis
video_histogram=video_org_crop_yv16.Histogram("Levels")
#return(video_histogram)
# plugins directory
plugins_dir="C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters\"
# LevelsLumaOnly
Import(plugins_dir + "LevelsLumaOnly_modGMa.avsi")
### levels and colors correction
noise_baseclip=video_org_crop.\
ColorYUV(cont_y=0,off_y=0,off_v=0,off_u=0).\
Tweak(cont=0.9,sat=1.2,bright=0,dither=true,coring=false).\
LevelsLumaOnly(16,1.05,255,16,235,dither=true,coring=false)
noise_baseclip_addborders=noise_baseclip.addborders(crop_left,crop_top,crop_right,crop_bottom)
#stackhorizontal(\
#interleave(\
#subtitle(video_org,"video_org",size=28,align=2),\
#subtitle(noise_baseclip_addborders,"noise_baseclip_addborders",size=28,align=2)\
#)
#return(noise_baseclip_addborders)
# QTGMC
Import(plugins_dir + "QTGMC.avsi")
# Zs_RF_Shared
Import(plugins_dir + "Zs_RF_Shared.avsi")
# TemporalDegrain2
Import(plugins_dir + "TemporalDegrain-v2.2.1_modGMa.avsi")
# RgTools
loadPlugin(plugins_dir + "RgTools-v1.0\x86\RgTools.dll")
# MaskTools2
loadPlugin(plugins_dir + "masktools2-v2.2.23\x86\masktools2.dll")
# MVTools
loadPlugin(plugins_dir + "mvtools-2.7.41-with-depans20200430\x86\mvtools2.dll")
# FFT3DFilter
loadPlugin(plugins_dir + "FFT3dFilter-v2.6\x86\fft3dfilter.dll")
# FFTW
loadPlugin(plugins_dir + "LoadDll\LoadDll.dll")
loadDll(plugins_dir + "fftw-3.3.5-dll32\libfftw3f-3.dll")
# LSFmod
Import(plugins_dir + "LSFmod.v1.9.avsi")
# RgTools
#loadPlugin(plugins_dir + "RgTools-v1.0\x86\RgTools.dll")
# MaskTools2
#loadPlugin(plugins_dir + "masktools2-v2.2.23\x86\masktools2.dll")
# ColorMatrix
LoadPlugin(plugins_dir + "ColorMatrix\ColorMatrix.dll")
# Nnedi3
loadPlugin(plugins_dir + "NNEDI3_v0_9_4_55\x86\Release_W7\nnedi3.dll")
### de-interlacing
deinterlaced=noise_baseclip.AssumeBFF().QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
return(deinterlaced)
Wow thank you so much lollo2, this is amazing, thank you for sharing your special scripts! I'm going to have to spend some time analyzing what these scripts actually do, but really impressed with how you managed to bring out the colors in the final video.. the sky is blue, red is much more red.. wow!
I figured out my main issue.. audio and video not being in sync. It was all due to using FFmpegSource2() to open my source AVI vs using AviSource(). I originally could not use AviSource() due to it not reading HuffYUV but I figured out how to solve that by installing the 64-bit version of HuffYUV. Now AviSource() can open my captured AVI files directly and there are no more AV sync problems in the final MP4.
This means I can use my StarTech USB3HDCAP capture device and AmaRecTV again vs having to use the Sony DV camcorder pass-though for captures. Comparing the two, the StarTech produces far better colors than the DV camcorder, although it does skip/add a few frames here and there as I don't have a TBC. But I'm OK with a few hiccups in video as now the AV stays in sync. Using the DV camcorder in pass-through caused a lot of white clipping and washed our colors as per my original post, which can be fixed as you demonstrated, but not needed when using the USB3HDCAP.
I have been running FFmpeg all day today on my i9 processor and already produced many hours of very nice looking MP4 videos. Finally I can start going through and processing my VHS collection.
I've attached the same scene as captured with the StarTech USB3HDCAP along with a few screenshots showing the raw AVI files and how different the colors are. The DV camcorder really blows out the whites and changes the sky.
lollo2 I see in one of your YouTube videos that you use the Hauppauge WinTV-Live 2 (USB-Live 2, model 1341) capture device? I purchased one from Amazon but found it was terrible compared to the StarTech. Perhaps the "new" models are not the same as what you have? Basically found the input looked skewed and frames were not steady, the captured video was basically jumping around. Again I don't have a TBC and perhaps this capture device really needs one, but still wasn't impressed, had to return the USB-Live 2. I did buy a Diamond VC500 to test, will report on how it works out.
It was all due to using FFmpegSource2() to open my source AVI vs using AviSource()
For AVI files you should always use AviSource(), which requires the specific codec to be installed. Even DirectShowSource() is not as precise.
FFmpegSource() is designed for mpeg2/mpeg4 files. It is not frame accurate for other codecs.
When in doubt, use a filter doing a prior indexing of the video, such as LSMASHVideoSource or LWLibavVideoSource. It takes sometime, and creates an additional file, but it is then frame accurate.
Quote:
I can use my StarTech USB3HDCAP capture device and AmaRecTV
AmarecTV is excellent when using capture card with integrated audio/video inputs, while VirtualDub was (long time ago) designed to keep in synch streams coming from 2 different cards, and sometimes it suffers with modern hardware. I always use AmarecTV.
Quote:
the StarTech produces far better colors than the DV camcorder
A lossless YUV 4:2:2 capture is always better for an analog signal than a DV compressed capture, especially if you plan to perform a post-processing.
Quote:
which can be fixed as you demonstrated, but not needed when using the USB3HDCAP.
It is always better to start from the best possible capture, reducing the filtering to the minimum needed. There is always a trade-off when you denoise/sharpen/etc. and you may introduced new (different) artifacts. Sometimes is not detectable, sometimes is evident.
Quote:
Hauppauge USB-Live 2 ... Perhaps the "new" models are not the same as what you have?
There are no new models, this is a myth. The card is always the same, with the same internal hardware, well documented. The requiment of this card is a lineTBC correction (inside the player, or with a DVD-R recorder in pass-through mode) because it can't correct horizzontal jitter, and a Y/C input, because its internal comb filter is poor. When used under these condition, this card is excellent, otherwise is not. In my world there is no room for a capture without Y/C and lineTBC correction, so the problem does not arise.
Quote:
I did buy a Diamond VC500 to test, will report on how it works out.
The VC500 shares the same video chip (Conexant CX23102) as the Hauppauge USB-Live, then is prone to the same requirements. But the other ICs are different, so it may or may not behaves better in not optimal conditions. Again, the key points for a good capture are the condition of the tapes and the player. Start form the best possible VCR/player as priority #1.
I tried to hook up the Diamond VC500 I purchased but seems the Conexant Polaris CxCVBS.sys driver 7.0.127.7 causes a Windows Security Memory Integrity warning in Windows 11 and it won’t run. Is there a newer driver available somewhere? The Diamond website only has this one available.
One more question if I may? All my captures and resulting videos seem to have this outline around them when there is contrast between objects. In this clip the white t-shirts have this dark outline along the left edges, and the yellow pole has yellow bleeding outside the edges. Is this an issue with my capture setup or just part of how interlaced video behaves? I've tried to reduce sharpening and contrast in the capture driver but that does not seem to help much. Is there a filter in AviSynth you would recommend, or what can I do?
In this post https://forum.videohelp.com/threads/...e4#post2427483 it was mentioned that "The USB3HDCAP's chroma is shifted down by 1 line; this is easily corrected after capture." Any idea if this could be the issue I'm having and if so, how do I shift the chroma up one line?
White halos can be softened with DeHalo_alpha filter or one of its variant. It is a quite destructive filter, so use with caution. In general is better to build a mask to reduce the damages. An example here (without mask); play with the parameters for optimal results:
Removing the black halos is much more complex. I did not succed within a short attempt. You can try using finedehalo2 or YAHR as alternative or together with Dehalo_alpha. Check also videohelp forums for some example.