fasttimes
11th January 2003, 20:26
OK, so there is some debate over the use of Blur, and the usefulness Layering/averaging multiple VHS captures. I suggested that both are valuable tools, when used correctly. This post will mainly deal with the issue of layering; in particular, the usefulness of multiple capture of VHS tape, even from the exact same VHS tape. But, I'll get into the use of blur, as well. I hope to spark some debate and exploration of these issues.
Some have said that you will only be re-capturing the exact same analog tape noise with each pass, thus negating any averaging that could be accomplished. However, after testing, it is clear that multiple captures, of even the same VHS tape, does make an notable improvement in the final MPEGs quality! This makes sense, as any analog format never play back in exactly the same manner each time, and these minor differences create lots of high frequency noise that can averaged out (and make MPEG compression more efficient.) This is in addition to the normal noise/static, that gets picked up from every point in the chain, from Tape->capture card DAC, during a capture. All that can be averaged out as well.
If you would like all the sample JPGs of all steps, for review, you can download them as a self-extracting RAR at the following URL. If you have WindowsXP (maybe other versions) Picture and FAX Viewer (installed I think if you install the FAX features,) you can select as many pictures at you want in Window Explorer (use the CTRL and/or SHIFT key,) then right click and select "Preview" from the menu. You can then toggle between the selected images with the keyboard arrow keys! Makes it very simple to compare different images to eachother.
http://www.fasttimesatridgemonthigh.org/vidcap/files/filtersamples.exe (1.2MB) All JPGs were made in PaintShop Pro, with a very low compression setting of "5".
First, I'll list the filter chain that I used:
I captured the exact same footage, from the exact same VHS tape and VCR, three times, using the lossless HuffYUV codec. More passes should improve these results even more. In theory, 4 captures should double the random noise reduction of two captures, and 8 captures should double 4 captures, ect.
Please view L1SourceCap1.jpg, L1SourceCap1.jpg, L2SourceCap2.jpg, and S1SourceCap.jpg (same cap as L2SourceCap2.jpg) for a sample of the condition of the raw, unaltered VHS captures. Take special note of L1SourceCap1.jpg for the strange blue streak, in the bottom video tear region, that is not there on the other two. Also take note of the thin white lines, just above the video tearing.
After trimming all raw caps to the same starting position and length (using VDub's direct stream copy), I ran each AVI through Decomb's IVTC, using the following AVISynth AVS script, and saved each out to a new AVI:
LoadPlugin("decomb.dll")
AVISource("c:\layer[1/2/3].avi")
Telecide(guide=1, post=false)
Decimate(cycle=5)
Now that I had each capture as progressive 29.976FPS material, I created the layered source cap with the following AVS, and saved it out to a new AVI:
layer1=avisource("c:\layer1.avi")
layer2=avisource("c:\layer2.avi")
layer3=avisource("c:\layer3.avi")
Interleave(layer1,layer2,layer3)
TemporalSoften(1,255,255)
SelectEvery(3,1)
Please see L4CapsLayered.jpg for a sample of the result of the layering. Note that the blue streak in the bottom video tearing is gone, as well as the thin white lines, just above this area. Also, take a look at the jagged scan lines in the left man's hair, the right man's apron, and the upper section of the "black bar" along the left side. And, take a look at the NBC TV logo, that is over sharpened on the individual caps. Even with only three layers, it is a much cleaner image. The is a slight bit of blur imposed, but this is caused by the slight timing differences between each individual capture, and would not be there with a more stable video source than VHS tape. The worst of this blur can be seen in the left man's tie, which loses it's fine detail.
Now that I had my Layered Cap, I picked "layer2.avi" as the Single Cap to compare against the layered one, and renamed it "single.avi". "Single.avi" was the mid-sized AVI of the three captures, implying it had about the average amount of noise of the three captures. You can also compare the sample JPEG file sizes, showing the Single sample being 31.77% larger than the layered (layered being 74.74% smaller):
Stage_________________Size__Compres%__Layered vs Single Compres%
Layer 1 Source_______125119__100.000
Layer2/Single Cap____123227___98.488__131.77
Layer 3 Source_______121800___97.347
Layered Caps_________106124___84.818___74.74
Now, both Layered.avi and Single.avi went through the exact same filter chains. First, ran both Layered.avi and Single.avi through AVISynth's Convolution3D using the following AVS and saved the results to a new AVI.:
LoadPlugin("Convolution3d.dll")
Convolution3d(AVISource("c:\[filename].avi"),0, 3, 64, 6, 64, 10, 0)
Please see L5Convolution3D.jpg and S2Convolution3D.jpg for samples of the results. Take a look at how much cleaner the layered version is! Also take a look at the left man's tie. C3D blurred those fine details out on both versions, so losing it when I did the layered capture cost nothing over not layering! I think these results alone are very clear proof, that multiple captures of the exact same VHS material, has a very positive influence on quality! If you don't agree, please speak up as to why you disagree. Here is the file size data for the sample JPGs, showing the single version being 12.91% larger than the layered results:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered C3D___________93517___74.742___88.57
Single C3D___________105589___84.391__112.91
I'm really amazed at the results at this stage, and might have just encoded the layered results right here. However, I continued to process a little more, to get some additional noise reduction and a wee more sharpness.
Finally, both Layered.avi and Single.avi were fed to VirtualDub using the following AVS, that applied a slight blur, in preparation for WarpSharp in VirtualDub:
source=AVISource("C:\[filename].avi")
Blur(source,.50)
Please see L6BlurAdded.jpg and S3BlurAdded.jpg for samples of the results. Both are a tad blurry (duh!,) but most of that will get fixed next. As always, the layered caps results are much cleaner than the single cap. The single layer JPG is still 7.57% larger than the layered results:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered Blur__________83161___66.466___92.96
Single Blur___________89458___71.498__107.57
Now with the blur AVS scripts loaded in VirtualDub, I applied WarpSharp 1.1 at a strength of 32, then Border Control to matte 8 pixels all around the image, and saved new final AVIs. Please see L7WarpSharp&BorderControl.jpg and S4WarpSharp&BorderControl.jpg for a sample of the final results. Comparing the JPG file sizes shows the single cap version still 6.45% larger in size:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered WS&BC_________81054___64.782___93.94
Single WS&BC__________86286___68.963__106.45
Last, but not least, I compressed both of the final AVIs in Cinema Craft Encoder SP (CCE SP) v2.66.01.07, using the following settings, and bitrates:
- 1-pass VBR Min=2Mb/s Max=15Mbs (not DVD compliant)
- Q settings of 3, 15, 30 and 60
- All built-in filtering disabled
- GOP 3/5
- Quantization matrices set to MPEG Standard
- Quantizer Characteristics set to 16
- Sequence End Code and DVD Video Compliance unchecked
- Zigzag Block Scanning Order
Please see L8FinalMPEG.jpg and S5FinalMPEG.jpg for sample screen captures, taken with PowerDVD. You can see the additional noise, in the single cap version. That little bit of extra nose may not seem like much, but when the MPEGs are played back at full speed, there is a big difference in visible noise! Here is the screen capture file size comparison, showing the 5.11% increased file size. That is all additional noise!:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered Final MPEG____89875___71.832___95.14
Single Final MPEG_____94470___75.504__105.11
Lastly, I encoded MPEG-2 files at various 1-pass VBR rates-- Q setting 3, 15, 20, and 60. At Q3, there is only a 2.14% difference, but this is due to both of them getting capped at the max bitrate. At Q15, Q30, and Q60, the single cap is larger by 20.11%, 19.43%, and 26.1% respectively. Those are huge bitrate savings, and the only difference was using layering!:
Stage_________________Size__Compres%__Layered vs Single Compres%
Q3 Layered_________41477352_____________97.9
Q3 Single__________42366568___________102.14
Q15 Layered________26543604____________83.26
Q15 Single_________31881288___________120.11
Q30 Layered________15899872____________83.73
Q30 Single_________18989616___________119.43
Q60 Layered_________8199844____________79.30
Q60 Single_________10339812___________126.10
If you would like to see what the final MPEG videos look like, you can download them from the following links:
http://www.fasttimesatridgemonthigh.org/vidcap/files/layered60.m2v (8.9MB)
http://www.fasttimesatridgemonthigh.org/vidcap/files/single60.m2v (10.1MB)
My conclusions:
There are several things that I think I have been proven by my testing. The following only relates to VHS material, as I have not tested yet with higher quality source material. If you disagree with anything, please speak up, so I can do further testing to address your points.
First, that layering (averaging) clearly helps reduce noise, increases the effectiveness of further post-process filtering, and increases compression by 20-25%.
Second, that blur filters, when used correctly, are not evil, and can have a positive effect on both noise reduction, and image quality.
And last, that Convolution3D is one kick-ass filter! I find the defaults way too heavy (like most filter defaults) but, works well when toned down. I've only played with it for about a day, so I still have lots to learn about using it to best effect.
I'd like you to play around, comparing the different samples I provided, for some interesting insight. For example, compare any of the source caps with L8FinalMPEG.jpg, and see if the blur filter hurt the quality (and be prepared for a shock.) Or compare L5Convolution3D.jpg with L7WarpSharp&BorderControl.jpg, for the amount of noise reduction vs the tiny bit of blur. There are lots of ways to compare the samples to each other.
The time to do the this testing, and write this message was about 12 hours (most of it was writing this damn message,) but I think it was time well spent. The issues of filtering is probably one of the most difficult aspect of desktop video (especially analog video) to do learn to do effectively, and at the same time, is the most important factor in image quality! There are very few resources on the net the talk in-depth about filtering, and I hope the doom9.org forums will consider creating a forum, just for this specialized subject.
In closing, I'd like to invite everyone to try these tests for themselves, on your own footage. The only needed software is VirtualDub, AVISynth v2.x, HuffYUV, Decomb AVISynth plugin, and Border Control and WarpSharp 1.1 VirtualDub plugins. Then, just use all the sample AVS scripts, above. Here are software links:
VirtualDub http://www.virtualdub.org
AVISynth http://www.avisynth.org
HuffyYUV http://math.berkeley.edu/~benrg/huffyuv.html
AVISynth and VirtualDub plugins http://shelob.mordor.net/dgraft/
Hope you found this interesting and helpful. Let the debates begin. :)
Update:
I thought I'd also compress the raw original, unfiltered/unprocessed "Single.avi", for comparison with how much the filtering improved compressibility. Below is MPEG-2 file size of the unprocessed Single.avi vs the layered and processed version. All CCE encoder settings were the same as mentioned previously:
Stage Size Processed vs
Q3 Layered 41477352 Unprocessed Compres%
Q15 Layered 26543604 59.22
Q15 Single Unprocessed 44824240 168.87
Q30 Layered 15899872 41.98
Q30 Single Unprocessed 37877524 238.23
Q60 Layered 8199844 42.84
Q60 Single Unprocessed 19142548 233.45
Ouch! Unprocessed is 69%, 138% and 133% larger. Also notice, a Q3 encode on the layered and processed source for less bitrate as a Q15 encode of the raw footage!
Some have said that you will only be re-capturing the exact same analog tape noise with each pass, thus negating any averaging that could be accomplished. However, after testing, it is clear that multiple captures, of even the same VHS tape, does make an notable improvement in the final MPEGs quality! This makes sense, as any analog format never play back in exactly the same manner each time, and these minor differences create lots of high frequency noise that can averaged out (and make MPEG compression more efficient.) This is in addition to the normal noise/static, that gets picked up from every point in the chain, from Tape->capture card DAC, during a capture. All that can be averaged out as well.
If you would like all the sample JPGs of all steps, for review, you can download them as a self-extracting RAR at the following URL. If you have WindowsXP (maybe other versions) Picture and FAX Viewer (installed I think if you install the FAX features,) you can select as many pictures at you want in Window Explorer (use the CTRL and/or SHIFT key,) then right click and select "Preview" from the menu. You can then toggle between the selected images with the keyboard arrow keys! Makes it very simple to compare different images to eachother.
http://www.fasttimesatridgemonthigh.org/vidcap/files/filtersamples.exe (1.2MB) All JPGs were made in PaintShop Pro, with a very low compression setting of "5".
First, I'll list the filter chain that I used:
I captured the exact same footage, from the exact same VHS tape and VCR, three times, using the lossless HuffYUV codec. More passes should improve these results even more. In theory, 4 captures should double the random noise reduction of two captures, and 8 captures should double 4 captures, ect.
Please view L1SourceCap1.jpg, L1SourceCap1.jpg, L2SourceCap2.jpg, and S1SourceCap.jpg (same cap as L2SourceCap2.jpg) for a sample of the condition of the raw, unaltered VHS captures. Take special note of L1SourceCap1.jpg for the strange blue streak, in the bottom video tear region, that is not there on the other two. Also take note of the thin white lines, just above the video tearing.
After trimming all raw caps to the same starting position and length (using VDub's direct stream copy), I ran each AVI through Decomb's IVTC, using the following AVISynth AVS script, and saved each out to a new AVI:
LoadPlugin("decomb.dll")
AVISource("c:\layer[1/2/3].avi")
Telecide(guide=1, post=false)
Decimate(cycle=5)
Now that I had each capture as progressive 29.976FPS material, I created the layered source cap with the following AVS, and saved it out to a new AVI:
layer1=avisource("c:\layer1.avi")
layer2=avisource("c:\layer2.avi")
layer3=avisource("c:\layer3.avi")
Interleave(layer1,layer2,layer3)
TemporalSoften(1,255,255)
SelectEvery(3,1)
Please see L4CapsLayered.jpg for a sample of the result of the layering. Note that the blue streak in the bottom video tearing is gone, as well as the thin white lines, just above this area. Also, take a look at the jagged scan lines in the left man's hair, the right man's apron, and the upper section of the "black bar" along the left side. And, take a look at the NBC TV logo, that is over sharpened on the individual caps. Even with only three layers, it is a much cleaner image. The is a slight bit of blur imposed, but this is caused by the slight timing differences between each individual capture, and would not be there with a more stable video source than VHS tape. The worst of this blur can be seen in the left man's tie, which loses it's fine detail.
Now that I had my Layered Cap, I picked "layer2.avi" as the Single Cap to compare against the layered one, and renamed it "single.avi". "Single.avi" was the mid-sized AVI of the three captures, implying it had about the average amount of noise of the three captures. You can also compare the sample JPEG file sizes, showing the Single sample being 31.77% larger than the layered (layered being 74.74% smaller):
Stage_________________Size__Compres%__Layered vs Single Compres%
Layer 1 Source_______125119__100.000
Layer2/Single Cap____123227___98.488__131.77
Layer 3 Source_______121800___97.347
Layered Caps_________106124___84.818___74.74
Now, both Layered.avi and Single.avi went through the exact same filter chains. First, ran both Layered.avi and Single.avi through AVISynth's Convolution3D using the following AVS and saved the results to a new AVI.:
LoadPlugin("Convolution3d.dll")
Convolution3d(AVISource("c:\[filename].avi"),0, 3, 64, 6, 64, 10, 0)
Please see L5Convolution3D.jpg and S2Convolution3D.jpg for samples of the results. Take a look at how much cleaner the layered version is! Also take a look at the left man's tie. C3D blurred those fine details out on both versions, so losing it when I did the layered capture cost nothing over not layering! I think these results alone are very clear proof, that multiple captures of the exact same VHS material, has a very positive influence on quality! If you don't agree, please speak up as to why you disagree. Here is the file size data for the sample JPGs, showing the single version being 12.91% larger than the layered results:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered C3D___________93517___74.742___88.57
Single C3D___________105589___84.391__112.91
I'm really amazed at the results at this stage, and might have just encoded the layered results right here. However, I continued to process a little more, to get some additional noise reduction and a wee more sharpness.
Finally, both Layered.avi and Single.avi were fed to VirtualDub using the following AVS, that applied a slight blur, in preparation for WarpSharp in VirtualDub:
source=AVISource("C:\[filename].avi")
Blur(source,.50)
Please see L6BlurAdded.jpg and S3BlurAdded.jpg for samples of the results. Both are a tad blurry (duh!,) but most of that will get fixed next. As always, the layered caps results are much cleaner than the single cap. The single layer JPG is still 7.57% larger than the layered results:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered Blur__________83161___66.466___92.96
Single Blur___________89458___71.498__107.57
Now with the blur AVS scripts loaded in VirtualDub, I applied WarpSharp 1.1 at a strength of 32, then Border Control to matte 8 pixels all around the image, and saved new final AVIs. Please see L7WarpSharp&BorderControl.jpg and S4WarpSharp&BorderControl.jpg for a sample of the final results. Comparing the JPG file sizes shows the single cap version still 6.45% larger in size:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered WS&BC_________81054___64.782___93.94
Single WS&BC__________86286___68.963__106.45
Last, but not least, I compressed both of the final AVIs in Cinema Craft Encoder SP (CCE SP) v2.66.01.07, using the following settings, and bitrates:
- 1-pass VBR Min=2Mb/s Max=15Mbs (not DVD compliant)
- Q settings of 3, 15, 30 and 60
- All built-in filtering disabled
- GOP 3/5
- Quantization matrices set to MPEG Standard
- Quantizer Characteristics set to 16
- Sequence End Code and DVD Video Compliance unchecked
- Zigzag Block Scanning Order
Please see L8FinalMPEG.jpg and S5FinalMPEG.jpg for sample screen captures, taken with PowerDVD. You can see the additional noise, in the single cap version. That little bit of extra nose may not seem like much, but when the MPEGs are played back at full speed, there is a big difference in visible noise! Here is the screen capture file size comparison, showing the 5.11% increased file size. That is all additional noise!:
Stage_________________Size__Compres%__Layered vs Single Compres%
Layered Final MPEG____89875___71.832___95.14
Single Final MPEG_____94470___75.504__105.11
Lastly, I encoded MPEG-2 files at various 1-pass VBR rates-- Q setting 3, 15, 20, and 60. At Q3, there is only a 2.14% difference, but this is due to both of them getting capped at the max bitrate. At Q15, Q30, and Q60, the single cap is larger by 20.11%, 19.43%, and 26.1% respectively. Those are huge bitrate savings, and the only difference was using layering!:
Stage_________________Size__Compres%__Layered vs Single Compres%
Q3 Layered_________41477352_____________97.9
Q3 Single__________42366568___________102.14
Q15 Layered________26543604____________83.26
Q15 Single_________31881288___________120.11
Q30 Layered________15899872____________83.73
Q30 Single_________18989616___________119.43
Q60 Layered_________8199844____________79.30
Q60 Single_________10339812___________126.10
If you would like to see what the final MPEG videos look like, you can download them from the following links:
http://www.fasttimesatridgemonthigh.org/vidcap/files/layered60.m2v (8.9MB)
http://www.fasttimesatridgemonthigh.org/vidcap/files/single60.m2v (10.1MB)
My conclusions:
There are several things that I think I have been proven by my testing. The following only relates to VHS material, as I have not tested yet with higher quality source material. If you disagree with anything, please speak up, so I can do further testing to address your points.
First, that layering (averaging) clearly helps reduce noise, increases the effectiveness of further post-process filtering, and increases compression by 20-25%.
Second, that blur filters, when used correctly, are not evil, and can have a positive effect on both noise reduction, and image quality.
And last, that Convolution3D is one kick-ass filter! I find the defaults way too heavy (like most filter defaults) but, works well when toned down. I've only played with it for about a day, so I still have lots to learn about using it to best effect.
I'd like you to play around, comparing the different samples I provided, for some interesting insight. For example, compare any of the source caps with L8FinalMPEG.jpg, and see if the blur filter hurt the quality (and be prepared for a shock.) Or compare L5Convolution3D.jpg with L7WarpSharp&BorderControl.jpg, for the amount of noise reduction vs the tiny bit of blur. There are lots of ways to compare the samples to each other.
The time to do the this testing, and write this message was about 12 hours (most of it was writing this damn message,) but I think it was time well spent. The issues of filtering is probably one of the most difficult aspect of desktop video (especially analog video) to do learn to do effectively, and at the same time, is the most important factor in image quality! There are very few resources on the net the talk in-depth about filtering, and I hope the doom9.org forums will consider creating a forum, just for this specialized subject.
In closing, I'd like to invite everyone to try these tests for themselves, on your own footage. The only needed software is VirtualDub, AVISynth v2.x, HuffYUV, Decomb AVISynth plugin, and Border Control and WarpSharp 1.1 VirtualDub plugins. Then, just use all the sample AVS scripts, above. Here are software links:
VirtualDub http://www.virtualdub.org
AVISynth http://www.avisynth.org
HuffyYUV http://math.berkeley.edu/~benrg/huffyuv.html
AVISynth and VirtualDub plugins http://shelob.mordor.net/dgraft/
Hope you found this interesting and helpful. Let the debates begin. :)
Update:
I thought I'd also compress the raw original, unfiltered/unprocessed "Single.avi", for comparison with how much the filtering improved compressibility. Below is MPEG-2 file size of the unprocessed Single.avi vs the layered and processed version. All CCE encoder settings were the same as mentioned previously:
Stage Size Processed vs
Q3 Layered 41477352 Unprocessed Compres%
Q15 Layered 26543604 59.22
Q15 Single Unprocessed 44824240 168.87
Q30 Layered 15899872 41.98
Q30 Single Unprocessed 37877524 238.23
Q60 Layered 8199844 42.84
Q60 Single Unprocessed 19142548 233.45
Ouch! Unprocessed is 69%, 138% and 133% larger. Also notice, a Q3 encode on the layered and processed source for less bitrate as a Q15 encode of the raw footage!