View Full Version : x264 SAR issue
mdw
11th December 2011, 00:00
I have a strange issue when encoding DVB-T PAL broadcasts with x264. The broadcasts in question are 720x576 16:9 (ie. anamorphic). When I encode with x264 without specifying SAR, they end up as square pixel videos (ie 4:3 aspect). When I specify --sar 16:9 on the x264 command line, I get videos, that get played at 2.22:1 aspect. I tried mplayer, Windows Media Player, VLC... all play them that -- incorrect -- way. What gives? How do I properly encode 16:9 anamorphic video with x264?
LoRd_MuldeR
11th December 2011, 00:04
I have a strange issue when encoding DVB-T PAL broadcasts with x264. The broadcasts in question are 720x576 16:9 (ie. anamorphic). When I encode with x264 without specifying SAR, they end up as square pixel videos (ie 4:3 aspect). When I specify --sar 16:9 on the x264 command line, I get videos, that get played at 2.22:1 aspect. I tried mplayer, Windows Media Player, VLC... all play them that -- incorrect -- way. What gives? How do I properly encode 16:9 anamorphic video with x264?
First of all, 720x576 with "square pixles" (i.e. SAR=1:1) does not give 4:3, but 5:4. You get proper 4:3 with a SAR of 16:15.
Secondly, in order to get a DAR (Display Aspect Ratio) of 16:9 for 720x576 footage, you need a SAR of 64:45.
DAR = (width_in_pixles / height_in_pixels) * (sar_nominator / sar_denominator) = (720 / 576) * (64 / 45) = 16/9
mdw
11th December 2011, 00:21
First of all, 720x576 with "square pixles" (i.e. SAR=1:1) does not give 4:3, but 5:4. You get proper 4:3 with a SAR of 16:15.
It sounds so obvious when you point that out... I feel stupid ;-)
Secondly, in order to get a DAR (Display Aspect Ratio) of 16:9 for 720x576 footage, you need a SAR of 64:45.
DAR = (width_in_pixles / height_in_pixels) * (sar_nominator / sar_denominator) = (720 / 576) * (64 / 45) = 16/9
Thanks, that's exactly what I needed to know.
infoeater
11th December 2011, 11:40
Take a look at:
http://lipas.uwasa.fi/~f76998/video/conversion/
Exactly correct SAR for 4:3 video is 128/117 (approximately 12:11). For 16:9 it is 512:351 (approximately 48:33). It is because in "PAL" (625 line analog system after digitalization, PAL is in fact name of analog color encoding) 4:3 or 16:9 refer to center 702x576 area, not full 720x576. Full 720x576 is usually wider then 16:9/4:3.
DAR = (width_in_pixles / height_in_pixels) * (sar_nominator / sar_denominator) = (702 / 576) * (512 / 351) = 16/9
Sometimes (but less than more often) it is not true if original video have incorrect aspect ratio. So it's always good to find something in shape of circle or square to check this.
henryho_hk
15th December 2011, 03:43
The SAR parameter of x264 is indeed the pixel "shape" (pixel aspect ratio) but not the image shape (display aspect ratio).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.