Log in

View Full Version : How to render with proper DAR in Veags (PAL 4:3)


Anakunda
15th October 2010, 15:47
Hi, I can't find right settings.

My project AR: 720×576 PAR=1.0926 (PAL DV)
Track video PAR: 1.0926 (PAL DV)
Render As/Custom/Pixel aspect ratio: 1.0926
On output I always get DAR=5:4
Which setting and how should I change to get DAR 4:3 on output?
I render to V4W/x264, output size 720×576, progressive scan.

Thanks for all correct answers.

Anakunda
15th October 2010, 18:13
576 * 4 / 3 = 768
768 / 720 = 1.06666666666666666666666666666666666666

but this is yet less than 1.0926 ?

and x264 requires SAR which is quite diffeernt value?

poisondeathray
15th October 2010, 18:20
for PAL 4:3 you would use --sar 12:11 or 16:15

12:11 calculation uses 704w , 16:15 is mathematically correct for 720w

16/9 = 720/576 x 16/15

alternatively, you can set the DAR flag in a container e.g. remux with mp4box or mkvmerge

Anakunda
15th October 2010, 18:46
can you please explain which settings shall I change in Vegas?

poisondeathray
15th October 2010, 18:55
what are you trying to do?

what is your export format goal? DVD? web ? etc...

if you want to export 4:3 720x576 and are using the x264vfw version just enter the sar value , and make sure stretch to fit is checkmarked in the vegas render dialog box

Anakunda
15th October 2010, 19:00
so that vegas settings is fully ignored by x264vfw and I have to pass SAR to x264 commandline?

poisondeathray
15th October 2010, 19:05
the project settings are different from render settings

if you are using x264 to render... it uses x264 render settings :)

square pixel is assumed unless otherwise stated; so 720/576 = 5/4 that's why you get 5/4 AR => 5/4 = 720/576 x 1/1

is your input format interlaced? are you encoding interlaced ? or deinterlacing somewhere ?

alternatively you could use debugmode frameserver, and use a x264cli GUI like megui, ripbot, xvid4psp, etc.... bug it only works in 8bit mode for vegas

Anakunda
15th October 2010, 19:17
yes part of input is interlaced(MPEG2), part is progressive(AVI)
I render to porogressive, so probably I am deinterlacing?
output is 720×576 PAL 4:3

poisondeathray
15th October 2010, 19:27
I would highly, highly, highly recommend using somehting other than vegas for deinterlacing.... the quality is atrocious

you either have a blurry mess (blend mode) , or left with jaggies from hell (interpolate)

For a combined project with mixed interlaced/progressive and progressive output goal, I would deinterlace the MPEG2 first if it was interlaced with avisynth before editing, then import a progressive asset

yetanotherid
15th October 2010, 19:35
Here's some ramblings which may help.

Where did you get your pixel aspect ratio from? A far as I know if you're converting a PAL DVD the two choices are 1.09401709401709 if the DVD uses the ITU resize method, or 1.06666666666667 if it doesn't. I usually go with the second PAR as in my experience most DVDs don't use the ITU resize method. Assuming the pixel aspect ratio you're using is correct though.....
Is the conversion program cropping the video? If so you need to take that into account and if you want a 4:3 output DAR you'll probably need to do some cropping of your own.

720 x 1.0926 = 787 (almost)
So your current display aspect ratio is 787/576 = 1.3663 which isn't quite 4:3.
768 x 576 is 4:3
Therefore you need to crop 18 pixels off the sides of the video (nine each side for example) to achieve a 4:3 display aspect ratio. It's 18, not 20 as the math above suggests because 20/1.0926 = 18 (almost)
So after losing 18 pixels and using the same PAR you'd want an output which is 702 x 576 after cropping, which is close, but....

Your program probably wants width and height to be multiples of 16. So the closest you'd get is by losing 16 pixels from the sides which gives you 704 x 576.
704 x 1.0926 = 772 /576 = 1.34
Almost, but not quite. To get to an exact 4:3 you'd probably have to enlarge the image slightly and then crop a row off the top and bottom to get you back to 576 and then if you chopped just the right amount from the sides you might get 4:3, but the math starts to get hard.

I use MeGUI for encoding DVDs to anamorphic x264 and if I want a perfect 4:3 I enable the anamorphic encoding, set it to resize the video to mod16 and then crop. MeGUI will show you the script it creates which sets the output DAR. I just take my best guess as to how much I need to crop and then check the script. If it's not 4:3, I do some more cropping and check again and keep trying different amounts of cropping top and bottom until the script says the DAR is being set to 4:3.

Does your encoded video look distorted in any way compared with the original? (round objects are still round etc) If it is distorted as was mentioned earlier your video probably isn't being resized prior to encoding, or it's being encoded under the assumption it uses square pixels, which it doesn't. Hence 5:4 output.

The ITU pixel aspect ratio I mentioned earlier..... if you crop 16 pixels from the sides to give yourself 704 x 576 and use the ITU PAR you'll be pretty darn close to 4:3. Or if you've got control of the output pixel aspect ratio you can make it slightly different to the input PAR. After cropping to 704 x 576 give yourself a perfect 4:3. Just work out what the PAR needs to be to achieve it. It'll probably distort the image a little but at least it'll be 4:3 and you can compare it to the original to see if it's noticeable. It may not be.

Or another thought.... use square pixels for your output video if you can.
Using square pixels 768 x 576 is a perfect 4:3
768/1.0926 = 702 (rounded)
So if you take your 720 x 576 video and chop 18 pixels from the sides your video will then be 702 x 576. Taking the PAR into account that gives you 768x576 in square pixel terms which is mod16 dimensions and also 4:3.

Or... use the non-ITU PAR of 1.06666666666667. As I said I usually do for PAL DVDs because it looks right to me.
If you use that as your PAR and there's nothing to crop 720x576 is already 4:3

If the program you're using doesn't give you control over the input and output PAR you probably should be using something else anyway. Assuming we're talking DVD conversion, try the different PARs and compare the output with the input video to see which one actually looks the same, then work on the 4:3 output. I don't know anything about the program you're using so can't help you there.

Sorry if I haven't explained it well and sorry if it's helped confuse you but the whole thing confuses the hell out of me. Hopefully if nothing else my ramblings will help you work out where you're currently going wrong.

PS Even though the 720 x 576 video is 4:3 it's display aspect ratio isn't 4:3. It allows for overscanning (edges of the video fall off the screen etc) and it also depends how it's resized. I use the standard 1.06666666666667 as I find most DVDs are right when resized that way, but there's also the 1.09401709401709 resize method to add to the confusion.

Anakunda
15th October 2010, 19:37
I would highly, highly, highly recommend using somehting other than vegas for deinterlacing.... the quality is atrocious

you either have a blurry mess (blend mode) , or left with jaggies from hell (interpolate)

For a combined project with mixed interlaced/progressive and progressive output goal, I would deinterlace the MPEG2 first if it was interlaced with avisynth before editing, then import a progressive asset

Don't like to hear about Vegas. I have already my project done in it.
Can you recommend a quality alternative?
I have Ciorel Video Studio, Pinnacle Studio and Premiere also, but not too familiar with them.
Maybe I could do the deinterlacing with avisynth but I m not familiar with it and neither don't know how to import by it.
But at least --sar 16:15 does set right DAR, finally.

poisondeathray
15th October 2010, 19:41
Don't like to hear about Vegas. I have already my project done in it.
Can you recommend a quality alternative?
I have Ciorel Video Studio, Pinnacle Studio and Premiere also, but not too familiar with them.
Maybe I could do the deinterlacing with avisynth but I m not familiar with it and neither don't know how to import by it.
But at least --sar 16:15 does set right DAR, finally.

I use premiere and vegas, don' t know about corel or pinnacle but I suspect they are just as bad. It's almost a given that retail products give poor deinterlacing quality. I haven't seen one yet that does a decent job compared to the higher quality avisynth deinterlacers. It would be better to shoot native progressive if your export goal was progressive

To do the deinterlacing beforehand, you apply the script and encode a lossless intermediate for import . So that intermediate has been deinterlaced and is now progressive. You can read up on it before your next project :) It will be well worth you while learning.

yetanotherid
15th October 2010, 19:46
Sorry, I missed some of the earlier posts while writing mine so I'm pretty sure the examples I gave based on the PAR you're using are wrong because you've got the PAR wrong. Hopefully it'll still help you understand how the cropping will effect the output DAR and how to get to 4:3 but if you're converting a PAL 4:3 DVD you either need to use a 1.06666666666667 or 1.09401709401709 PAR. DVDs can use either so it's up to you which one you think looks right (it's usually the first one).

2Bdecided
18th October 2010, 14:38
@yetanotherid,

I think your approach is overkill! People could inadvertently introduce all kinds of errors with that approach unless they were very careful. Even if they get everything "right", it doesn't seem to have any advantage over a simpler approach.

You only need to worry about "PAL" vs "NTSC", 4x3 vs 16x9, and (if you're picky) (1) 704/"analogue"/"ITU" vs (2) 720/"digital" sources...

1. If you have a legitimate 704-pixel width source, or if you have a 720-pixel width source with only the middle 704 pixels containing active video (most analogue video digitised properly), or if you have a 720-pixel width source and you're sure it came from something that repsects analogue (ITU) pixel aspect ratio / sampling, then...

"PAL" 4x3 PAR = 12/11 (1150/1053 is strictly true for vintage native analogue video - but it's less than 1 pixel difference, so who cares?)
"PAL" 16x9 PAR = 16/11

"NTSC" 4x3 PAR = 10/11
"NTSC" 16x9 PAR = 40/33

2. If you have a 720-pixel width source and it was authored such that the full width = the aspect ratio (probably most modern DVDs, most HD>SD downconversions, etc), or if you have a 704-pixel width source that you're sure was incorrectly cropped from one of these, then...

"PAL" 4x3 PAR = 16/15
"PAL" 16x9 PAR = 64/45

"NTSC" 4x3 PAR = 8/9
"NTSC" 16x9 PAR = 32/27

That's it.

The only other PARs you need are 1:1 (square pixel), and maybe 4:3 (HDV).

Cheers,
David.

P.S. FWIW, where reliably available (e.g. MPEG-1 etc), assuming a straight 4x3 or 16x9 source, I prefer to specifying the DAR only (no PAR - just DAR= 4x3 or 16x9). I encode type 1 content with only 704 pixels, and type 2 content with 720 pixels. Can't go wrong then!

P.P.S. if anyone wants to argue the numbers in this post are nice but not accurate, please follow this thread: http://forum.doom9.org/showthread.php?t=44977&page=2 especially posts 25 and 33. The numbers are all within 1 pixel of being perfect - mostly a small fraction of 1 pixel or spot-on - people who calculate larger errors aren't doing it properly.

Ghitulescu
18th October 2010, 15:17
@Anakunda

If you want a 4:3 DAR with a frame size of 720x576 from a DV source you'd rather get problems, unless you want to play the result again in the analog domain, or using a digital connection that observe the latter (I'm thinking here of a media player). For PC you can't have all the conditions simultaneously fulfilled, because a PC has, with some exceptions, a PAR of 1:1. You need either to crop some pixels (wrong size) or to accept image distortions (wrong AR). And remember that DV is somehow different from DVD, so you need 2 scaling algorithms for each source. If you want to be compliant.

Anakunda
18th October 2010, 16:37
Thanks for all the informationz, I've forced right DAR by passing --sar 16:15 to x264, which did the trick. Actually I'm not sure what all the AR settings inside Vegas mean, maybe they are applied when saving via internal codec, but x264 probably does ignore them so that I'll have set it explicitly.
I've rendered and remuxed to mkv, and satisfaction with the result, no noticeable artifacts so far.
I think if DVB streams are normalized to 720*576 and should be displayed in 4:3 screen, the video pixel size should be 576*4/3/720 = 1.0666..:1 GDI pixels = 16:15

yetanotherid
18th October 2010, 18:03
@yetanotherid,
I think your approach is overkill! People could inadvertently introduce all kinds of errors with that approach unless they were very careful. Even if they get everything "right", it doesn't seem to have any advantage over a simpler approach.

I was just trying to explain how DAR would convert to square pixels once PAR was taken into account, using the PAR supplied by the OP. My math isn't really any different to yours, except I use 1.066666666 instead of 16/15 etc.

I did assume, maybe incorrectly, the OP was after a perfect 4:3 DAR ratio (i.e 704x528, 800x600 etc) hence my explanation as to the effect of cropping and how to try to achieve it if the image had been cropped or the PAR supplied by the OP was correct. I prefer to try to achieve a 4:3 DAR for 4:3 content as it fills a 4:3 monitor completely (no black bars down the sides or top and bottom etc)

yetanotherid
18th October 2010, 18:06
I've rendered and remuxed to mkv, and satisfaction with the result, no noticeable artifacts so far.

As you're output is MKV, a handy tool to have is MKVToolnix. It's free and you'll find it with Google. It simply muxes MKV files from various video and audio sources. I mention it as should you encode a video only to discover the DAR isn't quite right, you can open the MKV with MKVToolnix, change the DAR and then resave it to a new MKV without the need to encode again from scratch.

yetanotherid
18th October 2010, 18:23
@Anakunda

If you want a 4:3 DAR with a frame size of 720x576 from a DV source you'd rather get problems, unless you want to play the result again in the analog domain, or using a digital connection that observe the latter (I'm thinking here of a media player). For PC you can't have all the conditions simultaneously fulfilled, because a PC has, with some exceptions, a PAR of 1:1.

Nonsense. A PC doesn't have a 1:1 PAR any more than any other device does. I convert DVDs to anamorphic x264 regularly and I can assure you there's no issue with using non-square pixels. Assuming you're using the correct container format of course.
A PC can play a DVD with non-square pixels and display it with the correct aspect ratio, so what's so special about a video you encode yourself which stops the PC from displaying it's PAR/DAR correctly?

You need either to crop some pixels (wrong size) or to accept image distortions (wrong AR).

You don't "need" to do either. You can resize to compensate for any non-mod16 cropping (or encode non-mod16) and then alter the PAR of the output video (or set the DAR accordingly etc) to achieve an encode without unnecessary cropping or any image distortion.

2Bdecided
20th October 2010, 13:11
I think if DVB streams are normalized to 720*576 and should be displayed in 4:3 screen, the video pixel size should be 576*4/3/720 = 1.0666..:1 GDI pixels = 16:15FWIW virtually all 4x3 content I've seen is ITU compliant - i.e. PAR = 12/11 rather than 16/15. Not much in it though!

(Lots of broadcast SD originated 16x9 content is ITU compliant too - the proportion is decreasing though, since increasingly it's sourced from HD via a straight full-frame all-pixel HD>SD re-size, giving a final PAR of 64/45)

Cheers,
David.

henryho_hk
20th December 2010, 00:43
you're sure it came from something that repsects analogue (ITU) pixel aspect ratio / sampling

Does consumer DV cam recorder fall in this category?

2Bdecided
20th December 2010, 15:09
Does consumer DV cam recorder fall in this category?Depends. I have (had) one that does, and I have one that does not. I haven't checked any others.

Cheers,
David.