x264中SAR参数解析

不指定
2015-12-19 11:04 by:果面 PC应用 » 系统&软件 本站原创 | |
引用:
1. Sample Aspect Ratio

* What is it?

The Sample Aspect Ratio (SAR) (sometimes called Pixel Aspect Ratio or just
Pel Aspect Ratio) is defined as the ratio of the width of the sample to the
height of the sample. While pixels on a computer monitor generally are
"square" meaning that their SAR is 1:1, digitized video usually has rather
odd SARs. Playback of material with a particular SAR on a system with
a different SAR will result in a stretched/squashed image. A correction is
necessary that relies on the knowledge of both SARs.

* How do I use it?

You can derive the SAR of an image from the width, height and the
display aspect ratio (DAR) of the image as follows:

SAR_x     DAR_x * height
-------- = --------------------
SAR_y     DAR_y * width

for example:

width x height = 704x576, DAR = 4:3 ==> SAR = 2304:2112 or 12:11


Please note that if your material is a digitized analog signal, you should
not use this equation to calculate the SAR.

* Should I use this option?

In one word: yes. Most decoders/ media players nowadays support automatic
correction of aspect ratios, and there are just few exceptions. You should
even use it, if the SAR of your material is 1:1, as the default of x264 is
"SAR not defined".

译文:
引用:

1. Sample Aspect Ratio (参照长宽比 or 样本长宽比 - -!用中文真不好表达...)

* sar是什么?

Sample Aspect Ratio (SAR)(有时被称为Pixel Aspect Ratio或 just Pel Aspect Ratio)定义了样本(sample)的宽相对于高的比值,而电脑显示器中的像素(Pixel)往往是“正方形”的(我们的显示器是由点阵组成的,1024x768相当于横向有1024个点,纵向有768个点,所以说,图像的分辨率越高,画面越细腻,原因就是点变小了,我们的眼睛感觉不到它的存在了),它们的sar是1:1,而数据化的视频往往有一个odd sar,在一个系统上,素材的播放是根据特定的sar来的,不同的sar会导致图像的拉伸或者挤压,一个校正值是必须的,它依赖于两者的SAR必须是已知的(就是说,必须知道原始SAR和目标SAR,才能计算这个校正值)

* 我该怎么使用它?

你可以根据图像的宽,高以及display aspect ratio (DAR)[显示长宽比,就是你想让它在播放的时候有效图像显示的长宽比]来计算出sar,参考以下公式:


SAR_x     DAR_x * height
-------- = --------------------
SAR_y     DAR_y * width


举个例子:

宽(横向) x 高(纵向) = 704x576, DAR = 4:3 ==> SAR = 2304:2112 or 12:11


注意,如果你的素材是一个数字化的模拟信号,你不应该使用这个公式去计算sar

* 我该如何去使用这个选项?

引用一句话:是的。大部分的解码器/播放器 都支持自动校正长宽比,但也有少数例外。你甚至可以这样使用它,如果你的素材SAR是1:1,用x264默认值"SAR not defined"(- -!补上X264命令行用法--sar x:y )


OK,看完以上理论,你应该大致明白sar的计算方法了,下面来说说16:9DVD RIP成4:3后还原为16:9的方法

假如我把正统的可变形DVD 720x480 RIP成640x480,而我在播放的时候想重新拉伸成16:9

代入公式:

SAR_x   16 * 480     4
----- = -------------- = ----- = 1.33333333333333...
SAR_y   9  * 640      3


公式解释:

输出高X比例宽                                                                                     480X16
------------------ =sar值     例如转一个720X480的16:9的视屏,根据公式得sar=----------=32:27
输出宽X比例高                                                                                      720X9


为什么psp中的480P的sar为40:33?原因psp只能显示704x480的视屏,720中的16像素被sony裁去,所以要以704X480代入公式计算,最后得出sar为40:33
评论(0) 引用(0) 阅读(3304)