MeGUI/AviSynth 脚本中的纵横比信号
外观
< MeGUI
MeGUI 支持在 AviSynth 脚本中纵横比 信号,这将允许 MeGUI 读取您在脚本中设置的纵横比,而无需您告诉 MeGUI。这类似于 Matroska 和 MP4 中的 AR 信号;但是,由于 AviSynth 通过模拟 AVI 文件(没有对 AR 信号的原生支持)来工作,因此需要一种解决方法。
MeGUI 目前不允许您设置 SAR - 您必须设置 DAR。此设置可在主窗体中的视频预览窗口中找到。
您可以使用两个专门命名的全局变量将 DAR 信号直接添加到您的 Avisynth 脚本中:MeGUI_darx 和 MeGUI_dary。例如,您可能拥有
# Set DAR in encoder to 4 : 3. The following lines are for automatic signalling global MeGUI_darx = 4 global MeGUI_dary = 3 # other stuff which actually is the script ...
MeGUI 将与 Avisynth 交互以获取变量的值。因此,您甚至可以执行一些有趣的操作,例如
global MeGUI_darx = my_avs_func_x() global MeGUI_dary = my_avs_func_y() ...
允许 AviSynth 进行一些 DAR 计算。
由于裁剪保留 SAR,而调整大小保留 DAR,因此能够为您的任何计算使用最适合的选项非常有用。这些 AviSynth 函数在 SAR 和 DAR 之间转换,并设置 DAR 以便 MeGUI 可以将其读出。
# gets the DAR from the SAR
function getDAR(clip c, float SAR)
{
return Float(c.width) * SAR / Float(c.height)
}
# gets the SAR from the DAR
function getSAR(clip c, float DAR)
{
return DAR * Float(c.height) / Float(c.width)
}
# sets the DAR
function setDAR(float DAR)
{
global MeGUI_darx = Round(1000 * DAR)
global MeGUI_dary = 1000
}
在脚本中使用这些函数的示例
# input the video
DGDecode_mpeg2source("input.d2v")
# set the DAR to the input's DAR
DAR = 1.3672 # suppose we know the input is ITU 4:3
# calculate the SAR, because that doesn't change when cropping
SAR = last.getSAR(DAR)
crop( 10, 0, -10, -2)
# calculate the DAR, because that shouldn't be changed when resizing
DAR = last.getDAR(SAR)
LanczosResize(300,300)
# signal the DAR to MeGUI
setDAR(DAR)
# ensure that we are actually returning a video
return last