Log in

View Full Version : Capturing and resizing for NTSC question


Gav
28th September 2003, 06:01
I would like some clarification regarding my understanding of the new Capture Guide with capturing and resizing and keeping the correct aspect ratio.

I have an NTSC Sony Hi-8 camcorder and am capturing the video using a Hauppauge WinTV card which according to the guide performs horizontal scaling (not sure what that means) and is non-ITU compliant. Fine.

I want to capture with the highest resolution that I can to obtain the highest quality. Using VirtualDubMod, I can capture up to 720x480 which I can do. Reading the new guide in regards to resizing NTSC with AVISynth, for the 720x480 capture on a non-ITU compliant card, script #2 will crop 8 pixels from the left side only (why not crop 4 pixels from the left and the right) and then a 6 pixel border will be added to the top of the video (again, why not add 3 pixels to the top and the bottom). Then everything is resized to 640x480 which is the resolution that I want. Is this all correct so far and what about the lop-sided cropping and adding borders?

Is there any reason to capture at 704x480 instead? Would it be any better for any reason? To confirm my understanding of the guide, if the capture is at 704x480, then AVISynth script #3 which is for a 704x480 capture on a non-ITU card, would first add a 6 pixel border to the top alone, and then everything is resized to 640x480. Correct?

Why is there no resizing recommendation for capture at 640x480 on a non-ITU card in the guide but there is one for 640x480 on an ITU-compliant card? Is the aspect ratio wrong when using a non-ITU capture card?

Thanks for any answers.

Gav

Gav
5th October 2003, 23:44
Anyone please?

Joe Fenton
6th October 2003, 01:28
An ITU compliant capture device gives you an NTSC max capture of 720x486. However, non-ITU compliant cards usually give you a capture of the older, more common mode known as CCIR-601 1/1 D1, which happens to be 704x480. Sometimes the card takes D2 (352x240) just doubles it. The result is the same. You can see that you have 6 lines and 16 pixels per line to trim. The script assumes the card centers the 704x480 visible frame inside the 720x486 full frame - so it trims the lines to 704 starting a pixel 8 from the left, and similarly for the vertical taking 3 lines at the top and bottom.

You may wish to confirm that your card actually centers the video as opposed to being "off-center." Grab at 720x486 and look at the video to determine the actual trim values.

The ITU compliant card gives a capture frame of 648x486 which is why you have trimming recommendations for 640x480 capturing. You might wish to check out web pages like the one below for more info on digital video frame sizes.

http://www.lurkertech.com/lg/big/howbig.html

Gav
6th October 2003, 05:36
Originally posted by Joe Fenton
... You can see that you have 6 lines and 16 pixels per line to trim. The script assumes the card centers the 704x480 visible frame inside the 720x486 full frame - so it trims the lines to 704 starting a pixel 8 from the left, and similarly for the vertical taking 3 lines at the top and bottom.

...

I think I believe what is supposed to be done but I am confused with the scripts shown in the Capture Guide at Doom9.org. It says for NTSC capture:

...
This implies the following three situations:
[1]: capturing at 704x480, 640x480 or 720x480 (all three ITU compliant).
[2]: capturing at 720x480 with overscan (not ITU compliant).
[3]: capturing at 704x480 (not ITU compliant).

# NTSC [1], XviD:
BicubicResize(640, 480) # or scalings of this size

# NTSC [2], XviD:
Crop(8, 0, 712, 480)
AddBorders(0, 6, 0, 0)
BicubicResize(640, 480) # or scalings of this size

# NTSC [3], XviD:
AddBorders(0, 6, 0, 0)
BicubicResize(640, 480) # or scalings of this size

If I am reading this right, for my non-ITU capture card capture at 720x480 which refers to situation [2], the script for [2]will crop 8 pixels from the left side only, leaving a frame of 712x480, correct? There is no cropping on the right side according to the script. Then a border of 6 pixels is added to the top of the frame only to make a frame size of 712x486 which is then resized to 640x480, correct?

Now is the reason for cropping from 720 down to 712 instead of the 704 that you mentioned have to do with the PAR (pixel aspect ratio) of 9/10 that is mentioned at the beginning of the Capture Guide for NTSC capture with a non-ITU capture card capture of 720x480?
712 * .9 = 640.8 which is approx 640. Is this how the PAR is used in calculations? Again, if this is the reason for the cropping down to 712 then why is all the cropping done only on the left side which is my original question? Also, the adding of the 6 pixels to the 480 to make 486 is all done on the top according to the script and not 3 on the top and 3 on the bottom as you mentioned before. Again, my original question was why this was done.

Joe Fenton
6th October 2003, 08:48
Originally posted by Gav
# NTSC [2], XviD:
Crop(8, 0, 712, 480)
AddBorders(0, 6, 0, 0)
BicubicResize(640, 480) # or scalings of this size

If I am reading this right, for my non-ITU capture card capture at 720x480 which refers to situation [2], the script for [2]will crop 8 pixels from the left side only, leaving a frame of 712x480, correct? There is no cropping on the right side according to the script. Then a border of 6 pixels is added to the top of the frame only to make a frame size of 712x486 which is then resized to 640x480, correct?

Yes. The crop function takes arguments of left/top/width/height, so it will return a frame 712x480 starting from the 8th pixel from the left side. Which is a little weird. I'm not sure why they do that as 712 isn't a valid width I'm aware of. I'd have put Crop(8,0,704,480) myself.

AddBorders adds a black border of the specified width so it would add six black lines to the top of the frame. Again a little strange. If I were trying to make the frame the compliant 486 height, I would put an equal number of lines at the top and bottom. AddBorders(0,3,0,3)

Originally posted by Gav
Now is the reason for cropping from 720 down to 712 instead of the 704 that you mentioned have to do with the PAR (pixel aspect ratio) of 9/10 that is mentioned at the beginning of the Capture Guide for NTSC capture with a non-ITU capture card capture of 720x480?
712 * .9 = 640.8 which is approx 640. Is this how the PAR is used in calculations? Again, if this is the reason for the cropping down to 712 then why is all the cropping done only on the left side which is my original question? Also, the adding of the 6 pixels to the 480 to make 486 is all done on the top according to the script and not 3 on the top and 3 on the bottom as you mentioned before. Again, my original question was why this was done.

Your idea on why 712 makes some sense, but I haven't seen a page that says that non-ITU cards have this 9/10 PAR. They also assume all the blank space is on the left.

I would test these assumptions. Capture a short clip at 720x480 and use something like GordianKnot to check borders. See exactly what you are getting from your card. When in doubt, check it out. You're right though. Their setting are a little confusing. It's not the first time I've seen recommendations that I didn't agree with. As I tell people, try it and see. Nothing beats actual experiments on short clips.

Wilbert
6th October 2003, 21:47
Yes. The crop function takes arguments of left/top/width/height, so it will return a frame 712x480 starting from the 8th pixel from the left side. Which is a little weird. I'm not sure why they do that as 712 isn't a valid width I'm aware of. I'd have put Crop(8,0,704,480) myself.
Thanks for bringing this up. I see I didn't update this, to reflect the changes in preface.html.

You should just add three pixels on top and bottom, and then resize to 640x480. Thus

AddBorders(0, 3, 0, 3)
BicubicResize(640, 480) # or scalings of this size

I still maintain that the par is 9/10. The full 4:3 image is 720x486, while 6 scan lines are cropped of by the capture card, getting 720x480. The par is given by 720/648 = 10/9.

but I haven't seen a page that says that non-ITU cards have this 9/10 PAR
True, me neither. It relies on the following assumption:

"The full 4:3 image is 720x486, while 6 scan lines are cropped of by the capture card."

Do you think it's false?

Joe Fenton
6th October 2003, 23:00
No, I don't know period. I've never seen a page which mentioned 9/10, but that hardly means it doesn't exist. :D

That is why I said to check it out. If it really is 9/10 (my card sure isn't), it'd be good to know in case I run into this again with someone else. No sense telling people to use 704 when they should be using 712.

I assume you have seen this? Is all the space on the left?

Wilbert
6th October 2003, 23:10
No sense telling people to use 704 when they should be using 712.

I assume you have seen this? Is all the space on the left?
I guess I wasn't clear enough. If you use a non-ITU compliant capture card, the capture sizes 720x480, 704x480 and 640x480 are all scalings of each other. So, it doesn't really matter at what resolution you capture. Thus, you don't have overscan here.

If your capture card is ITU-compliant, and you capture at 720x480, the overscan can be left, right or both. Depends on the chip I guess.

Gav
6th October 2003, 23:43
Originally posted by Wilbert
I guess I wasn't clear enough. If you use a non-ITU compliant capture card, the capture sizes 720x480, 704x480 and 640x480 are all scalings of each other. So, it doesn't really matter at what resolution you capture. Thus, you don't have overscan here.

If your capture card is ITU-compliant, and you capture at 720x480, the overscan can be left, right or both. Depends on the chip I guess.

I am confused now. So with a non-ITU compliant capture card with a capture size of 720x480, do you still have to (1) crop away the 8 pixels to get down to 712x480 and then add the 6 pixels to the 480 to make a final size of 712x486 before resizing to 640x480 or (2) does one just have to add the 6 pixels to the 480 to make 720x486 and then resize to 640x480 or is it (3) crop 16 pixels from the 720 to make 704x480 and then add 6 pixels to the 480 to make 704x486 and then resize to 640x480?

Wilbert
7th October 2003, 14:27
(2) does one just have to add the 6 pixels to the 480 to make 720x486 and then resize to 640x480
It's this one :)

Gav
7th October 2003, 18:37
Thanks a lot to Wilbert and Joe for your replies.

P.S. So Wilbert, if I decide to capture at 704x480 instead of 720x480 with my non-ITU capture card, I should do the same thing, ie. no cropping, add 6 pixels to the vertical to make 704x486 and then resize to 640x480?

Joe Fenton
7th October 2003, 19:46
Well, he did say that 720, 704, and 640 were all scales of each other on non-ITU cards, so it seems to me that you should just do 640x480 directly since going higher doesn't give you anything more than 640 scaled. 'Tis logical. Unless this 640 is also subject to the 9/10 scale due to PAR. Then you would want to go with 720 since that is the next larger size you have greater than or equal to 712. Capturing at anything lower would give you less than needed to scale 9/10 to 640 wide. Hope that makes sense.

If that is the case, I would check to see how the card centers the picture in the 720 wide line so you can determine if you want to cut the 8 pixels entirely from the left, or to shift that over slightly.

Thanks for the info, Wilbert!

Wilbert
7th October 2003, 20:29
Unless this 640 is also subject to the 9/10 scale due to PAR.
Capping at 640x480 won't give you square pixels, in this case. At least, that's my conclusion. You have to add 6 pixels (640x486) and resize to 640x480.

If you look at the preface of the capture guide, this corresponds with a par of 81/80. Of course this is almost 1, and you make a small AR error if you don't add pixels and resize.

Resizing degrades your picture, so in this case, you might want to accept this small AR error.

Then you would want to go with 720 since that is the next larger size you have greater than or equal to 712. Capturing at anything lower would give you less than needed to scale 9/10 to 640 wide. Hope that makes sense.
This 712 is not relevant here (only if you have an ITU compliant capture card). I don't know what chip Gav uses. Assuming he uses a bt8x8, it samples at 910 samples per scan line, and downsizes to the desired capture resolution. So in this case, you want to capture at the highest possible resolution, filter and downsize it further. (See the same preface for more info ...)

If that is the case, I would check to see how the card centers the picture in the 720 wide line so you can determine if you want to cut the 8 pixels entirely from the left, or to shift that over slightly.
This is only applicable to ITU compliant capture cards.

Gav
8th October 2003, 05:14
Wilbert,

Would you please mind addressing my specific question about capturing at 704x480, that is, if I use this resolution instead of 720x480, do I also do no cropping, then add 6 pixels to the vertical to make 704x486, then resize to 640x480? Again, my capture card is based on a bt8x8 which your guide says is non-ITU compliant. The reason I may wish to capture at 704x480 instead of 720x480 is that when I capture at 720x480 there is a 4-5 pixel wide black border on the left side only so I thought that if I capture at 704x480 instead, I wouldn't get this black border. What about what Joe mentions about capturing at 640x480 instead of the 720or704x480? Is there a better quality when capturing at the higher resolution on my specific card or is it just as well to capture at 640x480?

Wilbert
8th October 2003, 10:34
Would you please mind addressing my specific question about capturing at 704x480, that is, if I use this resolution instead of 720x480, do I also do no cropping, then add 6 pixels to the vertical to make 704x486, then resize to 640x480?
Yes, that's also possible.

Again, my capture card is based on a bt8x8 which your guide says is non-ITU compliant. The reason I may wish to capture at 704x480 instead of 720x480 is that when I capture at 720x480 there is a 4-5 pixel wide black border on the left side only so I thought that if I capture at 704x480 instead, I wouldn't get this black border.
No, if you capture at 704x480 or 640x480 you will also get this 4-5 pixel wide black border on the left. It's not overscan, but a part of the 4:3 image. Provided you consider the same broadcasting, it might be different for other broadcastings.

Maybe you can do the following test, to check it. Record something on VCR and capture it three times: 720x480, 704x480 and 640x480. Make screenshots from a common frame, and upload it somewhere (or mail it to me).

Gav
11th October 2003, 05:29
Originally posted by Wilbert
Yes, that's also possible.


No, if you capture at 704x480 or 640x480 you will also get this 4-5 pixel wide black border on the left. It's not overscan, but a part of the 4:3 image. Provided you consider the same broadcasting, it might be different for other broadcastings.

...

You are right, Wilbert. That 4-5 pixel black border is there no matter what resolution I capture at. Thanks again for your replies.