Log in

View Full Version : Problem with variable darkness band in top of video


rcubed
27th February 2010, 10:05
Hi,
I have a video capture HD with my Canopus Pegasus capture card which captures Component video in YUY using the Canopus HD codec. As a side note although I capture in HD I process them in AVIsynth to an SD format. I've haven't had the money or time move to authoring Blu-ray DVDs. I've noticed when the videos are encoded and viewed on my TV there is a area in the top of the frame which has a darkened band in that area which is most noticeable when that area is low brightness;. This variable band is present in the top 2" of the 25.5" vertical dimension when viewed on my 52" LCD TV. If the frame is sufficiently bright the band is not visible.

I have done a VideoScope on a similar video which was letterboxed. The band shows up as a light grey area in this case. Using VideoScope("both",true,"Y"). I have attached a PNG of the VideoScope image. The right hand graph instead of a straight line offset from the base line of the graph shows a negative bow in the affected area. Is it possible to correct this by using a filter that subtracts various amounts from the appropriate color space parameter (correct terminology?) value by scan line(?) to correct it back to a straight line in that area and hopefully get rid of the grey band. I've read descriptions of the YUY format, and if I am reading things correctly this is the luminance parameter if not please educate me.
***** Edit ****
I added a png of a similar letterboxed video where the grey band is not present in the video for comparison. I hope the size is sufficient to show the differences. All are frames from raw files as captured by the Canopus Pegasus Capture Card.
******** End of Edit
Or are other parameters going to need correction also because of the problem? Or is it impractical or impossible to correct this?

I would hope applying this same correction to my videos that are not letter boxed in that area would get rid of the band. I have looked at various filters, but I am not two skilled in this area :stupid: and have not found one that seems to apply.

I am hoping the gurus here in the AVIsynth forum can help. You have been most helpful in the past :thanks:

Please be gentile I'm a virgin in this area of AVIsynth.:)

With much appreciation in advance.

rcubed

rcubed
2nd March 2010, 06:53
Hi,
For reference this is what the band looks like when the DVD is encoded and displayed on a TV. This goes with the 1st histogram posted earlier. The histograms were of a totally blank frame.

The 1st picture is from a non blank frame when the capture shows a band. The finger points to the bottom of the band.

The second picture is when there is no band in the capture and corresponds to the 2nd histogram (the 2nd histogram was from an earlier frame that was blank).

The bow would be in the same place whether or not there is a picture since that is in an area of the frame which is letter boxed.

No takers, or suggestions? Thanks in advance. :thanks:

rcubed

Si
26th March 2010, 07:43
Hi
Got your email and came to this thread.

Could you post a link to a short avi file that shows the problem please as I don't understand the pictures :)

regards

Simon

rcubed
4th April 2010, 10:00
Hi
Got your email and came to this thread.

Could you post a link to a short avi file that shows the problem please as I don't understand the pictures :)

regards

Simon

I have uploaded a sample of an HD video captured from cable with the filter box in the Y leg of the component video cable. Without the filter there is no bow present. (The filter produces a more stable capture environment - less capture interruptions). The original video was 1920x1080 29.97 fps and this video has been processed by cropping 16 on the top and 4 on the right and then Spline36Resized to 720x480 to get the sample to upload. (normally at this point I would encode the video using HC Encoder with the 16:9 flag set - in the sample the frames will appear compressed in the horizontal direction, it displays properly on a 16:9 TV and fills the screen).

I saved the sample at the 720x480 point using the Huffy codec, since not many people would have the Canopus HD Codec and a 1920x1080 video would be prohibitive to upload and download.

The sample video can be downloaded from:
http://rapidshare.com/files/371790413/ShortSample.avi.html
MD5: 1F48825E8A153F5D973E82C2D1D860EA

To illustrate the bow, down load the video for example to the C:\ drive and run the following avs script into VirtualDub. Change the download target and reference in the script as necessary.

AVISource("C:\ShortSample.avi")
ConvertToYUY2()
VideoScope("both",true,"Y")

The videoscope plugin needs to be downloaded from here:

http://avisynth.org/warpenterprises/

and needs to be installed in the AVIsynth plugins folder.

I have included a jpg of frame 70 of the sample as seen with the the script to better illustrate the situation.

In the jpg the bow is in the top of the frame in the luminance graph to the right of the video frame when viewed in VirtualDub using the supplied script.

Running this script from the beginning a watching the graph it (hopefully) is obvious that this bow is actually present at all luminance levels (see frames 0 and 1 for example). However the effect of the bow to the left (or lower luminance levels) is most noticeable at low luminance (dark scenes in a video) and appears as a darker band across the DVD when encoded. In the attached jpg of frame 70 one can see the bow goes below the normal black luminance level which is represented by the bright white line that extends for most of the right hand graph below the bow. The actual black level is about two units wide for the most part with some noise above and below this. Using frame capture to clipboard and importing to an image editing program and expanding the image will make seeing the band easier and the details of the luminance level more obvious.

I have made some attempts to get rid of this in the following way. I did video captures of letter boxed video where the band area is in a black area of the screen with and without the filter. Using VirtualDub I copied via clipboard a sample frame from each of the videos to a photo editing program.

I used Photo Paint to do the image manipulations (mainly because that is the best image processing program I have available - I concede others might be better, one does with what one has:)). I took the two sample frames and left the top area (1st 120 pixels) untouched (note this is in a 1920x1080 frame - the boundary will be different in the sample compressed video). In the 1080 version the point at which the bow rejoins the reference black level is about 93 pixels down from the top, in the compressed frames it appears to be at about 48 pixels). Call these "bow" frame and "normal frame". The bottom of the frame (horizontal pixels 120+ to the bottom of each frame) I set to a RGB level of 0,0,0. I also built frame with the top area with RGB levels of 8,8,8 to 16,16,16. I then save these jpgs. Using an AVIsynth script I read the jpgs in using ImageSource. I then used Overlay to subtract the bow frame from the normal frame. The idea is to produce a luminance curve which is the mirror image of the bow to the left. I used Imagewriter to save this "correction" frame as an .ebmp file. See attached jpg for luminance curve for the correction frame.

I then would process the video using this "correction" frame replicated to equal the number of frames in the video and using Overlay with "add" to correct the luminance bow against all frames in the video. This works reasonably well, but still has some problems, mostly due to noise in the the original video. I have checked this on a capture with black in the top 120 pixels (scan lines) and the resultant luminance plot is a mostly straight line from top to bottom.

I also experimented subtracting the "bow" jpg from the various constant RGB level frames. Choosing the RGB level that most accurately lined up with the base black level luminance level line in a trial and error method. However for the constant RGB level cases I found it necessary to add gaussian noise to the jpg frame to dither the correction. This produced a better DVD image, but introduce more noise in the resultant video. A constant RGB level of about 14,14,14 seemed to work best for this case.

Both of these methods do diminish the noticeably of the band in a resultant video as seen on TV, but is still lacking in some areas. I have been work in the REC709 colorspace to produce a correction curve that is 0 referenced, but this has the effect of introducing some noticeable problems where the curve rejoins the black reference level. Since the correction curve is clipped at 0 and the "negative noise" in the correction curve at this point is lost. I don't know how to get around this. Any suggestions?

Would working on the luminance levels directly be better than doing it by creating jpgs and basically working in the RGB domain? Or is the process equivalently the same (I don't know how to ask this more eloquently)? I'm out of my experience level on how to do this with luminance if that is a more reasonable way and possible.

If anyone has suggestions on a better method, ideas, I would appreciate any help :stupid: on some aspects of this.

:thanks::thanks::thanks: in advance. If any additional information is need please ask and I'll try to supply it. This is putting a damper on my HD capture experience:o.

rcubed

PS
The movie portions of the captures from cable are typically Telecined. I normally do a Tfm/Tdecimate on the movie to get back to a 23.xxxx fps video and then do the encode using 3:2 pulldown. I did not do this to the sample I uploaded to avoid causing any confusion. Sorry that the captures are from a commercial in the program, but they best illustrate the problem. The decimation process has no effect on the banding issue.

Si
4th April 2010, 14:22
I can't see anything wrong with your capture :)

I'm sure if I dived in and examined it detail - it would have some slight distortion but its below my personal annoyance threshold - sorry :)

Maybe someone else with better eyesight will be able to help.

regards

Simon