Sign In

Moth3r's guide to LD capture colour correction using AviSynth (emphasis on "correction")

Replies
36
Author
Time

Introduction

This guide is intended to help those of you who are capturing analogue sources (from laserdisc, in the main) to ensure that the colours in your digital capture match your analogue source as close as possible.

The method is strictly a numbers-based calibration of your capture chain, it is not intended to help you get "natural looking" skin tones or any other subjective outcome.


Step 1: Capture a test pattern off a laserdisc. 

Several LDs include these, for example:

   

---- SMPTE color bars ----   ---- BBC Test Card G ----

These patterns may be found on blank unused sides, or in special set up chapters. There are also discs that are dedicated to such set up patterns, such as A Video Standard or Video Essentials. There is a work-in-progress list of laserdiscs that contain test patterns here.

Play your laserdisc, and capture the test pattern. Some capture cards let you adjust capture settings such as brightness, contrast and saturation, other capture devices (such as Firewire units or DVD recorders) do not give you this option. If you do have these adjustments, you can set your card up to be approximately correct (but be careful not to clip anything), then fine tune the result using the AviSynth method below.


Step 2: Analyse your capture - "observed" colours

Rather than try and read individual pixel values, it's useful to crop out all other bars so you're left with a frame containing just one colour, then use ColorYUV(analyze=true) in AviSynth to find the average YUV values.

For example, using this image of the SMPTE color bars, as captured by Darth Mallwalker from his Technidisc LD pressing of Empire, we can crop and analyse the areas shown below:

By using the script below:

ImageReader("D:\Video projects\colour correction test\on0000.png")
ConvertToYUY2()
video_black=Crop(348, 366, -192, -10).PointResize(480, 120).ColorYUV(analyze=true)
video_white=Crop(118, 366, -422, -10).PointResize(480, 120).ColorYUV(analyze=true)
yellow=Crop(96, 78, -470, -164).PointResize(480, 120).ColorYUV(analyze=true)
grey=Crop(18, 12, -560, -164).PointResize(480, 120).ColorYUV(analyze=true)
red=Crop(462, 10, -100, -162).PointResize(480, 120).ColorYUV(analyze=true)
cyan=Crop(188, 76, -376, -164).PointResize(480, 120).ColorYUV(analyze=true)
StackVertical(video_black, video_white, yellow, grey, red, cyan)

The resizing is necessary in order to be able to read the statistics. The script outputs the following result (we are interested in the average values for each channel):

It shouldn't matter too much which six colours you choose, but I'd recommend you include black, white and at least one grey to help with the gamma setting.


Step 3: Determine what the colours should be - "target" colours

The colours in the test patterns have exact specifications. We know, or can work out, exactly what RGB (or YUV) values represent each solid colour block.

Here's the RGB values for the colours in the SMPTE colour bars we chose earlier: 


4. Find the parameters required to get a "best fit" to the correct colours

Download the Excel spreadsheet here, and complete the observed and target colour values.

The idea is to find parameters that result in adjusted colours having a "best fit" correlation with the target colours (i.e. error is minimised using the least squares method). Run the solver add-in from Excel, and it should be set up as follows:

Provided your colours are close enough in the first place, and you haven't made an error in entering any values, Solver should stop after a while with a solution. 


5. Add line in AviSynth script - to transform observed colours into target colours 

The next step is simple: just add the ColorYUV command from the spreadsheet into your AviSynth script:

Source(...)
ColorYUV(gain_y=5.60, off_y=6.47, gamma_y=-74.85, off_u=-1.08, cont_u=1.65, off_v=0.26, cont_v=9.78)


Examples


SMPTE color bars - raw source


SMPTE color bars - corrected


Technidisc LD - raw


Technidisc LD - corrected


Technidisc - raw


Technidisc - corrected


BBC Test Card G - raw source


BBC Test Card G - corrected


PAL THX LD - raw source


PAL THX LD - corrected

This post has been edited.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Of course... you just need to find a VHS tape that includes the colour bars. I don't think I've ever seen one, but apparently some releases did have the bars at the start or end of the tape.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Steps 1 & 2 now completed.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Guide now finished. Please give it a try and let me know if you come across any problems.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Uploaded spreadsheet v1.1 which corrects an error where I had accidentally overtyped some of the formulas.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Did you use this method for your French THX LD captures?

A picture is worth a thousand words. Post 102 is worth more.

I’m late to the party, but I think this is the best song. Enjoy!

—Teams Jetrell Fo 1, Jetrell Fo 2, and Jetrell Fo 3

Author
Time

No, I only came up with this idea relatively recently.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Besides "Jason and the Argonauts" PAL UK LD, are there any other PAL laserdiscs which contain some test image or color bars?

I found a CD-Video test that has few calibration clips:

  1. A Philips Test Card (same as BBC test card G)
  2. multi burst - with highest frequencies at 5.8MHz barely showing
  3. Grey Bars
  4. alternating black and white bars
  5. color bars (three upper quarters) + grey bars (lower quarter) with white credits over it - but with enough space up and down

 

now that we have proof that PAL CD-Video can't show 460 lines of horizontal resolution - what a discovery! - maybe only the first test could be useful; take in account that it has laserrot and so is full of speckles and dropouts, but the colors are still vibrant.

Did you make an AVS script like the one you posted, but for use with the BBC testcard G?

Thanks!

[spoRv] projects: released | in progress | future | homepage: blog.spoRv.com| fan preservation forum: fanres.com|

Author
Time

_,,,^..^,,,_ said:

Besides "Jason and the Argonauts" PAL UK LD, are there any other PAL laserdiscs which contain some test image or color bars?

Good question. None that I know of.

I found a CD-Video test that has few calibration clips:

  1. A Philips Test Card (same as BBC test card G)
  2. multi burst - with highest frequencies at 5.8MHz barely showing
  3. Grey Bars
  4. alternating black and white bars
  5. color bars (three upper quarters) + grey bars (lower quarter) with white credits over it - but with enough space up and down

Interesting disc. I don't know much about the CD Video format, but I think you should be able to use this disc to calibrate your LD captures. Is it NTSC or PAL? Do you have any further information about this disc?

Did you make an AVS script like the one you posted, but for use with the BBC testcard G?

Yes I did.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

This CD-Video (for whom doesn't know it, this format is a CD sized analog videodisc, compatible with many laserdisc players, that contains max 6 minutes of analog audio and video, and 20 minutes of digital audio) is PAL; it was a demo disc manufactured in UK by PDO and distributed freely with a german magazine - don't know which one, but if I recall correctly it was a car magazine - here you are the link to its LDDB page:

http://www.lddb.com/laserdisc/51266/CDV-901-001/DIE-video-CD-%281988%29

Despite the fact the video is awful due to laser rot, I think it can still be used as calibration tool. If you can send me the AVS script, I'll do tests with it and post results here.

Thanks in advance.

[spoRv] projects: released | in progress | future | homepage: blog.spoRv.com| fan preservation forum: fanres.com|

Author
Time

_,,,^..^,,,_ said:

If you can send me the AVS script, I'll do tests with it and post results here.

Which AVS script? Are you looking for the crop values I used on my capture of the BBC Test Card G? If so, I found this on my hard drive:

MPEG2Source("D:\Video projects\comb filter test\dr198 s-vid2.d2v", cpu=0, upConv=1, iCC=false)
temporalsoften(2,255,255)
#Crop(114, 146, -580, -398) # 50% grey
#Crop(252, 436, -250, -108) # video black
#Crop(338, 142, -364, -398) # 75% grey
#Crop(268, 100, -250, -442) # video white
#Crop(208, 186, -442, -314) # cyan (75%)
#Crop(444, 184, -212, -316) # red (75%)
pointresize(720,576)
coloryuv(analyze=true)

You will need to remove the leading "#" for each line and note down the stats for each colour in turn, and you  may need to adjust the crop values if your capture is positioned differently to mine.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Spreadsheet updated to v1.2 - fixes a problem where Solver would sometimes fail due to a #NUM! error.

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

Added some example screenshots (right-click - open/view image in new tab to see full size).

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

This thread keeps getting better. It's going to be very helpful with my upcoming Technidisc captures. :-)

A picture is worth a thousand words. Post 102 is worth more.

I’m late to the party, but I think this is the best song. Enjoy!

—Teams Jetrell Fo 1, Jetrell Fo 2, and Jetrell Fo 3

Author
Time

This is fucking brilliant! Thank you Moth3r! :)

We want you to be aware that we have no plans—now or in the future—to restore the earlier versions. 

Sincerely, Lynne Hale publicity@lucasfilm.com

Author
Time

msycamore said:

This is fucking brilliant! Thank you Moth3r! :)

Now I just need to find a VHS with color bars!

A picture is worth a thousand words. Post 102 is worth more.

I’m late to the party, but I think this is the best song. Enjoy!

—Teams Jetrell Fo 1, Jetrell Fo 2, and Jetrell Fo 3

Author
Time

Modified crop code for the mid-90s Fox bars.

 

video_black=Crop(400, 366, -192, -10).PointResize(480, 120).ColorYUV(analyze=true)
video_white=Crop(130, 366, -470, -10).PointResize(480, 120).ColorYUV(analyze=true)
grey=Crop(16, 12, -630, -164).PointResize(480, 120).ColorYUV(analyze=true)
red=Crop(530, 10, -110, -162).PointResize(480, 120).ColorYUV(analyze=true)
yellow=Crop(110, 78, -530, -164).PointResize(480, 120).ColorYUV(analyze=true)
cyan=Crop(212, 76, -420, -164).PointResize(480, 120).ColorYUV(analyze=true)
StackVertical(video_black, video_white, grey, red, yellow, cyan)

 

Before:

After:

ColorYUV(gain_y=38.19, off_y=-1.26, gamma_y=-7.01, off_u=0.38, cont_u=-48.31, off_v=0.08, cont_v=-45.58)

Very impressive! Thanks. Even with this noisy disc. Though I think I should recapture to get more shadow detail. I need to recapture for better audio anyway.

This post has been edited.

Author
Time

Same $20 capture device as above with same capture settings but different disc: A Video Standard.

ColorYUV(gain_y=33.74, off_y=-6.08, gamma_y=5.59, off_u=1.27, cont_u=13.40, off_v=0.54, cont_v=2.61)

http://s24.postimage.org/ltlz1gagl/AVS_HD_AV_Grabber_a.png
http://s24.postimage.org/hyikyvrat/AVS_HD_AV_Grabber_b.png
http://s24.postimage.org/oq901qgad/AVS_HD_AV_Grabber_c.png

Same frame, different capture device: ATI 600 USB.

ColorYUV(gain_y=-4.04, off_y=-2.94, gamma_y=-22.20, off_u=1.12, cont_u=62.09, off_v=0.39, cont_v=42.87)

http://s24.postimage.org/o73wsgovp/AVS_ATI_600_a.png
http://s24.postimage.org/kc0ipw5px/AVS_ATI_600_b.png
http://s24.postimage.org/s614badit/AVS_ATI_600_c.png

 

Author
Time

I'm trying to figure out whether it's better to capture somewhere close to where I think the levels should be by eye, and risk crushing or blooming detail, or constrain the range so that it definitely fits within the ends of the histogram, for later expansion with the Excel function.

Bars here from Visions of Light. Both captures are using the ATI 600 USB. The first is with high brightness and low contrast (dull image) and the second is with lower brightness and higher contrast. My attempt at approximating the appropriate values didn't go over too well due to the laptop monitor that I was using. For some reason it causes things to look way off.

Visions of Light LD Side 2 Bright130 Cont23:

ColorYUV(gain_y=124.07, off_y=-35.84, gamma_y=-28.07, off_u=-0.16, cont_u=31.19, off_v=0.26, cont_v=63.19)


Visions of Light LD Side 2 Bright107 Cont29:

ColorYUV(gain_y=41.22, off_y=-0.33, gamma_y=-26.67, off_u=0.30, cont_u=36.82, off_v=0.26, cont_v=63.19)



http://s2.postimage.org/ryijc93o9/Vo_L_ATI_600_High_a.png
http://s2.postimage.org/ntc842va1/Vo_L_ATI_600_Low_a.png

http://s2.postimage.org/p5pbs83bt/Vo_L_ATI_600_High_b.png
http://s2.postimage.org/owwcg1fx5/Vo_L_ATI_600_Low_b.png

 

Output:

The dark blue bar and dark purple patch seem to show the biggest differences. Beyond that I'm only seeing noise shifts. I don't know which is better, but at least I'm satisfied that there isn't a huge difference either way.

Histograms:

http://s14.postimage.org/c2xiunwwx/Vo_L_ATI_600_High_d.png
http://s14.postimage.org/4bgsw3srl/Vo_L_ATI_600_Low_d.png

Looks like my approximation didn't leave enough play at the low end to avoid clipping below-black.

This post has been edited.

Author
Time

AntcuFaalb said:

msycamore said:

This is fucking brilliant! Thank you Moth3r! :)

Now I just need to find a VHS with color bars!

I visited a thrift store recently and bought an intriguing tape that was hand-labelled. It turned out to be someone's 4-minute student short film, with bars and tone at the head.

But it wasn't the master copy. The 1kHz tone sounded way lower, colors are faded, contrast is poor, and blacker-than-black in the bars is already clipped no matter how high brightness was raised in the Proc Amp.

I tried to use the bar's values anyway but they were WAY off and produced both crush and bloom in the content itself.

Author
Time

You could use a signal generator and record the colour bars to the VHS deck you will be using for captures.

Donations welcome: paypal.me/poit
bitcoin:13QDjXjt7w7BFiQc4Q7wpRGPtYKYchnm8x
Help get The Original Trilogy preserved!

Author
Time

No, that won't help at all. If the only thing that you needed was to record color bars on your playback deck, mastering houses wouldn't record bars at the start of every tape they put out. Their clients could just calibrate their playback equipment once in the way you describe, instead.

There was an S-VHS calibration tape released in 1989: Perfect Picture System. If it could be located, it would at least be somewhat useful for calibrating professional VHS recordings.

This post has been edited.

Author
Time

I have happened upon a retail VHS tape that has tone + grey once the program content ends (there is a long period of black before it drops off to this test signal, so I take it to be an artifact of the duplication process). I also found one with tone on black at the end but that's pretty useless.

Author
Time

I'd like to calibrate my Hauppauge USB-Live2, but the proc-amp controls range from -5000 to 5000.

I have 20/20 vision, but my eyes aren't that good and the auto-calibration that comes with DScaler works, but looks like it'll take forever to complete.

Any advice?

A picture is worth a thousand words. Post 102 is worth more.

I’m late to the party, but I think this is the best song. Enjoy!

—Teams Jetrell Fo 1, Jetrell Fo 2, and Jetrell Fo 3

To the top