Downscaling Video

Movick wrote on 5/23/2010, 5:50 PM
Hello,

I’m having some problems with a render to MPEG-2 for DVD. I shot SD footage 60i@16:9 and I am downscaling it approximately 18% so I can add an information border at the bottom and on the right side of the frame (overlay). When I downscale the video I notice it looses some clarity (Vegas preview window); I applied some light sharpening and it seems to look fine. When I render the MPEG-2 from the timeline it looks good when played on PC; however when played on DVD to TV it doesn’t look as clean as the original clip: I see traces of atrifacting in skin tones and an overall less clean appearance to the image.

Another forum member (thanks PD) brought up a good point and stated I was likely reducing the video’s resolution by downscaling it. Is the problem I’m experiencing due to the resolution reduction or can it be related to the MPEG-2 compression itself? Is there anything I can do to straighten this issue out?

Any help would be tremendously appreciated.

Thanks in advance,

Mov

Comments

musicvid10 wrote on 5/23/2010, 6:53 PM
Is the video such that you can just overlay the info bars without changing its size?
That would be the preferred method to retain sharpness.

Otherwise, you are going through a deinterlace / reinterlace process.
What deinterlace method is selected?
Are you rendering to interlaced or progressive?
Are you rendering at Best?

The first two questions you can play around with to determine what works best with your video. The last question your answer should be "yes."

Also, what are the bitrates of your video source and your renders? How long is the video?
Movick wrote on 5/23/2010, 7:59 PM
<<Is the video such that you can just overlay the info bars without changing its size?>>

No – the video would be cut off in too many places.

<<What deinterlace method is selected?>>

Interpolation.

<<The first two questions you can play around with to determine what works best with your video. The last question your answer should be "yes.">>

Of course – never anything but best.

<<Also, what are the bitrates of your video source and your renders? How long is the video?>>

8,000,000
This is only the first 40 second segment – length is not the issue yet.

There must be some solution.
musicvid10 wrote on 5/23/2010, 9:07 PM
Interpolation throws away half the information. That doesn't mean it is worst in all situations, but try blend. That being said, both these methods in Vegas are primitive. Try the Mike Crash "smart deinterlace" filter as a possible alternative.

If these alternatives do not work as you desire, look at AviSynth options. The learning curve is steeper, but you will have more choices. Our fellow user Nick Hope has far more experience with this utility than I do.
Movick wrote on 5/24/2010, 1:42 AM
MV,

Thanks for the reply. I tried blend but it looks identical to interpolate. I read up on the plug-ins you mentioned and I’m not clear on how they will help. I e-mailed Nick Hope and perhaps he can shed some light on this mess for me…hopefully!!

This can’t be an impossible problem to resolve – I see video rescaled all the time in Tv programs, commercials, etc. etc. I’m surprised Vegas can’t do a better job of this!!

Thanks again,

Mov
musicvid10 wrote on 5/24/2010, 9:08 AM
The MiKe Crash plugin will do a better job because it only works on motion frame differential, so detail in non-motion areas is preserved. You will lose some detail to the second encode, that is unavoidable.

You should also try my other suggestion, which is to compare progressive vs. interlaced renders. I don't know how much difference it will make in your case.

If you want to upload a short clip of your video along with your VEG project somewhere, others would be glad to take a look at it and make suggestions. Broadcasters start with high-bit source and have better encoders than we mortals, so the results do not show the effects of resizing as much.

I understand you are taking SD material, reducing in size and adding info bars, then rendering to SD for DVD delivery. Is that correct?
John_Cline wrote on 5/24/2010, 11:45 AM
Since there is a lot of motion involved in this particular video, deinterlacing to progressive and throwing away half the temporal resolution is not what you want to do. Vegas rescales interlaced video by "unfolding" the frames into their field components, rescaling the fields (which are progressive by nature) and then reinterlacing the fields back into frames. This is exactly how it should be done.

The fact that the image goes soft when scaling has nothing whatsoever to do with interlacing. Let's face it, 720x480 pixels isn't much to begin with and if it's widescreen, that extra width is still represented by only 720 pixels. If you take a widescreen image, which is essentially 854x480 pixels (but only represented horizontally by 720 pixels) and scale it down to 640x360 (which really ends up being only 539 pixels wide) to fit in a frame then you WILL lose some resolution. The picture is now being represented by fewer pixels and that resolution is gone forever. This is further complicated by the fact that widescreen SD video is anamorphic. They are squeezing 854 horizontal pixels of data into an actual image dimension only 720 pixels across and the playback device expands it back to 854 pixels wide on playback. Unfortunately, there is NO way to get 854 pixels of resolution out of 720 pixels. Those extra pixels are interpolated and the image will look softer than if it had been a real 854 pixels of resolution.

To look at it another way, let's say you have a photo that is 4000x3000 pixels and has been printed on paper to be 12 inches by 9 inches. Holding it 2 feet away it will appear to be a specific size. Move it 4 feet away and it will appear smaller but it will still be represented by 4000x3000 pixels. You have scaled it down in size but haven't lost any of the images original resolution. It will still be as sharp, just smaller. This can't be done in video. You have a fixed image dimension and when you make an image smaller it is represented by fewer pixels, it can't help but look softer.
Movick wrote on 5/24/2010, 1:23 PM
Gents,

Thanks for taking the time to explain some of the technicalities of this. My suspicions were confirmed regarding a better MPEG-2 encoder as my first run through CCE as suggested by Nick Hope (thanks amigo!!) seems to offer a cleaner, crisper image (on PC for the moment) than the Main concept MPEG-2 plug-in in V5. I realize that there are limitations to SD, but I also know the XL2 has been used extensively in Indy films the world over with notably impressive results; my footage is exceeding simplistic/minimalistic (by design) - shot in a cyclorama studio with proper lighting and competent, simple camera moves were used exclusively. I should be able to deliver a respectable end product once I dial in the nuisances…or so I hope and pray!

I will burn another DVD shortly after I fiddle around with the settings in CCE so that I can compare the different settings on the TV screen side-by-side.

As I am rendering .avi from the V5 timeline, may I ask what the absolute best output settings would be so as to maintain maximum clarity of my footage? I initially used the built-in “DV widescreen” template, but it doesn’t specify uncompressed video in the info window at the top of the property box.

Thanks a million fellas – I can’t thank you all enough for your time and patience!!

Cheers,

Mov
farss wrote on 5/24/2010, 1:33 PM
One problem that no one has mentioned is that NTSC DV is 4:1:1 and DVDs use 4:2:0 chroma sampling. This is in part why HD in NTSC land produces much better looking SD DVDs than shooting DV.
The expensive "broadcast" SD NTSC cameras shoot Digital Betacam which has 4:2:2 sampling.

Bob.
John_Cline wrote on 5/24/2010, 1:55 PM
For absolute maximum clarity, you should either render out uncompressed or using an uncompressed coded like Lagarith.

http://lags.leetcode.net/codec.html

Rendering to DV, which has a 4:1:1 colorspace and then encoding to MPEG2, which has a 4:2:0 colorspace gives you a final product which is 4:1:0 and that has only 12.5% of the original color resolution.

Vegas works in RGB which is essentially 4:4:4 color sampling. Even though you're starting with 4:1:1 DV footage, color sampling is particularly important since you have generated the border with some text and that is all generated at 4:4:4 within Vegas. Rendering to uncompressd will maintain the 4:4:4 and when encoded to MPEG2 the final will be 4:2:0, which is the maximum color sampling resolution of the DVD format. If you render to MPEG2 directly out of Vegas, it will not be a concern.

When rendering to AVI, choose the "DV Widescreen" template, then hit the "Custom" button and on the Video tab, that is where you can change the codec to either uncompressed (which will generate excellent but HUGE files) or Lagarith (once you install it) which will also produce maximum quality but with somewhat smaller files.

I have found that CCE gives perhaps the best results from progressive footage and Canopus Procoder give the best results with interlaced video footage. Procoder is quite expensive compared to the basic version of CCE.

Before you give up completely on the Vegas MPEG2 encoder, Make sure you have selected the "DVD Architect NTSC Widescreen video stream" template, then hit the "Custom" button and make sure the quality slider on the "Video" tab is set to "31." This ensures maximum motion quality and then go to the "Advanced" tab and set the "DC coefficient" to "10 bits." This will maintain subtle color gradients better and help with the "blotchy" look.

One final thing, other than DV format AVI files, AVI files do not contain a flag in their header that tells the encoding program that they are widescreen. You will have to specifically tell the encoder that your source AVI file is widescreen so it will handle it correctly. The resulting MPEG2 file will have the widescreen flag set.
Movick wrote on 5/24/2010, 2:30 PM
Bob – I realize the DV limitation; I plan upon getting geared up for HD for the next project; for now I must make the best of what I have. The footage looks pretty swell out of the camera – there must be a way to preserve the clarity somehow!!??

JC – again thanks for the insight. I am rendering the clip as I type as you’d suggested. I must say that I didn’t notice any settings which were different in the custom tab other than the aspect ratio. The default for the DVDA widescreen template was “31” on the slider and the default VBR setting. Are there any other differences within this template as compared to the default template coupled with the custom settings I used previously?

I also changed the DCC to 10 bits as per your suggestion – I hope it will help!

PS – Using the DV Widescreen template for rendering .avi, when I click the custom tab and select “uncompressed” from the video format, the frame size drop down doesn’t include a widescreen setting. When I select “use project settings” it renders at a 4:3 aspect. If I enter the numeric pixel value for 16:9 it renders out correctly, but CCE won’t open a file exceeding 720X480 pixels. Is the “DV Widescreen” template uncompressed or is there some workaround to get widescreen uncompressed as an .avi?

Thanks!!

Mov
John_Cline wrote on 5/24/2010, 5:05 PM
DV Widescreen is NOT uncompressed but select that template anyway and chenge the codec on the "Advanced" tab to "Uncompressed" and the image dimensions to 720x480 but change the aspect to 1.2121 instead of .9091. That will give you a standard-definition anamorphic 16:9 widescreen file.

This can get really complicated and there is a lot of math involved. You need to consider that there is the actual image dimensions in pixels and then the PAR (Pixel Aspect Ratio) and DAR (Display Aspect Ratio.) The PAR and DAR can be (and often are) two different values.

Standard Definition video is 720x480 and has a display aspect ratio of 4:3 (or 1.3333 to 1) but the pixels themselves have a PAR of .9091 to 1. They are taller than they are wide. If the pixels were square, then 4:3 would be 640x480. With rectangular pixels, 720 are squeezed to fit in the same horizontal space as 640 square pixels.

Standard definition widescreen is still 720x480 actual pixels but has a DAR of 16:9 (or 1.77777 to 1) with a PAR of 1.2121 to 1. In this case, in order to fill a DAR of 16:9, these 720 horizontal pixels have to be expanded to fill the same space at 854 square pixels.

Like I said, AVI files do not have anything in their header to specify whether it's 4:3 or anamorphic 16:9, both of them are 720x480 just with a different PAR. Vegas needs to know what aspect ratio you want so it know how to deal with the video, but it doesn't store this info in the resulting AVI file. If you tell Vegas to make it widescreen then it will render it as anamorphic widescreen but you will have to tell the external MPEG2 encoder that's what it is.
Movick wrote on 5/24/2010, 5:16 PM
JC,

I realized that the aspect ratio would need to be 1.2121:1 - in fact when I changed the video format to "uncompressed" the value was already in place. The frame size I chose was NTSC DV 720X480 as no widescreen option exists. When I render it out and play back in WMP the image is 4:3. Is this what should be happening or am I missing something?
John_Cline wrote on 5/24/2010, 5:32 PM
Yes, that's exactly what should be happening. Since there is no DAR or PAR flag in the AVI, WMP (or any other player) has no idea that it's widescreen. They are only displaying the image in its pixel dimensions. Actually, they aren't even displaying it with a 4:3 (1.333:1) aspect ratio since 720x480 is really 1.5:1 and that doesn't correspond to a DAR of either 1.3333:1 (4:3) or 1.7777:1 (16.9.) I told you it was complicated. :) You will notice that the image is squished and that people look taller and thinner than they should. This is the indication that the file rendered correctly.

When you pull the file into CCE, it isn't going to know that its widescreen either. You will have to tell CCE specifically to treat the input file as anamorphic. MPEG2 files DO have a widescreen flag in their header so once it's been encoded to MPEG2 you won't have to tell DVD Architect that it's widescreen DVDA will already know.
Movick wrote on 5/24/2010, 5:44 PM
Had I only known!!! :) I'll see what CCE does to to this file now. Seems when I right click on the file name in CCE it brings up a settings window. Am I looking for simply 16:9 or anamorphic setting?
John_Cline wrote on 5/24/2010, 7:07 PM
Yes, 16x9.
NickHope wrote on 5/24/2010, 11:21 PM
Movick, in answer to your last email to me, and to repeat what JC has just explained, at no point in any of your process should you be looking for a width of more than 720pixels in any project or render settings. Widescreen DV/DVD is anamorphic (720 rectangular pixels across), not 853 (or 854) square pixels.

I'm wondering whether a resize in Virtualdub might be worth trying. It's more user friendly than AVIsynth and it's easier to try different options.

Start off by installing VirtualDub and also the Lagarith lossless codec.

Open up your original video file in VirtualDub (that could either be your original untouched DV file or an avi framserved or rendered out of Vegas with fx etc that you might have added), go up to the Video dropdown menu and make sure full processing mode is checked. Then go Video > Filters > Add > Resize.

Here you have different options for resizing your video, but I normally use Lanczos3 at the bottom of the Filter mode list. This should be more sophisticated than the resizing you would do in Vegas. I'm no expert on these different resizing algorithms however.

Once the resize filter is in place, you should be able to see the "before and after" preview on your screen.

Then go Video > Compression, and choose an avi codec. For this sort of thing I would probably use the Lagarith codec. Another option might be Cineform HD which will give you smaller files but it's a bit lossy and the codec that came with your Vegas is a pretty old version. If you have trouble with Lagarith then yet another option would be the Huffyuv lossless codec.

Then go File > Save As AVI, and render your rescaled video which you can then drop back into Vegas for adding your border.

How are you resizing the video at the moment? Track motion? Event pan and crop? Or are you rendering out the original video and dropping the resized video back into your Vegas project?

I tend to prefer sticking with interlacing all the way to DVD if the source is interlaced, but if you want to try a progressive render then you can also do advanced deinterlacing in VirtualDub. Install Donald Graft's smart deinterlace filter (the up to date version of the filter that the Mike Crash Vegas filter was adapted from) and try the options in there. I had nice results with "Edge-directed interpolate" which is available in the 2.8 beta 1 version.

If you're using CCE, I have luminance "0 to 255" checked in the advanced video settings, otherwise my DVDs come out with insufficient contrast.

Finally, there is some debate over the exact project settings that should be used for NTSC widescreen DVD. When I downscale in Vegas from HDV for an NTSC widescreen DVD I don't use the standard Vegas template, I use a pixel aspect ratio of 1.1852 so that I get absolutely no letterboxing or pillarboxing (= black borders). CCE can open that file. I've done it loads of times. This is something you could try that just might help. If you want to find out more about that just search "1.1852" on the forum.

Movick wrote on 5/25/2010, 9:27 AM
John and Nick,

Don’t have a lot of time right now, but I’m going to explore every suggestion you eloquently offered! I just want to say how much I truly appreciate your time and generosity! You guys are awesome!!

I’ll check back soon after I have gone through the gauntlet of possibilities; if you don’t hear from me again it means I found no solution and went BASE jumping scant the chute!!! ;-)

You guys rock – thanks 2.5 billion fellas!

Mov
Movick wrote on 5/26/2010, 9:11 AM
Nick,

Installed VD as suggested and all seems well so far. When I import the resized clip into V5, the program wants to stretch the 606X404 VirDub resized clip to fill the 720X480 frame. When I enter the proper dimensions into track motion, it again resizes the clip which of course defeats the purpose.

I know there is a way to float a clip in V5 at its proper resolution without the program stretching it - any idea?

Also, when configuring the resize filter, I should check "interlaced" yes? How do I install the Lagarith codec into VD? Any additional parameters I should configure/modify?

Thanks amigo!!!

Mov
NickHope wrote on 5/26/2010, 9:55 PM
I'm not sure why track motion isn't working for you. To test this, I just put a 720x576 video into a 1440x1080 project, typed 720x576 into track motion, and the video stayed at that smaller size. It did not stretch to fill the frame. I'm using Vegas 8.0c.

If you're working with interlaced footage then yes, check that interlaced box. If you've deinterlaced in Vegas or in the Smart Deinterlacer then leave it unchecked.

After installation, the Lagarith codec should just appear in the list of codecs under "Video > Compression" in VD. Haven't used it for ages but my current settings show "Use Multithreading" checked and the other 3 boxes unchecked. The mode is RGB.

Download Lagarith here.