# Convert 4:3 to 16:9 and improve video quality

1. Hi All,

I have two questions.

1. Is this the correct way to convert a .avi file from 4:3 to 16:9, using virtualdub, or is there a better way?
http://tinyurl.com/ljeuw7t

2. What filters do I need to improve the following video?

http://tinyurl.com/le7xr2h

Thanks
2. Neither link works for me.

3. Not again.

Why waste your time? The source is 4:3. Why don't you just stretch it during play or encode it as 16:9 if you want to see it stretched out and distorted.

4. Oh, you got it to work? I tried with both Firefox and Chrome and got nothing.

But if it's as you say, there's no point in getting it anyway. This is VideoHelp.com and not VideoScrewUpYourMovies.com
5. Links worked for me in Firefox, but the movie link opened in VLC player by default (VLC can't handle YUV Lagarith at all. Talk about a screaming horrible image!!). Had to download the clip to see what it looked like in another player. Too lazy to set Firefox for another default AVI player.
6. The proper way to make it into 16:9 is to add pillarbox bars. But the player or TV will do that on playback so there's no point in encoding it that way.

The other "correct" way is to crop 60 lines off the top, 60 lines off the bottom (or an uneven mix adding up to 120 lines) then resize back to 720x480 (for DVD encoding) or to a 16:9 frame size. But that will lose 25 percent of the picture. And the video is interlaced so you'll have to use interlaced resizing which will degrade the picture.

The levels need fixing. Blacks are too bright, brights not bright enough. Colors could use sharpening.
7. The sample video is very soft and already looks over filtered. It doesn't look like a direct copy off tape, but more like someething that's been around the block a time or two. The colors look corrupt (but that could be in the original broadcast), and I see banding and other compression artifacts. What was the original source? Tape? Previous encode? How did you get it onto your computer?
8. Originally Posted by sanlyn
The sample video is very soft and already looks over filtered. It doesn't look like a direct copy off tape, but more like someething that's been around the block a time or two. The colors look corrupt (but that could be in the original broadcast), and I see banding and other compression artifacts. What was the original source? Tape? Previous encode? How did you get it onto your computer?
Hi Sanlyn,

I purchased this video from my local school system on DVD. I just took the VOB files from the DVD and combined them into one file using vobmerge, and open it in virtualdub. I'm not sure how the high school transferred the video. This video does look like the original broadcast back in 1982. Are there filters to help improve the colors, banding, and artifacts?

Thanks!
9. There are many filters for those tasks, but problems such as banding, block noise, etc., have to be removed by decoding the VOB or combined MPG intolossless media (using a lossless compressor such as Lagarith to save disc space). They have to be processed in their original YUV colorspace. Avisynth wouyld be the best tool for that. One could also correct the low contrast and/or higher than nomal black levels in AVisynth, buyt nthe color problems wouyld respond best to filters that address specific color ranges, such as ColorMill or gradation curves. I would advise that you not attempt correcting artifacts in the usual NLE software such as Pinnacle or Vegas, etc. -- their image repair filters concerning banding and other problems mentioned are not as effective as those in Avisynth. Opening the videos directly into VirtualDub will make debanding and other repair more difficult.

This kind of repair and cleanup involves a learning curve and takes time. There's no one-button solution. If you decide to pursue that avenue, there are many members who can help. You would find it difficult at first. It depends on what you expect for results.

Below, I decoded the MPG sample to lossless AVI and made up a quick color and levels adjustment with ColorMill and gradation cirves, to get a "before & after". While the color in the original isn't all that bad, it looks as if it might not have been broadcast as the best the creator could have devised. It's improved, but "correct" with video is a matter of personal preference. This would be one of the easier scenes, but unfortunately VHS color and levels vary wildly from scene to scene. I did no denoising or artifact work, and no sharpening here. The original video isn't horrible, but it would require lots of effort. After making other repairs, youy would have top re-encode for DVD or other output. Depends on how far you want to go with it.

[Attachment 20060 - Click to enlarge]

[Attachment 20061 - Click to enlarge]
10. Originally Posted by sanlyn
I'm guessing that the source DVD is from something that was re-encoded in an editor. We might know more about those artifacts if we had info from a VOB in your original DVD. You can get that info by opening a VOB in the free MediaInfo utility, using its "Tree View" window -- In MediaInfo's top ,menu click "File..." -> "Export" -> then click the "Text" tab, click the "Advanced mode" button, give the text file a location and name, and click "OK". You can attach that text file in your reply, or you can copyright from the text file and paste the text of its report in forum reply window.
Attached is one of the original VOB files.

Thanks
11. Thanks for your effort here. From MediaInfo off the VOB and looking at the avi sample: the original broadcast was recorded to analog tape. From there, it appears to have been captured directly to MPEG2, perhaps using a DVD recorder, at a 2-hour bit rate of 4500 VBR. Because most football game broadcasts last longer than 2 hours, I assume some commercials or other material was cut from the original MPEG transfer; the AVI video looks to be over filtered in some way. At least it appears to have been played/recorded using a line-level tbc of some sort, so give the maker credit for that. I'm guessing that some form of noise filtering has occurred because I see remnants of tape noise rather than the usual noise itself. Why the black levels are high is anyone's guess; it could have been digitized that way, or it could have been broadcast that way. In any case, some highlight detail has been blown away in the process and can't be recovered.

A 4500 bitrate is about average for this sort of thing, but it's too low for fast-action sports videos. In particular with noisy analog source, lower bitrates mean less data to describe elements of the image. Less data means not enough data to correctly render subtle chroma garadations in large areas such as solid color sky or wall surfaces. There is also less data to control motion and edges in a cleaner way. Strong filtering and/or playback DNR will soften images if not used carefully. Further, if the MPEG transfer was first edited in a non-smart rendering NLE while in a lossy MPEG2 state, the MPEG was likely re-encoded -- which worsens the bitrate problems. If the processing involved careless colorspace conversion from YUV to RGB and back to YUV, there are subtle color problems.

Debanding can incur a softening look to images that are already soft. It makes debanding kinda tricky here. You can't sharpen very much if you want to deband, because sharpening worsens banding and other defects.

Well, we've seen much worse (many "problem" transfers posted in this forum would make you weep). I'll see what I can come up with to spruce up the AVI, and other members might have some ideas.
12. The corrupt color took a bit of work. Apparently the tape has degenerated; there is blue discoloration now and then and a slight border stain at the left, and the blue channel is a mess. The attached m2v at the end shows some edge noise on the press box frame (it's in the original). Fast motion and low bitrate can have that effect; I used santiag to help keep it from looking worse, at least. There's a routine that fixes it more, but it's slow and should be run by itself in a separate script. The script was slow anyway (about 4.75 fps), but it does a lot of work. Encoded with HCenc.
Code:
# ##=== AVisynth plugins used:
#- QTGMC-3.32.avsi)
#- WarpSharp
#- Hqdering.avs
#- DeBlock_QED
#= Santiag
#- LSFmod.avsi
#- Dither.avsi
#- mt_xxpand_multi.avs
#- avstp.dll
#- dither.dll
#= GradFun3 (in the dither puugins package)

AviSource("Path\to|video\GWHS_Test.avi")
AssumeTFF().QTGMC(preset="fast")

ColorYUV(cont_y=30,gain_y=10)
ColorYUV(cont_v=-120,off_v=3)
ColorYUV(cont_u=-135,off_U=-2)
SmoothLevels(16, 0.90,255,16,240,chroma=200,limiter=0,tvrange=true,dither=100,protect=6)
SmoothTweak(saturation=1.8)
MergeChroma(awarpsharp2(depth=30))
HQdering()
Deblock_QED(quant1=40,quant2=40)
santiag(1,2).TurnRight().Santiag(1,2).TurnLeft()
LSFmod(defaults="slow")
AssumeTFF().SeparateFields().SelectEvery(4,0,3).Weave()
return last
Black levels are different for each scene. A typical problem with tape. The only fix is to work with separate segments individually. With sports, that could take forever.
13. Originally Posted by sanlyn
The corrupt color took a bit of work. Apparently the tape has degenerated; there is blue discoloration now and then and a slight border stain at the left, and the blue channel is a mess. The attached m2v at the end shows some edge noise on the press box frame (it's in the original). Fast motion and low bitrate can have that effect; I used santiag to help keep it from looking worse, at least. There's a routine that fixes it more, but it's slow and should be run by itself in a separate script. The script was slow anyway (about 4.75 fps), but it does a lot of work. Encoded with HCenc.
Code:
# ##=== AVisynth plugins used:
#- QTGMC-3.32.avsi
#- WarpSharp
#- Hqdering.avs
#- DeBlock_QED
#= Santiag
#- LSFmod.avsi
#- Dither.avsi
#- mt_xxpand_multi.avs
#- avstp.dll
#- dither.dll
#= GradFun3 (in the dither puugins package)

AviSource("Path\to\video\GWHS_Test.avi")
AssumeTFF().QTGMC(preset="fast")

ColorYUV(cont_y=30,gain_y=10)
ColorYUV(cont_v=-120,off_v=3)
ColorYUV(cont_u=-135,off_U=-2)
SmoothLevels(16, 0.90, 255, 16, 240,chroma=200,limiter=0,tvrange=true,dither=100,protect=6)
SmoothTweak(saturation=1.8)
MergeChroma(awarpsharp2(depth=30))
HQdering()
Deblock_QED(quant1=40,quant2=40)
santiag(1,2).TurnRight().Santiag(1,2).TurnLeft()
LSFmod(defaults="slow")
# ##=== reinterlace === ##
AssumeTFF().SeparateFields().SelectEvery(4,0,3).Weave()
return last
Black levels are different for each scene. A typical problem with tape. The only fix is to work with separate segments individually. With sports, that could take forever.
Hi sanlyn,

I just wanted to say thank you for taking the time to show me this. This really helps! I have to ask this one question. Where can I go, or is there a document that will show me all the different issues that can occur with old video? Example, when you talk about banding, and block noise. I have know idea what this really looks like since I never heard of it before. Is there a website or something that will show these types of issues with a screen shot example?

Thanks!

Matt
14. Originally Posted by mlong30
Where can I go, or is there a document that will show me all the different issues that can occur with old video? Example, when you talk about banding, and block noise. I have know idea what this really looks like since I never heard of it before. Is there a website or something that will show these types of issues with a screen shot example?
This site has lots of examples. Search for the terms and you should find some.
15. Banding/block noise: it happens that this particular video had the beginnings of mild banding in the flare of stadium lights against a dark sky. Likely few viewers would notice, as the submitted avi is a soft image that has been through some denoising. That softness does become a problem when you try to remove remnants of simmering tape noise in the dark areas (which will cause more softening) and then try to sharpen the results. You can see that the flare consists of soft detail, mostly very fine grain. Remove the grain, and it would remove the data that defines the soft gradations between flare colors and dark sky. The flare will develop one or more hard edges along the outer perimeter; this is made worse by re-encoding the results. The trick was to remove noise and grain, sharpen, and then add just enough fine grain to preserve the soft gradations and avoid hard edges upon re-encoding.

There was little in terms of clumps of hard grain or macroblocks -- but by the same token, previous denoising has smoothed clumpy grain away but left a very soft image with little fine detail. Unfortunately it's not possible to restore fine detail that has been smoothed to oblivion. You see this loss of detail in the turf textures and in distant faces and clothing. But oversharpening would generate hard effects called edge halos and ugly thingies called "clay face" effects and posterization in shadows.

The biggest problem was corrupt color. That was fixed (mostly) by using lots of experimentation in the ColorYUV statements. While much of the original detail couldn't be restored, the perception of a "sharper" image is mainly the result of color correction, smoothing out the "blue fog', and setting proper black levels.

Here is an extreme example of banding (http://en.wikipedia.org/wiki/Colour_banding), and a post from another forum discussing more common forms of banding and attempts to fix it (http://forum.doom9.org/showthread.php?p=1446041#post1446041). In the latter link, click on the images to view them enlarged.

And here are extreme macroblocks: http://en.wikipedia.org/wiki/Macroblock. I didn't encounter that in this video, but some subtle macroblocks could have been generated if care had not been taken with those floodlights.

Statistics