digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Edit Video, Audio (https://www.digitalfaq.com/forum/video-editing/)
-   -   How to Properly Crop the Overscan in VirtualDub [GUIDE] (https://www.digitalfaq.com/forum/video-editing/4207-how-properly-crop.html)

kpmedia 05-09-2012 03:50 PM

How to Properly Crop the Overscan in VirtualDub [GUIDE]
 
3 Attachment(s)
As anybody converting VHS tapes to DVDs/Youtube quickly discovers, the video signal contains a lot of junk on the edges of the screen -- noise not seen when it was played on a television. This is actually an intentional "feature" of traditional video signals, as it allowed broadcasters to hide non-video signal functionality which did present itself as noise. Closed caption data, for example.

That concept has been explained in depth here: http://www.digitalfaq.com/forum/vide...converted.html

You want to hide this when making DVDs -- never crop it! :eek:

This is referred to as a "mask" in most editing programs. VirtualDub, a popular freeware, doesn't natively contain an obvious mask function, but it is there. You have to leverage the resize filter in conjunction with the crop function, in order to create a mask. It's a simple three-step process:

Step 1: Set the Resolution

Attachment 2577

^ After opening your recorded VHS video in VirtualDub, go to the Video > Filters menu, click the Add button, and select the Resize filter. Configure the options to match the input of your source video -- be it 352x480, 704x480, 720x480 for NTSC; or 325x576 or 720x576 for PAL -- and input those numbers into both boxes shown above. Most importantly, be sure to select the proper radio (dot) button options, as shown above. OK when done.


Step 2: Set the Crop

Attachment 2578

^ Enter the Cropping function on the Filters page, and alter the X and Y dimensions. Always select in multiples of 2. Otherwise you'll mess up the interlacing.

The X is left and right, and Y is top and bottom. Ideally you hide 8 pixels removed from each side.
  • At 352x resolutions, you don't really want to hide more than 12 on the Y (24 total) or 12 on the X (24 total).
  • At 704/720x resolutions, you don't want to hide more than 12 on the Y (24 total) or 20 on the X (40 total).
  • Hiding more pixels may show black edges on the screen, as you've left the overscan, and are now within the TV image area.
Note: You do NOT have to select the same numbers for each box, as sometimes the picture is shifted badly within the signal. This is where you can not only hide the overscan noise, but fix the image offset at the same time. Also understand that it's the total number that counts when hiding pixels. If you remove only 4 pixels on a Y side, you can remove 20 from the other side, and the picture will re-center itself, with a net overscan hidden of 12 pixels per side.

Guides like this are meant to help you think -- not let you monkey-see/monkey-do!


Example of Proper Overscan Mask

Attachment 2579

^ This is an example of a hidden overscan. Notice that there is twice as much hidden on the left/right (X) as there is on the top/bottom (Y). This is a good example of proper overscan removal (masking) for interlaced video.

Nothing looks worse than a video with squiggly junk on all sides, when you're wanting to enjoy it. :(

It's easy to fix, using this method, prior to encoding and authoring for DVD. :cool:

robjv1 05-15-2012 04:29 PM

I'm not sure of the significant differences (if there are any) between the two methods, but this is also achievable in VirtualDub using the 'fill' filter if one prefers, although I cannot recall if that is a built in feature or not with a stock copy of VDub. Edit: Yes, it appears to be one of the internal filters.

You would use multiple instances of the 'fill' filter, one for the top, bottom, left and right portions of the screen (if you wish to mask all of them). Similarly to the above method, you have the option of choosing a color to mask the frame. To achieve the effect, you simply adjust the x/y offsets to isolate the area that will be the masked out portion of the frame (you can do this either by adjusting the values in the boxes or clicking and dragging the guides in the actual video frame). So for example, if the left 15 pixels of the frame are going to be masked, you would want just those pixels visible (and nothing else) in the filter window. Repeat for the other parts of the frame you wish to mask.

Also -- I haven't tried it myself but let's say you have a simple VHS to DVD recording on a DVD recorder that you want to mask, but don't wish to re-encode. This person came up with a clever solution using a subtitle.

http://forum.videohelp.com/threads/3...ut-Re-encoding

lordsmurf 05-25-2012 11:22 PM

I'll have to try that subtitle trick. Very nice!

friendly_jacek 08-13-2015 12:53 PM

noob question here on the above guide. why would you resize first and crop later. shouldn't it be crop first and resize later?

besides, some other digitalFAQ guide specifically said not to resize, but mask instead. so, which guide is actually right?

thanks!

lordsmurf 08-14-2015 08:10 AM

Quote:

Originally Posted by friendly_jacek (Post 39248)
noob question here on the above guide. why would you resize first and crop later. shouldn't it be crop first and resize later?
besides, some other digitalFAQ guide specifically said not to resize, but mask instead. so, which guide is actually right?
thanks!

First off, understand this guide is very accurate. :2cents:

All video software tends to behave different, when it comes to cropping and masking. Many refer to "cropping" improperly, while others use nonsense terms like "clipping" to describe a mask/crop. ("Clipping" is a specific video and audio jargon, and NOT at all related to crop/mask!)

Avisynth, Adobe Premiere, Final Cut Pro, etc etc -- they're all different in behavior.

And in fact, there's several ways to accomplish masking in VirtualDub!

Technically, this is how masking works:
- first you have to crop a video (remove unwanted pixels)
- then pad it back with a solid color to create a mask (thus restoring the original resolution)

Some software has a "crop/mask/clip" filter/button/whatever. But crop-then-pad is the underlying task that is always taking place. VirtualDub is simply one of the few programs that reveals this fact.

Now, you can do the very manual method, by using the "null" filter, and cropping the footage, following by a second filter (including resize) to pad it back.

But the easiest method is to use only the "resize" filter, and cropping the video. First it crops ("crop" function in VirtualDub, under Video Filters), then it pads ("crop to size" in the Resize filter). This is all done in a single pass.

Make sense?

Perhaps the guide needs another image or two. :hmm:

Note: You must be very careful with source resolutions with cropping or masking in VirtualDub. For example, full SD PAL is 720x576, while full SD NTSC is 720x480. You need to change accordingly. This was explained in the above quickie guide, but it needs to be emphasized. A bad crop will screw up the video.

friendly_jacek 08-14-2015 10:20 AM

thanks lordsmurf for your explanation. i trust you but want to understand and not just blindly follow a script that i don't understand.

what is the function of the first resize filter? after all the resolution is not changed (352x480->352x480). is this the same function as the null filter some people use?

are you saying that the crop function in VD is actually doing masking and not removing pixels (as the name implies?)

i'm not so sure, when i used the VD crop function during capture, that resulted in decreased size (and resolution) of the frames.

now, how about capturing cropped (720x568) and then resize using VD filter with 720x576 and one of the letter box options?

i can try it tonight, if that's a better solution than the simple border control filter.

lordsmurf 08-16-2015 12:29 PM

3 Attachment(s)
Never blindly follow anything. That's a wise move on your part. Test, then test again! Verify it does what you need before committing. It's too easy to screw up video, so be diligent.

The "crop" function crops doesn't work without a filter.

Attachment 5045

But add a filter, then you can crop.
It crops BEFORE that filter runs, not after. This is important, and why this method works.
Note: You could add a null filter (does nothing), then add yet another filter to pad it (in order to mask it).

Attachment 5046

If we add the resize filter, this function acts as a mask:

Attachment 5047

The crop>resize does this: (imagine VirtualDub talking to itself) "Okay, cut off pixels. But we can't actually remove any pixels, since the resolution is defined to be the same as the source. We're also not allowed to stretch anything. The only option is to just leave blank (black!) data."

Note: It shows 320x240 because I didn't load a video. I'm not on a video system right now.

And no, never capture interlaced footage as anything other than x576 PAL or x480 NTSC. You cannot capture wrong, then pad it back to fix it. Never try to crop/mask footage in realtime, aside from some special situations (namely the mask ability of ATI MMC, with MPEG-2 capturing, with an ATI AIW Radeon card).

jmac698 08-21-2015 04:21 PM

Mr. Jacek brought my attention to his project, so upon reviewing his posts, I came across this. Could I just interject to add, that I think this was a problem in terminology or definitions. If I were to see some suggestion to "crop then resize", I would picture say, cropping 480->472, then resizing to 480, implying a (to use a better term?) "rescaling" that is a stretching back to 480, which is a definite no-no.

The key lies in how the "resize" options in this particular program work, with the steps described; they are actually doing a padding in order to resize, not a stretching. In this case I find calliing that a resizing somewhat ambiguous, as I usually think of resizing as being a stretching of pixels. The end effect I would call, masking.

The guide is fine, however I would hesitate to call it a crop/resize or resize crop, rather I would point out that "I'm doing a masking, but in this particular program it can be achieved by specific settings under the resize function".

lordsmurf 08-21-2015 04:24 PM

"re-scaling" is actually a perfect word to describe what VirtualDub is NOT doing here. :congrats:

friendly_jacek 08-25-2015 10:55 AM

Quote:

Originally Posted by jmac698 (Post 39498)
The guide is fine, however I would hesitate to call it a crop/resize or resize crop, rather I would point out that "I'm doing a masking, but in this particular program it can be achieved by specific settings under the resize function".

thanks. it was the goofy terminology that got me confused here.

skycaptain09 04-26-2017 05:19 PM

I know that when cropping, the amount taken off of each side needs to be a multiple of 2. Is the same true when adding borders back onto it?

For example, if I remove 10 pixels from the bottom of the frame to get rid of overscan, and 0 pixels from the top, is it safe to add 5 pixels of border back onto the top and bottom to re-center the video vertically?

I am using AviSynth's Crop and AddBorders to do this, but I would think that the same rules would apply in VDub. AviSynth's AddBorders won't let you add odd numbers of pixels on the left and right, but it allows it on the top and bottom. I just want to make sure I'm not screwing up the interlacing by doing this.

msgohan 04-26-2017 06:34 PM

You can crop and add vertically by increments of 1 but to maintain the original field order, you must not alter the top of the image by 1. Altering the field order shouldn't cause a problem; you just need to know that you did it so that you can flag any encode correctly.

Horizontal is where you're limited to increments of 2 (both cropping and adding borders). This is because in the 4:2:2 format, chroma is subsampled by a factor of 1/2. 2 luma pixels share 1 chroma sample. Cropping 1 luma pixel would mean you would need to crop 0.5 chroma samples, which is obviously impossible.

lordsmurf 04-27-2017 04:26 AM

Quote:

Originally Posted by skycaptain09 (Post 49133)
For example, if I remove 10 pixels from the bottom of the frame to get rid of overscan, and 0 pixels from the top, is it safe to add 5 pixels of border back onto the top and bottom to re-center the video vertically?

6 / 2 = 3 = NO
8 / 2 = 4 = YES!
10 / 2 = 5 = NO
12 / 2 = 6 = YES!
etc

Get it? Both numbers must be even. :wink2:

Quote:

Originally Posted by msgohan (Post 49135)
You can crop and add vertically by increments of 1 but to maintain the original field order, you must not alter the top of the image by 1.
Altering the field order shouldn't cause a problem; you just need to know that you did it so that you can flag any encode correctly.
Horizontal is where you're limited to increments of 2 (both cropping and adding borders). This is because in the 4:2:2 format, chroma

It's entirely about field order. The mess it makes is not worth 1 pixel. Do pairs, and KISS (keep it simple, stupid).

msgohan 04-27-2017 10:51 AM

I agree that it is silly to use odd numbers vertically when padding the video. How would you ever notice it is off-center by 1px? Especially when you're technically shifting the image center down by some pixels by adding black to the top if you only cropped the bottom.

If there was 1 line of garbage at the top, though, I would personally bother to not overcrop... since I know the risks and I want as many video lines intact as possible. :) Technically you lose about 320 "pixels" worth of VHS video for every line you remove.

Andrewjameshoward 03-28-2018 10:53 AM

I'm jumping on to this old thread with a follow up question about masking/Virtualdub/Avisynth. I'm doing this because my question is ABOUT this issue and this seems to be THE site guide which is referred to by other threads. I "get" why masking is preferable to cropping. Suppose though I have a video where I want to mask a lot more on the left than on the right or a lot more on the bottom than on the top, but end up with a product which is "centred". I can see the Avisynth method given would allow me to do this manually. I read that the Virtualdub method will centre itself automatically. Well suppose I don't want it to? Or wish to introduce a deliberate L/R or up/down shift to the whole frame. Can Virtualdub do that?

Squash22 06-23-2020 11:31 AM

So I followed the guide, the results were great. But my file size went from 16.6 gb to 158 gb! Is this expected? Did I do something wrong?

I did change one thing. Instead of Letterbox/crop to size, I used Letterbox to aspect ratio.
I'm a very much a newb at this, but it was showing a crop down to 320x240 which seemed a great reduction in resolution.
Using the "Letterbox to aspect ratio" it took the resolution up to 720 x 540, so the increase is expected, just not a 9 fold increase.

My intention was to take my 720x480 DV (AVI's) capture from VHS, crop out the overscan lines and then use Handbrake to compress the size down for streaming. Handbrake can take a 16 gb down to 2-3 gb using HEVC compression. But 158 gb is still going to be ridiculous in size even after compression. Is there a better, less space consuming way to crop the overscan? Or again did I do something wrong?

Ok wait, I missed this line:
"Configure the options to match the input of your source video -- be it 352x480, 704x480, 720x480 for NTSC; or 325x576 or 720x576 for PAL -- and input those numbers into both boxes shown above"

I thought VirtualDub was inputting it's own values based on calculation, but I guess I have to put in my own resolutions.

Does maintaining a 100 x 100 relative percentage matter?
Because once you edit the crop, that percentage changes.

Squash22 06-23-2020 04:17 PM

Ok followed the guide to a tee this time. Kept everything at 720 x 480. Edited 18 pixels off the top (because of some bad tape) and 6 off the bottom for the overscan, saved to AVI and I got a 140 gb file. What is going on?

any help would be greatly appreciated.

lordsmurf 06-24-2020 10:54 AM

Quote:

Originally Posted by Squash22 (Post 69642)
Ok followed the guide to a tee this time. Kept everything at 720 x 480. Edited 18 pixels off the top (because of some bad tape) and 6 off the bottom for the overscan, saved to AVI and I got a 140 gb file. What is going on?

any help would be greatly appreciated.

What codec did you choose?
Video > Compression

Okiba 08-03-2020 07:31 AM

Note for VirtualDub newbies like me:

Filters are only access-able on 'Full Process Mode' (took me couple of tries to understand why it's greyed out). And because it's being processed again, make sure set the Compression and Colorspace to what you used during Capture (in my case, HufYuv and YUV2).

Please correct me if I'm wrong or there's more settings needed to be made in order to keep the original Capture file quality when Reprocessing.

EDIT: By the way. I'm assuming "Always select in multiples of 2" - means 0 is also valid (in case you want to crop 8 pixels from the bottom and none at the top?)

lordsmurf 08-03-2020 07:41 AM

Quote:

Originally Posted by Okiba (Post 70558)
Filters are only access-able on 'Full Process Mode' (took me couple of tries to understand why it's greyed out). And because it's being processed again, make sure set the Compression and Colorspace to what you used during Capture (in my case, HufYuv and YUV2).

Correct.

Quote:

EDIT: By the way. I'm assuming "Always select in multiples of 2" - means 0 is also valid (in case you want to crop 8 pixels from the bottom and none at the top?)
0 is valid, not cropping a side is fine. 0 is a multiple of 2. 2x0=0
good = 0-2-4-6-8-10-etc
bad = 1-3-5-7-9-etc


All times are GMT -5. The time now is 05:18 AM

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.