FFmpeg filter-DAR、SAR

11.185 setdar, setsar

The setdar filter sets the Display Aspect Ratio for the filter output video.

This is done by changing the specified Sample (aka Pixel) Aspect Ratio, according to the following equation:

DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR

Keep in mind that the setdar filter does not modify the pixel dimensions of the video frame. Also, the display aspect ratio set by this filter may be changed by later filters in the filterchain, e.g. in case of scaling or if another "setdar" or a "setsar" filter is applied.

The setsar filter sets the Sample (aka Pixel) Aspect Ratio for the filter output video.

Note that as a consequence of the application of this filter, the output display aspect ratio will change according to the equation above.

Keep in mind that the sample aspect ratio set by the setsar filter may be changed by later filters in the filterchain, e.g. if another "setsar" or a "setdar" filter is applied.

It accepts the following parameters:

r, ratio, dar (setdar only), sar (setsar only)

Set the aspect ratio used by the filter.

The parameter can be a floating point number string, an expression, or a string of the form num:den, where num and den are the numerator and denominator of the aspect ratio. If the parameter is not specified, it is assumed the value "0". In case the form "num:den" is used, the : character should be escaped.

max

Set the maximum integer value to use for expressing numerator and denominator when reducing the expressed aspect ratio to a rational. Default value is 100.

The parameter sar is an expression containing the following constants:

E, PI, PHI

These are approximated values for the mathematical constants e (Euler’s number), pi (Greek pi), and phi (the golden ratio).

w, h

The input width and height.

a

These are the same as w / h.

sar

The input sample aspect ratio.

dar

The input display aspect ratio. It is the same as (w / h) * sar.

hsub, vsub

Horizontal and vertical chroma subsample values. For example, for the pixel format "yuv422p" hsub is 2 and vsub is 1.

11.185.1 Examples

  • To change the display aspect ratio to 16:9, specify one of the following:
    setdar=dar=1.77777
    setdar=dar=16/9
    
  • To change the sample aspect ratio to 10:11, specify:
    setsar=sar=10/11
    
  • To set a display aspect ratio of 16:9, and specify a maximum integer value of 1000 in the aspect ratio reduction, use the command:
    setdar=ratio=16/9:max=1000
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值