Quantcast Removing green tint on VHS? - digitalFAQ Forum
  #1  
05-19-2020, 02:30 PM
JACFIS JACFIS is offline
Premium Member
 
Join Date: Jul 2018
Posts: 11
Thanked 1 Time in 1 Post
Hi everyone,
I want to improve this video clip.
It was taken with a tube camera (Panasonic VK744-C ) connected to a portable VHS (Panasonic 5751-K) witch i can put on a docking station (Panasonic VA556-K ),
My capture rig: Pana AG 1960 / DMR-ES15 / AVT 8710(green) /AIW 9600 AGP on win XP sp2.
The clip was captured with VirtualDub with histogram levels within 'safe' 15-235 region.
This camera often show a green corner in bottom left section, see image. Is there a way to correct? if not i will have to live with.
The joined video show many problems.
Low light conditions and image is noisy. Can we reduce noise.
At left, we see a band, i guess i will have to cut, no way to restore.
The whole image has a green tint, can it be improved?
This clip is shaking , what are the options to stabilize the images?

If you have any suggestion, pertaining to the process order ( do we treat noise before chroma etc.) they are welcome.

Last, source is VHS and i intend to transfer on DVD 4:3 ntsc.
Regards


Attached Images
File Type: png Left-bottom-green(64208)_tube_camera.png (432.9 KB, 20 downloads)
Attached Files
File Type: avi VHS-CoupeAGP2-nron-2020.00.00.avi (85.57 MB, 4 downloads)

Last edited by JACFIS; 05-19-2020 at 02:36 PM. Reason: Attatchment not seen.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
05-19-2020, 05:03 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,185 Times in 957 Posts
Thanks for the sample, but it's been processed. If you captured to RGB you made a mistake that's difficult to correct. You could also have a longer sample but as RGB the file is 3 times bigger than it should be as losslessly compressed YUY2.
Reply With Quote
  #3  
05-19-2020, 06:25 PM
JACFIS JACFIS is offline
Premium Member
 
Join Date: Jul 2018
Posts: 11
Thanked 1 Time in 1 Post
Sanlyn,
I'm new to Virtualdub. attatchement show the MediaInfo result of the source avi.
If my source is uncompressed, how to extract under a lossless file.
Sorry for my bad english.


Attached Images
File Type: jpg MediaInfo.JPG (72.0 KB, 64 downloads)
Reply With Quote
  #4  
05-19-2020, 06:49 PM
JACFIS JACFIS is offline
Premium Member
 
Join Date: Jul 2018
Posts: 11
Thanked 1 Time in 1 Post
Sanlyn, i found the answer in another post, replied by you.
However, VirtualDub in "full processing mode" saves as uncompressed RGB by default. So the resulting video is not huffyuv compressed and will be be pretty large. Change your "Video" menu setting from "full processing mode" to "direct stream copy" after making your cut and before saving the AVI, in order to get a smaller huffyuv video.
I extractred another clip in direct stream copy. See the joined video.


Attached Files
File Type: avi VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi (17.35 MB, 6 downloads)
Reply With Quote
  #5  
05-20-2020, 04:47 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,185 Times in 957 Posts
Quote:
Originally Posted by JACFIS View Post
This camera often show a green corner in bottom left section, see image. Is there a way to correct? if not i will have to live with.
Most of the time you have to live with that sort of thing. Sometimes denoising can reduce it. The more you work against it, the more damage it creates.

Quote:
Originally Posted by JACFIS View Post
At left, we see a band, i guess i will have to cut, no way to restore.
You can crop away some of the band. I'd leave the remainder as it is. It's not likely to be noticed.

Quote:
Originally Posted by JACFIS View Post
This clip is shaking , what are the options to stabilize the images?
It's not shaking. It's swaying and swerving and panning around too much. You don't have enough video length in the samples to justify stabilizing, you'll have to work with more than just a few seconds or it won't make sense. You'll have to learn to use VirtualDub's DeShaker plugin which works with this sort of wide camera motion. Run it after color correction. Expect to lose part of the picture around the borders. You'll have to readjust borders afterward with VirtualDub's BorderPatrol plugin.
-- DeShaker home page & tutorials: https://www.guthspot.se/video/deshaker.htm
-- VirtualDub BorderPatrol plugin: https://sourceforge.net/projects/bor...atest/download

Quote:
Originally Posted by JACFIS View Post
If you have any suggestion, pertaining to the process order ( do we treat noise before chroma etc.) they are welcome.
Usually, signal levels are corrected first. It's difficult to correct color when bad levels and noise cause confusion. in this case the first colorspace has been damaged and can't be reversed, so I'll have to correct some levels flaws first. This requires working in Avisynth and YUV for initial corrections. You can't correct it in RGB alone. Your earlier RGB conversion has made the first sample complicated.

Quote:
Originally Posted by JACFIS View Post
attatchement show the MediaInfo result of the source



That picture is not a MediaInfo report. It's an image of the front info page and contains very little useful information.

In MediaInfo click on the top menu "View" item, then select "text" from the drop-down menu. Select the text that displays and copy it to the clipboard. You can paste that entire text into a forum post.

Below is the MediaInfo report on your second .avi sample. It is huffYUV YUY2.

Code:
General
Complete name                            : I:\forum5\faq\JACFIS\VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 17.3 MiB
Duration                                 : 2s 503ms
Overall bit rate                         : 58.1 Mbps
Writing library                          : VirtualDub build 32842/release

Video
ID                                       : 0
Format                                   : HuffYUV
Format version                           : Version 2
Codec ID                                 : HFYU
Duration                                 : 2s 503ms
Bit rate                                 : 56.6 Mbps
Width                                    : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 3:2
Frame rate                               : 29.970 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Scan type                                : Interlaced
Bits/(Pixel*Frame)                       : 5.462
Stream size                              : 16.9 MiB (97%)

Audio
ID                                       : 1
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : 1
Duration                                 : 2s 502ms
Bit rate mode                            : Constant
Bit rate                                 : 1 536 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Stream size                              : 469 KiB (3%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 54 ms (1.63 video frames)
Interleave, preload duration             : 1000 ms
Quote:
Originally Posted by JACFIS View Post
If my source is uncompressed, how to extract under a lossless file.
how to make lossless samples - how to post Mediainfo text


Quote:
Originally Posted by JACFIS View Post
Sanlyn, i found the answer in another post, replied by you.
However, VirtualDub in "full processing mode" saves as uncompressed RGB by default. So the resulting video is not huffyuv compressed and will be be pretty large. Change your "Video" menu setting from "full processing mode" to "direct stream copy" after making your cut and before saving the AVI, in order to get a smaller huffyuv video.
That's not the way it works. You have it in reverse and don't understand it. The idea is to avoid RGB conversion before YUV corrections are made. Once YUV goes into RGB, It's too late for that. As it is, your second sample is lossless huffyuv Compressed YUY2 whether you realize or not. You must have saved the second sample using "direct stream copy", which keeps the original colorspace and compression properties.

In your work you will also need to save files occasionally as YV12. Huffyuvv cannot compress YV12. For that you will need Lagarith, which has a very easy and simple installer. Lagarith makes slightly smalller files than huffyuv. It can compress YV12, YUY2, RGB24, and RGB32. https://lags.leetcode.net/codec.html

The images below are samples of corrections and denoising I managed. I joined both video samples. A video result is atttached as VHS1_and_2_DVD.mpg.




Scripts were opened in VirtualDub, and VirtualDub filters were applied to the Avisynth output while was the script was running. The filters used are described below the scripts.

Script for VHS-#1 (change the path statements to show file locations in your system) :

Code:
AviSource("D:\\VHS-CoupeAGP2-nron-2020.00.00.avi")
ConvertToYUY2(interlaced=true)
ColorYUV(cont_y=40,gamma_y=20,off_y=-15,off_u=5)
Tweak(sat=1.5,dither=true,coring=false)
ConvertToYV12(interlaced=true)
ContrastMask2(enhance=3.0)
###Histogram("Levels")   #<- for testing only
SeparateFields()
dfttest(sigma=24)
TemporalSoften(4,4,8,15,2)
Sharpen(0.2,0.3)
Weave()
###---Lines below for VirtualDub filters and border fixes---###
ConvertToRGB32(interlaced=true)
Crop(16,0,0,-12).AddBorders(8,6,8,6)
return last

#-----
function ContrastMask2(clip v, float "gblur", float "enhance")
{
enhance = default (enhance, 10.0)
enhance = (enhance>=0.0 && enhance<=10.0) ? float(enhance*0.1) : 1.0
v2=v.Tweak(sat=0)
v2=v2.invert()
v2=v2.blur(1.58,1).blur(1.58,1).blur(1.58,1)
photoshop_overlay=mt_lutxy(v,v2,"x 127.5 > y 255 x - 127.5 / * x 255 x - - + y x 127.5 / * ? ")
merged=overlay(v,photoshop_overlay,opacity=enhance)
return merged
}
Script for VHS-#2:

Code:
AviSource("D:\\VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi")
ColorYUV(cont_y=40,gamma_y=20,off_y=-15,off_u=5)
Tweak(sat=1.5,dither=true,coring=false)
ConvertToYV12(interlaced=true)
ContrastMask2(enhance=3.0)
###Histogram("Levels")   #<- for testing only
SeparateFields()
dfttest(sigma=24)
TemporalSoften(4,4,8,15,2)
Sharpen(0.2,0.3)
Weave()
###---Lines below for VirtualDub filters and border fixes---###
ConvertToRGB32(interlaced=true)
Crop(16,0,0,-12).AddBorders(8,6,8,6)
return last

#-----
function ContrastMask2(clip v, float "gblur", float "enhance")
{
enhance = default (enhance, 10.0)
enhance = (enhance>=0.0 && enhance<=10.0) ? float(enhance*0.1) : 1.0
v2=v.Tweak(sat=0)
v2=v2.invert()
v2=v2.blur(1.58,1).blur(1.58,1).blur(1.58,1)
photoshop_overlay=mt_lutxy(v,v2,"x 127.5 > y 255 x - 127.5 / * x 255 x - - + y x 127.5 / * ? ")
merged=overlay(v,photoshop_overlay,opacity=enhance)
return merged
}
Filters used:

-- AviSource(), opens files. Avisynth built-in. http://avisynth.nl/index.php/AviSource

-- ConvertoYUY2/YV12/RGB32: Avisynth built-in.http://avisynth.nl/index.php/Convert

-- ColorYUV(), color control. Avisynth built-in. http://avisynth.nl/index.php/ColorYUV
---- "cont_y" = Y channnel contrast, "gamma_Y" Y-channel midtone gamma, "off_y" = Y-channel luminance offset, "off_u" = u (blue) channel offset. See COLORYUV documentation for more notes.

-- Tweak() for saturation. Avisynth built-in. http://avisynth.nl/index.php/Tweak

-- The ContrastMask function requires MaskTools2, Avisynth external plugin: MaskTools2 2.2.18, http://avisynth.nl/index.php/MaskTools2

-- Histogram (testing line only, disabled with character "#" marks): Avisynth internal filter: http://avisynth.nl/index.php/Histogram
-- SeparateFields(), Avisynth built-in.http://avisynth.nl/index.php/SeparateFields

-- dfttest, Avisynth external plugin. & Supported files. Very important and valuable denoiser, http://avisynth.nl/index.php/Dfttest. Be sure download all the supporting files and follow simple instructions. Download all to a separate folder -- don't download directly to the plugins folder. Extract the required files and copy only the plugins into the plugins folder.

-- TemporalSoften, Avisynth built-in. http://avisynth.nl/index.php/Soften\


-- Sharpen, opposite of blur, Avisynth built-in.http://avisynth.nl/index.php/Blur

-- Weave, Avisynth built-in. http://avisynth.nl/index.php/Weave

-- Crop (remove unwanted borders) & AddBoreders (replace removed borders). Avisynth built-ins. http://avisynth.nl/index.php/Crop, http://avisynth.nl/index.php/AddBorders

-- function ContrastMask2, a special internal function written for this coded cleanup. It can be used in other scripts, just copy the block of text to the bottom of a script. Copy from the word "function" to the last "}" mark at the end of the text.

VirtualDub filters used:
------------------------
VirtualDub color filters were loaded in VDub's filter window and applied to the output of the script after activating "Save Avi...". The filters and settings are saved in a .vcf file to automatically load the filters and their settings. The .vcf file is attached as "VirtualDub_Settings.vcf". Download the .vcf and save it to your video project files -- do not load it into VirtualDub's plugins folder. When you are ready to use the filters Click "File..." -> then "Load processing setttings", locate the .vcf, and click "Open". The filters will load and you can view them to see how they are configured.

The filters used were "ColorCamcorderDenoise (ccd17.vdf)"
(http://www.digitalfaq.com/forum/atta...1&d=1544578132), and ColorfMil2.1.vdf (http://www.digitalfaq.com/forum/atta...colormill21zip). ColortMill was used to tweak the YUV color work and to add overall cyan (blue and red) balance and midrange brilliance, and to correct the blacks and darker colors in the image. Unfortunately VirtualDub has no effective denoisers for the noise in these clips; they are either ineffective or would make it look worse.

If you're going to work with muddy home video from budget cameras and poor light it takes a lot of work to clean a lot of problems.


Attached Images
File Type: jpg sample corrections 1.jpg (63.9 KB, 67 downloads)
File Type: jpg sample corrections 2.jpg (62.1 KB, 63 downloads)
Attached Files
File Type: mpg VHS1_and_2_DVD.mpg (3.84 MB, 1 downloads)
File Type: vcf VirtualDub_Settings.vcf (980 Bytes, 2 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: JACFIS (05-21-2020)
  #6  
05-21-2020, 02:01 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,185 Times in 957 Posts
Here is another way of processing your YUY2 sample, with some details on what some of the YUV and RGB settings are trying to accomplish. The corrections were determined one at a time. At first they were measured on a histogram.

The image below is the original frame 40 from you #2 sample. The black borders are removed to keep them from affecting the histogram attached to the right side of the image. The image is slightly reduced.


In the right-hand YUV histogram above, notice the white bar across the top of the small chart. This indicates the luminance levels. White data to the left of the bar shows darks. The middle of the horizontal bar is the midrange tones, the right-hand side is the brights. The image looks foggy because there are no dark colors in the image. We would say that the black level is too high, toward the middle of the spectrum.

Here is the Avisynth script that opened the clip, cropped off the borders, and added the histogram:

Code:
AviSource("J:\forum5\faq\JACFIS\B\VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi")
Crop(16,0,0,-16)
ConvertToYV12(interlaced=true)
Histogram("Levels")   #<- for testing only
return last
The first thing to do is spread the contrast and make the black levels look more realistic. You can spread out the black levels and brights by using ColorYUV's contrast filter. In doing so you have to keep the white band within the inside borders of the histogram. There should be no overflow into the shaded side borders.

To do that some ColorYUV settings are added to the script and modified until we have what we want, and the changes are viewed on the histogram.





Code:
AviSource("J:\forum5\faq\JACFIS\B\VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi")
Crop(16,0,0,-16)
ColorYUV(cont_y=40,gamma_y=20,off_y=-15,off_u=5)
ConvertToYV12(interlaced=true)
Histogram("Levels")   #<- for testing only
return last
Notice how the histogram has changed. the image has more snap and depth now. Y-channel luminance has been expanded with "Cont_Y=40" in both directions. Things are still dim, but that can be fixed. Gamma has kept up some midrange tones in the darker portions, "off_y=-15" has moved all the colors toward the left to keep the brightest points within the y=16-235 range, and "off_u=5" has given blue a slight boost. You can't push blue very far in this clip because all the dark colors will turn blue.

Now, to modify these results:....
Code:
AviSource("J:\forum5\faq\JACFIS\B\VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi")
Crop(16,0,0,-16)
ColorYUV(cont_y=40,gamma_y=20,off_y=-15,off_u=5)
Tweak(sat=1.5,dither=true,coring=false)
Levels(10,0.95,255,16,255,dither=true,coring=false)
ConvertToYV12(interlaced=true)
Histogram("Levels")   #<- for testing only
return last


While the slight changes might not look like much, it is subtle in the shadows and color has been pumped with Tweak() to clarify objects a little more. The Levels() filter raises the darkest shadows slightly from about 10 to 16 in the statement that begins "Levels(10,0.95,255,16,255". The rest is up to VirtualDub. The script disables lines that are no longer used by preceding the unwanted lines with "###" character marks to turn them into comments instead of code. The clip is then opened directly in VirtualDub -- a formal RGB conversion and border fixes will be done later, after denoising. "Return last" is used to stop the script and return the results of processing so far.

Code:
AviSource("J:\forum5\faq\JACFIS\B\VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi")
### Crop(16,0,0,-16)     #<- for testing only
ColorYUV(cont_y=40,gamma_y=20,off_y=-15,off_u=5)
Tweak(sat=1.5,dither=true,coring=false)
Levels(10,0.95,255,16,255,dither=true,coring=false)
ConvertToYV12(interlaced=true)
###Histogram("Levels")   #<- for testing only
return last
Below, frame 40 in VirtualDub being color corrected with ColorMill. The panel shown is adding midrange blue and slightly reducing midrange green. Other ColorMill sliders and panels increased midrange brightness and opened shadow detail a little more.




A recent personal user's guide to using ColorMill that may be helpful:How ColorMill filter for VirtualDub works.

One change in Avisynth that will simplify denoising is to replace dfttest with another favorite plugin, which someone on doom9 modified and called MDG2. The name is shorthand for "MVDegrain2", which is a function in the mvtools2 plugin. MVtools2 is used inside many other filters as well. The .dll filter comes in a zip package with documentation in a subfolder. Download it at http://www.avisynth.nl/users/fizick/...v2.5.11.22.zip. It is a 32-bit filter. Download the zip file into a separate folder somewhere on your PC -- don't download it directly into plugins. Unzip the package in its own folder and copy only mvtools2.dll into your plugins folder. There are also subfolders with extensive documentation, and even mnore on mvTools2's home wiki page at http://avisynth.nl/index.php/MVTools.

MDG2.avs is a scripted avs filter. As text it must be imported from plugins into your script. You do that with the Import() function. The statement to bring the text of the filter into your code at runtime is "Import("D:\Avisynth 2.5\plugins\MDG2.avs". Change the path statement to point to the location of your plugins folder. The Import statement is explained at http://avisynth.nl/index.php/Internal_functions#Import.

Code:
Import("D:\Avisynth 2.5\plugins\MDG2.avs")
AviSource(vidpath+"VHS-CoupeAGP2-nron-2020-YUV2.00-75362.avi")

###Crop(16,0,0,-16)      #<- for testing only
ColorYUV(cont_y=40,gamma_y=20,off_y=-15,off_u=5)
Tweak(sat=1.5,dither=true,coring=false)
Levels(10,0.95,255,16,255,dither=true,coring=false)
ConvertToYV12(interlaced=true)
###Histogram("Levels")   #<- for testing only
###return last

SeparateFields()
MDG2()
TemporalSoften(4,4,8,15,2)
Sharpen(0.2,0.3)
Weave()
###---Lines below for VirtualDub filters and border fixes---###
ConvertToRGB32(interlaced=true)
Crop(16,0,0,-12).AddBorders(8,6,8,6)
return last
The image below is frame 40 after YUV and RGB corrections, plus denoising and border fixes:





VirtualDub settings used are saved as a.vcf file *(attached). The filters used were ColortCamCorderDenioise, ColorMill, and VirtualDub's built-in temporal smoother.

If you want anything cleaner or sharper than this, you'll have to learn to use prime deinterlacers/cleaners like QTGMC. https://forum.doom9.org/showthread.php?t=156028


Attached Images
File Type: jpg A original frame 40 and YUV.jpg (75.5 KB, 60 downloads)
File Type: jpg B frame 40 after ColorYUV.jpg (81.1 KB, 61 downloads)
File Type: jpg C frame 40 after Tweak and Levels.jpg (84.0 KB, 60 downloads)
File Type: jpg D frame 40 with ColorMill preview.jpg (152.0 KB, 62 downloads)
File Type: jpg E frame 40 completed.jpg (71.4 KB, 62 downloads)
Attached Files
File Type: vcf VirtualDub_Settings.vcf (1.1 KB, 4 downloads)
File Type: mpg VHS2_for_DVD.mpg (1.64 MB, 3 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: JACFIS (05-22-2020)
  #7  
05-22-2020, 07:33 PM
JACFIS JACFIS is offline
Premium Member
 
Join Date: Jul 2018
Posts: 11
Thanked 1 Time in 1 Post
Thanks Sanlyn,
Result is far better than what i expected from that bad clip.
Your reply are always well explained and documented i grant you for that.
I am not english speaking, so if i use the wrong terminology, correct me and this will help me to search in the forum.
I am checking my capture hardware and VirtualDub configuration setting to make sure i have everything right before capturing again.
I am searching informations about colorspace and how to use Histograms. Like: A&E's Technical Guides to All Things Audio and Video (v3) and infognition. I believe taht when you understand, you can correect better than going by trial and error with no understanding.
Documentation form filters and plugins will be very helpfull too.
Video restoration is new to me and i hope to be able to improve my home videos by myself.
Reply With Quote
  #8  
05-22-2020, 08:37 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,185 Times in 957 Posts
Restoration and filters are difficult in the beginning because you don't know where you're going at first. But with practise and patience you find the way, sometimes quickly. Filter documentation can be difficult, but don't try to be an engineer. Just look for the central idea of what the filter is supposed to do. Studying color and histograms is free on internet photo sites.

This website is in English but perhaps the images will help:
CAMERA HISTOGRAMS: TONES & CONTRAST: https://www.cambridgeincolour.com/tu...istograms1.htm
CAMERA HISTOGRAMS: LUMINOSITY & COLOR: https://www.cambridgeincolour.com/tu...istograms2.htm
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
PAL60 capture, intermittent greenish tint? whysleep Capture, Record, Transfer 4 03-24-2020 08:51 PM
Removing flicker from VHS tapes? hysteriah Restore, Filter, Improve Quality 2 02-26-2020 05:15 AM
Removing ghosting from commercial DVD? meeshu Restore, Filter, Improve Quality 6 12-02-2016 07:47 PM
How to remove redness from picture - Fix color cast or tint problem admin Photo Processing, Scanning & Printing 1 01-23-2011 05:44 PM
Removing broadcast hum from TV recordings? Reading Bug Restore, Filter, Improve Quality 5 08-19-2010 04:04 PM

Thread Tools



 
All times are GMT -5. The time now is 08:49 PM