Go Back    Forum > Digital Video > Video Project Help > Restore, Filter, Improve Quality

Reply
 
LinkBack Thread Tools
  #1  
09-04-2018, 06:17 PM
stevevid stevevid is offline
Free Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 124
Thanked 12 Times in 9 Posts
I have three DV-AVI videos that were given to me that are digitizations of some of my wife's parent's 16mm films from the 1950s and older. I have split the first video into multiple files because the levels varied wildly from scene to scene. Typically, a file holds a whole scene. Sometimes I had to break up a scene into more than one file.

Many of the scenes are badly underexposed. Some looked almost totally black. I have been able to improve many of the issues with the ColorYUV plugin in AviSynth. It was interesting to see that out of the darkest video I could pull out enough information to see people and things that my wife recognized from when she was a kid. The histograms showed almost no data in them. My wife was speechless when she saw people and places she hadn't seen in over 55 years. Here's a big hell yeah to DigitalFAQ for providing the information to make this happen!

There are still issues where the ColorYUV settings work with most of a scene then something changes that drives the white levels into the wall and probably through it. For example, an indoor scene of someone on the floor about 8feet away then someone else walks into view between the camera and the primary subject. The new person is brightly lit because they are closer to the fill light on the camera. The other parts of the image are ok. Is there a way for a script/plugin to automatically and non-linearly control the white level beyond a point such as 220 so the level doesn't hit the wall?

BTW, I used AvsPmod. It helped a lot to see a frame and have histograms for Y, U, and V. I could make script changes then click on the image to update the picture and histograms. I also used multiple tabs where each tab represented different level settings. It was fast and easy to switch between different tabs/approaches and see the effect. I saved a set of tabs for a scene as a named "Session." AvsPmod was awkward at first until I learned to save a session with a name similar to a scene name. I then cleared the tabs showing in AvsPmod before starting a new session or opening an existing session. If you load a session while the tabs from the prior session are still showing, AvsPmod will just add the tabs to the existing tabs.

Thanks!
Steve
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
09-04-2018, 06:26 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Can't offer much advice without an unfiltered sample.

ColorYUV is useful but limited, works best with Avisynth contrast mask filters that help a lot, along with plugins like HDRagc and others.

Automatic? No such thing. But a workable sample would be far more helpful than a long description. The biggest problem with with underexposure is that crushed darks are mostly noise, really tough to clean.
Reply With Quote
  #3  
09-04-2018, 06:27 PM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,363
Thanked 2,434 Times in 2,069 Posts
Not really.
At best, you can try to auto white balance Avisynth filter (in YUY2 colorspace). Results will vary. Try it.

Code:
ColorYUV(autowhite=true) # auto white balance
And I always use AvsPmod, both the x86 and x64 versions (for x86/x64 Avisynth, respectively).

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
  #4  
09-04-2018, 07:28 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Autowhite is the wrong filter for the problem described. It also crushes blacks and blows out highlights.
This is pure blind-shooting guesswork anyway without a sample.
Reply With Quote
  #5  
09-04-2018, 08:36 PM
stevevid stevevid is offline
Free Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 124
Thanked 12 Times in 9 Posts
Here are samples!

The Outside clips are from the same scene. Each clip has a variety of exposures. I adjusted levels for one part which then didn't work at all for another section of the scene.

The snow clip is from Dallas. Yep, we used to get snow every year. Now, not much.

I think the Super Dark Clip came from the Adams Family or Munsters home movies.

At least my VHS captures aren't near as bad as these film videos. Whatever I learn here should go a long way to helping me process the VHS videos.

Thank you very much for your help,
Steve


Attached Files
File Type: avi Outside variable light #1.avi (71.55 MB, 14 downloads)
File Type: avi Outside variable light #2.avi (15.57 MB, 4 downloads)
File Type: avi Snow.avi (594.1 KB, 3 downloads)
File Type: avi Super dark clip.avi (40.07 MB, 4 downloads)
File Type: avi Xmas dark to lighter b.avi (76.01 MB, 3 downloads)
Reply With Quote
  #6  
09-05-2018, 07:52 AM
themaster1 themaster1 is offline
Free Member
 
Join Date: Feb 2011
Location: France
Posts: 481
Thanked 95 Times in 79 Posts
Work with sony vegas that's the best advice i can give. You can work scenes by scenes and use videoscopes (totally needed when you work with such sources). You can also pre process with avisynth

example of 2 scenes i tweaked with sony vegas
https://mega.nz/#!UlxhBYgR!5Vi96Oigk...guroOf_mA5d2jo
Reply With Quote
  #7  
09-05-2018, 09:23 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,363
Thanked 2,434 Times in 2,069 Posts
I use Premiere.
Vegas admirable option.
And then the DaVinci Resolve is now freeware, worth a look.

@themaster1, I really wish you'd attach samples here, 99mb max (plenty enough space for a mere sample). Many of us don't use Mega. At a later date, the file will disappear, and long-term usefulness of the thread is decreased.

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
  #8  
09-05-2018, 01:47 PM
stevevid stevevid is offline
Free Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 124
Thanked 12 Times in 9 Posts
themaster1, thank you for the reference to Sony Vegas. I'll take a look. Also,thanks for taking the time to create a cleaned up version of the video. I used your clip to compare to my pitiful one line AviSynth script. It gives me ideas of what I need to change and add.

LS, thanks for the reference to DaVinci Resolve. I'll check it out.

Any further thoughts on AviSynth and VD solutions?
Reply With Quote
  #9  
09-05-2018, 02:22 PM
hodgey hodgey is offline
Free Member
 
Join Date: Dec 2017
Location: Norway
Posts: 1,672
Thanked 443 Times in 380 Posts
Quote:
Autowhite is the wrong filter for the problem described
Autogain may be what he meant, which does adjust levels, though very primitively.

Autolevels and AutoAdjust are slightly more advanced plugins that can do level adjustment more smoothly. They are still not very smart though, and can easily produce bad results.
Reply With Quote
  #10  
09-05-2018, 04:34 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Quote:
Originally Posted by stevevid View Post
themaster1, thank you for the reference to Sony Vegas. I'll take a look. Also,thanks for taking the time to create a cleaned up version of the video. I used your clip to compare to my pitiful one line AviSynth script. It gives me ideas of what I need to change and add.

LS, thanks for the reference to DaVinci Resolve. I'll check it out.

Any further thoughts on AviSynth and VD solutions?
Lots of thoughts, but none having much to do with Vegas. The DV genius who worked your original sources apparently assumed a camera frame rate of 14.985 fps -- which is what you get when you remove the pulldown (telecine) fields and duped and tripled frames from the samples. I've no idea how those repeats and pulldown patterns were derived. The "Super dark clip.avi" also had some dropped frames periodically, which made the jerky playback worse.

Digital video has a far more limited contrast and color range than film. You get to a certain level of darkness where digital values go to zero, and below that there's nothing. Nada. Just zero's, which to most of us means pure black. And no detail. None. Everything below a certain level gets destroyed. Gone. Kablooey. If you try to brighten it, what you get is random, black-speckled noise.

Here's an original frame 94 from your super dark sample:


YUV histograms of that frame tell a story about you can expect from the darkest areas:


In the histogram at the top left,m note the sharp white "spike" in the upper left corner. That spike indicates all the data which has effectively been converted to zeros or near-zeros. The remains of the white band say that there's sparse data in the rest of the image. The histogram in the middle says that almost all the image data is crushed against the left (black) border. The vectorscope on the right shows that all you have for chroma is a pathetic little lump near the center (gray).

I got the following from that frame with Avisynth and VirtualDub:


You can likely tweak here and there to get whatever you can. But in the above image, note the murky noise in the darkest shadows (under the parked car, in the tree shadows in the background and on the right). You'll see some black specks in there and some macroblock noise. You can make that noise brighter or darker, but you can't make it go away. Those black specks mean no data. You can't create details where none exist. The missing details show up as odd-looking facial features and other ill-defined objects. And digging through DV compression loss doesn't profit much.

The attached mp4 is a square-pixel 14.985 fps version of the filtered video. The scripts I used required two steps and some VirtualDub filters for tweaking. After I cleaned up the progressive version I used an encoder to insert pulldown in the attached DVD (MPG) telecine version. Pulldown flags were embedded by DGPulldown, which sad to say won't allow 15fps but insists on an 18fps base as its slowest input, so the 29.97 fps mpg looks a little faster than the mp4.

You can't use 15fps for a DVD for the family. And you can't do much cleanup with a combination of telecine and doubled-up/tripled-up frames, which simply won't work with temporal filters. I also did away with 3 or 4 bad frames. There's no auto way to calm down one wildly blown-out frame; no such filter exists.

Code:
#----------- STEP 1 SCRIPT ----------------#
#--- AviSource is "Super dark clip.avi" ---#
#------------------------------------------#

AssumeBFF()
TFM(pp=0).TDecimate(cycle=20,CycleR=10)

ColorYUV(gain_y=50)
ContrastMask(enhance=9.0)
AutoAdjust(high_quality=true,auto_gain=true,dark_limit=10.0,\
  gamma_limit=1.5,dark_exclude=0.25,gain_mode=0,chroma_process=200,\
  auto_balance=true,chroma_limit=2.0)

QTGMC(InputType=3,preset="slow",EZDenoise=8,denoiser="dfttest",\
  ChromaNoise=true,DenoiseMC=true,sharpness=0.75)

ConvertToRGB32(interlaced=false)  #<- for Virtualdub filter tweaks

#---  Output is 15fps progressive (14.985 fps).   ---# 
#---  After VirtualDub filters are applied, save  ---#
#---  as Lagarith Yv12, for input to Step 2.      ---#
STEP 2:
Code:
#--- AviSource is YV12 AVI from Step 1 ---#
#-----------------------------------------#

DeBlock()
TemporalDegrain()
#--- Delete frames 13, 14, 15 ---#
S1=Trim(0,12)
S2=Trim(16,0)
return S1+S2
A VirtualDub .vcf file that sets up the VDub filters and settings I used is also attached. The filters used were gradation curves, ColorMill, and the VDUb Levels GUI.


Attached Images
File Type: jpg super dark frame 94 original.jpg (48.1 KB, 101 downloads)
File Type: png YUV histograms.png (75.1 KB, 100 downloads)
File Type: jpg super dark frame 46 after.jpg (103.0 KB, 101 downloads)
Attached Files
File Type: mpg superdark_720x480i_pulldown.mpg (5.16 MB, 2 downloads)
File Type: mp4 superdark_640x480_15p.mp4 (6.93 MB, 2 downloads)
File Type: vcf superdark_Step1_VDub_filters.vcf (3.7 KB, 7 downloads)
Reply With Quote
  #11  
09-05-2018, 05:08 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Thanks for your samples, by the way.

The next sample I cam to was "Outside variable light 2.avi", which at least had some workable levels but godawful color. I didn't see much of a levels change between the two shots. There are a couple of blown-out bad frames, but unless you want to be fooling with them between now and this time next year you're better off letting them drop by the wayside, which is what I dd.

The big problem with the originals is overblown red and some really pumped black levels. Did the original film's black levels look like this original frame?


I kept the histogram showing in the frame while I jockeyed with the filters until I got what I wanted:


Then I ran a few Avisynth and VirtualDub tweaks, especially to get rid of some of the spots on the boy's clothes. There are filters around for film scratches. But before you try them, be aware that they're, inefficient in removing scratches but are gangbusters at destroying detail.


The attached mp4 is the square pixel 15fps version for the internet and USB players. The MPG is the DVD-encoded 29.97 fps version. There is also a .vcf file attached with the VirtualDub settings (the plugins used were Color Camcorder Denoise, gradation curves, and ColorMill).

Code:
#--- AviSource is "Outside variable light 2.avi" ---#
#---------------------------------------------------#

AssumeBFF()
TFM(pp=0).TDecimate(cycle=20,CycleR=10)
ColorYUV(off_u=12,off_v=-12,off_y=-35,gamma_y=-25)
Tweak(cont=1.25,sat=2.0,dither=true,coring=false)
AutoAdjust(high_quality=true,auto_gain=true,dark_limit=1.0,\
  gain_mode=1,chroma_process=200,auto_balance=false)
# Histogram("Levels")  #<- for initial settings only
# return last          #<- for initial settings only

RemoveDirtMC(40,false)
ReplaceFramesMC2(15,1)
ConvertToRGB32(interlaced=false)   #<- for VirtualDub filter tweaks)
S1=Trim(0,52)
S2=Trim(55,0)
return S1+S2

#--- Output is progressive 15fps (14.985 fps).    ---#
#--- After  VirtualDubb filters are applied, save ---#
#--- VDub output as Lagarith YV12 for encoding    ---#
#--- and resizing later.                          ---#
Pulldown for 29.97 for NTSC DVD was added by the encoder.


Attached Images
File Type: jpg outside2 frame 41 original yuv.jpg (65.6 KB, 95 downloads)
File Type: jpg outside2 frame 41 after.jpg (80.5 KB, 97 downloads)
File Type: jpg outside2 frame filtered.jpg (57.2 KB, 97 downloads)
Attached Files
File Type: vcf outside2_VDub_filters.vcf (3.6 KB, 3 downloads)
File Type: mp4 outside2_640x480_15p.mp4 (2.62 MB, 1 downloads)
File Type: mpg outside2_720x480i.mpg (3.31 MB, 2 downloads)

Last edited by sanlyn; 09-05-2018 at 05:42 PM.
Reply With Quote
  #12  
09-05-2018, 06:08 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
The last sample I had time for was "Outside variable light 1.avi". For other samples I used SmoothAdjust for one of those contrary auto level filters (all of which still need massaging with other filters),m but for this sample I used HDRagc. The main reason was that SmoothAdjust didn't do what I wanted. HDRagc didn't exactly do what I wanted either, but it got closer than the others I tried. In any case, whenever you deal with these automatons be prepared for long and tiring compromise.

The two images below are from the original .avi. In this sequence the girl runs from the left image into the right image, from a darkly shaded area to bright sunlight. Naturally, you expect the levels to change. Here, they changed quite a bit from left to right.


The temptation is to make t he image on the left as bright as the image on the right. That wouldn't be correct -- heavy shade never looks like bright sunlight. And anyway, the filters often don't read your mind and will do whatever they want. The image below is the compromise I reached with HDRagc and some help from other filters:


The left side looks about right, but the right side is a bit bright, gamma is higher, it looks brighter during playback, and some of the hues are changed. Well...you can't have everything. That's especially true when the same filter settings simply won't cooperate with every scene that comes along. One-size-fits-all just doesn't work with video cleanup.

The script below creates three different scene changes and processes each separately, then joins them.
Code:
#--- AviSource is "Outside variable light 2.avi" ---#
#---------------------------------------------------#

AssumeBFF()
orig=last

#--- Routines for Scene 1 ---#
orig.Trim(0,104)
HDRagc(coef_gain=2.5,corrector=0.55)
SmoothLevels(24,1.1,255,16,255)
Tweak(sat=1.2,cont=1.05,coring=false,dither=true)
S1=last
# Return S1    #<- setup test only

#--- Routines for Scene 2 ---#
orig.Trim(116,409)
HDRagc(coef_gain=2.5)
ContrastMask(enhance=3.0)
Tweak(cont=1.1,coring=false,dither=true)
ReplaceFramesMC2(195,1)
S2=last
S2a=S2.Trim(0,218) + S2.Trim(223,292)
# Return S2a    #<- setup test only

#--- Routines for Scene 3 ---#
orig.Trim(412,0)
HDRagc(coef_gain=2.0,corrector=0.8)
ColorYUV(off_y=-12,off_u=2)
Tweak(cont=1.25,coring=false,dither=true)
SmoothLevels(32,1.0,255,16,255)
S3=last
# Return S3    #<- setup test only

#--- Join all 3 Scenes ---#
S123=S1+S2a+S3
S123
SeparateFields()
e=SelectEven().RemoveDirtMC(40,false).TemporalDegrain()
o=SelectOdd().RemoveDirtMC(40,false).TemporalDegrain()
Interleave(e,o)
Weave()
ConvertToRGB32(interlaced=true)  #<- for VirtualDub filter tweaks
return last


#--------  Output is interlaced 29.97 fps.  ---------#
#--- After VirtualDubb filters are applied, save  ---#
#--- VDub output as Lagareith YV12 for encoding   ---#
#--- and resizing later.
After running this script and creating the interlaced DVD, I had to run the results of that script through another script, to create the 640x48-0 15fps mp4. Deinterlace/de-telecine and resize script:

Code:
#--- AviSource is previous interlaced 29.97 fps AVI ---#
#------------------------------------------------------#

AssumeBFF()
TFM(pp=0).TDecimate(cycle=20,CycleR=10)
Spline36Resize(640,height)

#--- Output is 640x480 YV12 progressive 14.985 fps---#
The .attached .vcf file has the VDub filter settings (Color Camcorder Denoise and SmartSmoother).


Attached Images
File Type: jpg darik tio bright - original.jpg (45.0 KB, 91 downloads)
File Type: jpg dark to bright - filtered.jpg (43.1 KB, 90 downloads)
Attached Files
File Type: vcf outside1_Vdub_filters.vcf (895 Bytes, 2 downloads)
File Type: mpg outside1_720x480i.mpg (16.19 MB, 2 downloads)
File Type: mp4 outside1_640x480_15p.mp4 (12.04 MB, 3 downloads)

Last edited by sanlyn; 09-05-2018 at 06:23 PM.
Reply With Quote
  #13  
09-06-2018, 12:05 AM
stevevid stevevid is offline
Free Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 124
Thanked 12 Times in 9 Posts
Sanlyn, thanks for all the work you did. I had a reply almost ready when the "Reply to Thread" editor started acting strange. I deleted one word and all text but one line were erased. The editing part of preview post did not show my images but the part above the editing window did show the images. I totaly gave up when the preview editing window started inserting duplicates of my images. I'll try again tommorrow.
Reply With Quote
  #14  
09-14-2018, 09:15 PM
stevevid stevevid is offline
Free Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 124
Thanked 12 Times in 9 Posts
Where can I find "ContrastMask" that is used in post 10? It appears to be a script, but I have found references to different versions for video. AviSynth's wiki doesn't have any information.

Sanlyn, I'm looking at your VirtualDub settings from post 10. What does the Levels filter add that improves the image? The setting seems to darken the image.

Thanks,
Steve

-- merged --

I found a ContrastMask in an attachment list I found in the thread Video restoration newbie: Avisynth scripts? Sanlyn is this the file you used or is there a different one?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
BVP4+ intermittent signal issues (c/s switch?) bilditup1 Restore, Filter, Improve Quality 13 09-22-2015 04:12 PM
128mb ATI AIW 9600 Radeon install issues, other issues alleng1usa Capture, Record, Transfer 47 03-01-2014 10:32 AM
VHS has broken Control Track? Belmont Video Hardware Repair 2 12-25-2012 10:33 PM
Automatically generated DVD Thumbnail-based Menus? Joekster Author, Make Menus, Slideshows, Burn 1 05-23-2011 10:21 PM
Using KVM to control multi computers admin Computers 5 01-08-2011 01:53 AM

Thread Tools



 
All times are GMT -5. The time now is 12:48 PM