ffmpeg-utils

  • 导航 (返回顶部)
1. 说明
2. Syntax 语法
2.1 Quoting and escaping 引用和转义
2.2 Date 日期
2.3 Time duration 持续时间
2.4 Video size 视频大小
2.5 Video rate 视频速率
2.6 Ratio 比率
2.7 Color 颜色
2.8 Channel Layout 通道布局
2.8.1 各个频道由 id 标识,如下表所示:
2.8.2 可以使用以下标识符指定标准通道布局组合:
2.8.3 各频道id空间图示: 
2.8.4 自定义通道布局
3 Expression Evaluation 表达式评估
3.1 functions
3.2 constants 常数
3.3. International System prefixes 国际系统前缀
下文是ffmpeg官方页面(2021-06-17)的google自动翻译, 请参阅如下原文。 https://ffmpeg.org/ffmpeg-utils.html

1. 说明

本文档描述了 libavutil 库提供的一些通用功能和实用程序。

2. Syntax 语法

本节记录了 FFmpeg 库和工具使用的语法和格式。

2.1 Quoting and escaping 引用和转义

除非明确指定,FFmpeg 采用以下引用和转义机制。应用以下规则:
  • ‘'’ and ‘\’ 是特殊字符(分别用于引用和转义)。除了它们之外,根据使用转义和引用的特定语法,可能还有其他特殊字符。
  • 特殊字符通过在它前面加上 ‘\’ 进行转义。
  • 包含在 ‘''’  之间的所有字符 字面上包含在解析的字符串中。引号字符 ''' 本身不能被引用,因此您可能需要关闭引用并转义它。
  • 除非转义或引用,否则将从解析的字符串中删除前导和尾随空格。
请注意,在使用命令行或脚本时,您可能需要添加第二级转义,这取决于所采用的 shell 语言的语法。 在av_get_token定义 的函数libavutil / avstring.h 可用于根据上面定义的规则解析引用或转义的标记。 工具 tools/ffescape 在FFmpeg 源代码树中的 可用于自动引用或转义脚本中的字符串。

2.2 Date 日期

接受的语法是: [(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z] now 如果值为“now”,则表示当前时间。 时间是本地时间,除非附加了 Z,在这种情况下,它被解释为 UTC。如果未指定年月日部分,则采用当前年月日。

2.3 Time duration 持续时间

有两种可接受的语法来表示持续时间。 [-][HH:]MM:SS[.m...] HH表示小时数,MM表示分钟数,最多 2 位,SS表示秒数,最多 2 位。末尾的m表示SS 的十进制值 。 或者 [-]S+[.m...][s|ms|us] S表示秒数,带有可选的小数部分 m。可选的文字后缀 's', 'ms', 'us' 表示将值分别解释为秒、毫秒或微秒。 在这两个表达式中,可选的 '-' 表示负持续时间。 Examples The following examples are all valid time duration: ‘55’55 seconds ‘0.2’0.2 seconds ‘200ms’200 milliseconds, that’s 0.2s ‘200000us’200000 microseconds, that’s 0.2s ‘12:03:45’12 hours, 03 minutes and 45 seconds ‘23.189’23.189 seconds

2.4 Video size 视频大小

指定源视频的尺寸, 它可以是宽度x高度形式的字符串, 或者是尺寸缩写的名称。以下缩写被认可:
namesizeX*Y ↓y/(x/16);16:?
sqcif128x961228812
qqvga160x1201920012
qcif176x1442534413.0909
hqvga240x1603840010.6667
cga320x2006400010
qvga320x2407680012
qntsc352x2408448010.9091
film352x2408448010.9091
ntsc-film352x2408448010.9091
wqvga400x240960009.6
qpal352x28810137613.0909
cif352x28810137613.0909
fwqvga432x2401036808.8889
hvga480x32015360010.6667
ega640x3502240008.75
nhd640x3602304009
sntsc640x48030720012
vga640x48030720012
ntsc720x48034560010.6667
4cif704x57640550413.0909
wvga852x4804089609.0141
hd480852x4804089609.0141
pal720x57641472012.8
spal768x57644236812
svga800x60048000012
qhd960x5405184009
xga1024x76878643212
hd7201280x7209216009
wxga1366x76810490888.9956
sxga1280x1024131072012.8
16cif1408x1152162201613.0909
wsxga1600x1024163840010.24
2kscope2048x85817571846.703
uxga1600x1200192000012
hd10801920x108020736009
2kflat1998x108021578408.6486
2k2048x108022118408.438
2kdci2048x108022118408.438
wuxga1920x1200230400010
qxga2048x1536314572812
woxga2560x1600409600010
qsxga2560x2048524288012.8
wqsxga3200x2048655360010.24
4kscope4096x171670287366.703
uhd21603840x216082944009
4kflat3996x216086313608.6486
4k4096x216088473608.438
4kdci4096x216088473608.438
wquxga3840x2400921600010
hsxga5120x40962097152012.8
whsxga6400x40962621440010.24
uhd43207680x4320331776009
whuxga7680x48003686400010

2.5 Video rate 视频速率

指定视频的帧速率,表示为每秒生成的帧数。它必须是格式为frame_rate_num / frame_rate_den的字符串 、整数、浮点数或有效的视频帧速率缩写。 以下缩写被认可: ‘ntsc’30000/1001 ‘pal’25/1 ‘qntsc’30000/1001 ‘qpal’25/1 ‘sntsc’30000/1001 ‘spal’25/1 ‘film’24/1 ‘ntsc-film’24000/1001

2.6 Ratio 比率

比率可以表示为表达式,或以分子:分母的形式表示 。 请注意,无限 (1/0) 或负值的比率被认为是有效的,因此如果要排除这些值,则应检查返回值。 未定义的值可以使用“0:0”字符串表示。

2.7 Color 颜色

它可以是如下定义的颜色名称(不区分大小写匹配)或 [0x|#]RRGGBB[AA]序列,可能后跟 @ 和表示 alpha 分量的字符串。 alpha分量可以是由“0x”后跟一个十六进制数或0.0到1.0之间的十进制数组成的字符串,表示不透明度值('0x00' 或者 '0.0' 表示完全透明,'0xff' 或者 '1.0' 完全不透明)。如果未指定 alpha 分量,则 '0xff' 假设。 字符串 'random' 将产生随机颜色。 识别以下颜色名称:
$ ffmpeg -colorscolorcn#RRGGBB
AliceBlue#f0f8ff爱丽丝蓝#f0f8ff
AntiqueWhite#faebd7古董白#faebd7
Aqua#00ffff水族#00ffff
Aquamarine#7fffd4蓝晶#7fffd4
Azure#f0ffff天蓝色#f0ffff
Beige#f5f5dc浅褐色的#f5f5dc
Bisque#ffe4c4浓汤#ffe4c4
Black#000000黑色的#000000
BlanchedAlmond#ffebcd杏仁白#ffebcd
Blue#0000ff蓝色的#0000ff
BlueViolet#8a2be2紫罗兰色#8a2be2
Brown#a52a2a棕色的#a52a2a
BurlyWood#deb887原木色#deb887
CadetBlue#5f9ea0藏青#5f9ea0
Chartreuse#7fff00黄绿色#7fff00
Chocolate#d2691e巧克力#d2691e
Coral#ff7f50珊瑚#ff7f50
CornflowerBlue#6495ed矢车菊蓝#6495ed
Cornsilk#fff8dc玉米穗黄#fff8dc
Crimson#dc143c深红色#dc143c
Cyan#00ffff青色#00ffff
DarkBlue#00008b深蓝#00008b
DarkCyan#008b8b深青色#008b8b
DarkGoldenRod#b8860b深金黄#b8860b
DarkGray#a9a9a9深灰色#a9a9a9
DarkGreen#006400深绿色#006400
DarkKhaki#bdb76b深卡其色#bdb76b
DarkMagenta#8b008b深洋红色#8b008b
DarkOliveGreen#556b2f深橄榄绿#556b2f
Darkorange#ff8c00深橙色#ff8c00
DarkOrchid#9932cc深兰花紫#9932cc
DarkRed#8b0000深红#8b0000
DarkSalmon#e9967a深橙红#e9967a
DarkSeaGreen#8fbc8f海藻绿#8fbc8f
DarkSlateBlue#483d8b深青蓝#483d8b
DarkSlateGray#2f4f4f深青灰#2f4f4f
DarkTurquoise#00ced1深粉蓝#00ced1
DarkViolet#9400d3暗紫#9400d3
DeepPink#ff1493深粉红#ff1493
DeepSkyBlue#00bfff深蓝#00bfff
DimGray#696969暗灰色#696969
DodgerBlue#1e90ff道奇蓝#1e90ff
FireBrick#b22222耐火砖#b22222
FloralWhite#fffaf0花白#fffaf0
ForestGreen#228b22森林绿#228b22
Fuchsia#ff00ff紫红色#ff00ff
Gainsboro#dcdcdc亮灰#dcdcdc
GhostWhite#f8f8ff鬼白#f8f8ff
Gold#ffd700金色的#ffd700
GoldenRod#daa520金棒#daa520
Gray#808080灰色的#808080
Green#008000绿色的#008000
GreenYellow#adff2f黄绿色#adff2f
HoneyDew#f0fff0甘露#f0fff0
HotPink#ff69b4亮粉色#ff69b4
IndianRed#cd5c5c印度红#cd5c5c
Indigo#4b0082靛青#4b0082
Ivory#fffff0象牙#fffff0
Khaki#f0e68c卡其色#f0e68c
Lavender#e6e6fa薰衣草#e6e6fa
LavenderBlush#fff0f5淡紫#fff0f5
LawnGreen#7cfc00草坪绿#7cfc00
LemonChiffon#fffacd粉黄#fffacd
LightBlue#add8e6浅蓝#add8e6
LightCoral#f08080珊瑚色#f08080
LightCyan#e0ffff淡青色#e0ffff
LightGoldenRodYellow#fafad2浅金黄色#fafad2
LightGreen#90ee90浅绿色#90ee90
LightGrey#d3d3d3浅灰色#d3d3d3
LightPink#ffb6c1淡粉色#ffb6c1
LightSalmon#ffa07a橙红#ffa07a
LightSeaGreen#20b2aa光海绿#20b2aa
LightSkyBlue#87cefa淡天蓝#87cefa
LightSlateGray#778899浅灰色#778899
LightSteelBlue#b0c4de轻钢蓝#b0c4de
LightYellow#ffffe0淡黄色#ffffe0
Lime#00ff00酸橙#00ff00
LimeGreen#32cd32青柠#32cd32
Linen#faf0e6亚麻布#faf0e6
Magenta#ff00ff品红#ff00ff
Maroon#800000栗色#800000
MediumAquaMarine#66cdaa草绿#66cdaa
MediumBlue#0000cd暗蓝#0000cd
MediumOrchid#ba55d3暗兰花#ba55d3
MediumPurple#9370d8暗紫#9370d8
MediumSeaGreen#3cb371暗海藻#3cb371
MediumSlateBlue#7b68ee青蓝#7b68ee
MediumSpringGreen#00fa9a嫩绿#00fa9a
MediumTurquoise#48d1cc粉蓝#48d1cc
MediumVioletRed#c71585暗紫#c71585
MidnightBlue#191970黑蓝#191970
MintCream#f5fffa薄荷乳白#f5fffa
MistyRose#ffe4e1粉玫瑰红#ffe4e1
Moccasin#ffe4b5莫卡辛#ffe4b5
NavajoWhite#ffdead纳瓦霍白#ffdead
Navy#000080海军#000080
OldLace#fdf5e6旧布黄#fdf5e6
Olive#808000橄榄#808000
OliveDrab#6b8e23淡绿褐#6b8e23
Orange#ffa500橙色#ffa500
OrangeRed#ff4500橙红色#ff4500
Orchid#da70d6兰花#da70d6
PaleGoldenRod#eee8aa淡金黄#eee8aa
PaleGreen#98fb98浅绿色#98fb98
PaleTurquoise#afeeee淡蓝绿#afeeee
PaleVioletRed#d87093淡紫红色#d87093
PapayaWhip#ffefd5粉木瓜橙#ffefd5
PeachPuff#ffdab9粉桃红#ffdab9
Peru#cd853f秘鲁#cd853f
Pink#ffc0cb粉色的#ffc0cb
Plum#dda0dd李子#dda0dd
PowderBlue#b0e0e6粉蓝色#b0e0e6
Purple#800080紫色的#800080
Red#ff0000红色的#ff0000
RosyBrown#bc8f8f玫瑰褐#bc8f8f
RoyalBlue#4169e1宝蓝色#4169e1
SaddleBrown#8b4513马鞍棕#8b4513
Salmon#fa8072三文鱼#fa8072
SandyBrown#f4a460桑迪布朗#f4a460
SeaGreen#2e8b57海绿色#2e8b57
SeaShell#fff5ee贝壳#fff5ee
Sienna#a0522d赭色#a0522d
Silver#c0c0c0银色的#c0c0c0
SkyBlue#87ceeb天蓝色#87ceeb
SlateBlue#6a5acd青蓝#6a5acd
SlateGray#708090青灰#708090
Snow#fffafa#fffafa
SpringGreen#00ff7f嫩绿#00ff7f
SteelBlue#4682b4钢蓝#4682b4
Tan#d2b48c黄褐色#d2b48c
Teal#008080青色#008080
Thistle#d8bfd8#d8bfd8
Tomato#ff6347番茄#ff6347
Turquoise#40e0d0绿松石#40e0d0
Violet#ee82ee紫罗兰#ee82ee
Wheat#f5deb3小麦#f5deb3
White#ffffff白色的#ffffff
WhiteSmoke#f5f5f5白色的烟#f5f5f5
Yellow#ffff00黄色的#ffff00
YellowGreen#9acd32黄绿色#9acd32

2.8 Channel Layout 通道布局

通道布局指定多通道音频流中通道的空间布置。为了指定通道布局,FFmpeg 使用了一种特殊的语法。

2.8.1 各个频道由 id 标识,如下表所示:

NAMEDESCRIPTIONcnuse
FLfront left左前27
FRfront right右前27
FCfront center前中21
LFElow frequency低频12
BLback left左后11
BRback right右后11
FLCfront left-of-center前中左6
FRCfront right-of-center前中右6
BCback center后中10
SLside left左侧14
SRside right右侧14
TCtop center顶中心1
TFLtop front left顶左前2
TFCtop front center顶前中2
TFRtop front right顶右前2
TBLtop back left顶左后2
TBCtop back center顶后中2
TBRtop back right顶右后2
TSLtop side left顶左侧1
TSRtop side right顶右侧1
DLdownmix left左缩混1
DRdownmix right右缩混1
WLwide left宽左1
WRwide right宽右1
SDLsurround direct left环绕左0
SDRsurround direct right环绕右0
LFE2low frequency 2低频21
BFCbottom front center底前中1
BFLbottom front left底左前1
BFRbottom front right底右前1

2.8.2 可以使用以下标识符指定标准通道布局组合:

NAMEDECOMPOSITIONchannelFLFRFCLFEBLBRFLCFRCBCSLSRotherTop/Bottom …
monoFC1  FC          
stereoFL+FR2FLFR           
2.1FL+FR+LFE3FLFR LFE         
3FL+FR+FC3FLFRFC          
3.0(back)FL+FR+BC3FLFR      BC    
3.1FL+FR+FC+LFE4FLFRFCLFE         
4FL+FR+FC+BC4FLFRFC     BC    
quadFL+FR+BL+BR4FLFR  BLBR       
quad(side)FL+FR+SL+SR4FLFR       SLSR  
4.1FL+FR+FC+LFE+BC5FLFRFCLFE    BC    
5FL+FR+FC+BL+BR5FLFRFC BLBR       
5.0(side)FL+FR+FC+SL+SR5FLFRFC      SLSR  
5.1FL+FR+FC+LFE+BL+BR6FLFRFCLFEBLBR       
5.1(side)FL+FR+FC+LFE+SL+SR6FLFRFCLFE     SLSR  
6FL+FR+FC+BC+SL+SR6FLFRFC     BCSLSR  
6.0(front)FL+FR+FLC+FRC+SL+SR6FLFR    FLCFRC SLSR  
hexagonalFL+FR+FC+BL+BR+BC6FLFRFC BLBR  BC    
6.1FL+FR+FC+LFE+BC+SL+SR7FLFRFCLFE    BCSLSR  
6.1(back)FL+FR+FC+LFE+BL+BR+BC7FLFRFCLFEBLBR  BC    
6.1(front)FL+FR+LFE+FLC+FRC+SL+SR7FLFR LFE  FLCFRC SLSR  
7FL+FR+FC+BL+BR+SL+SR7FLFRFC BLBR   SLSR  
7.0(front)FL+FR+FC+FLC+FRC+SL+SR7FLFRFC   FLCFRC SLSR  
7.1FL+FR+FC+LFE+BL+BR+SL+SR8FLFRFCLFEBLBR   SLSR  
7.1(wide)FL+FR+FC+LFE+BL+BR+FLC+FRC8FLFRFCLFEBLBRFLCFRC     
7.1(wide-side)FL+FR+FC+LFE+FLC+FRC+SL+SR8FLFRFCLFE  FLCFRC SLSR  
octagonalFL+FR+FC+BL+BR+BC+SL+SR8FLFRFC BLBR  BCSLSR  
hexadecagonalFL+FR+FC+BL+BR+BC+SL+SR+
TFL+TFC+TFR+TBL+TBC+TBR+WL+WR
16FLFRFC BLBR  BCSLSRWL;WRTFL;TFC;TFR;
TBL;TBC;TBR
downmixDL+DR2           DL;DR 
22.2FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+
TC+TFL+TFC+TFR+TBL+TBC+TBR+TSL+TSR+
LFE2+BFC+BFL+BFR
24FLFRFCLFEBLBRFLCFRCBCSLSRLFE2TC;TFL;TFC;TFR;TBL;
TBC;TBR;TSL;TSR
BFC;BFL;BFR

2.8.3 各频道id空间图示:

 TFL   TFC   TFR 
 T
S
L
       T
S
R
 
    TC    
         
 TBL   TBC   TBR 
           
S
D
L
FLW
L
FLC FC FRCW
R
FRS
D
R
S
L
     S
R
     
     
BL  BC  BR
           
 BFL   BFC   BFR 
           
 DL       DR 
           
           

2.8.4 自定义通道布局

自定义通道布局可以指定为一系列术语,以“+”或“|”分隔。每个术语可以是:
  • 标准通道布局的名称(e.g. ‘mono’, ‘stereo’, ‘4.0’, ‘quad’, ‘5.0’, etc.)
  • 单个频道的名称(e.g. ‘FL’, ‘FR’, ‘FC’, ‘LFE’, etc.)
  • 十进制数的通道数,后跟“c”,产生该通道数的默认通道布局(请参阅函数 av_get_default_channel_layout)。请注意,并非所有通道计数都有默认布局。
  • 十进制数的通道数,后跟“C”,产生具有指定通道数的未知通道布局。请注意,并非所有通道布局规范字符串都支持未知的通道布局。
  • 一个信道布局掩模mask,以十六进制开始以“0x”(见 AV_CH_*宏在libavutil/channel_layout.h.
在 libavutil 版本 53 之前,指定通道数的尾随字符“c”是可选的,但现在是必需的,而通道布局掩码也可以指定为十进制数(当且仅当后面没有“c”或“C”)。 另请参阅中av_get_channel_layout定义 的函数libavutil/channel_layout.h.

3. Expression Evaluation 表达式评估

在计算算术表达式时,FFmpeg 使用内部公式计算器,通过 libavutil/eval.h 界面。 表达式可能包含一元、二元运算符、常量和函数。 两个表达式expr1和expr2可以组合形成另一个表达式“ expr1 ; expr2 ”。 expr1和expr2依次求值,新表达式求值为expr2的值。 可以使用以下二元运算符:+, -, *, /, ^。 可以使用以下一元运算符:+, -.

3.1 functions

可以使用以下功能: abs(x)Compute absolute value of x. 计算x 的绝对值。 acos(x)Compute arccosine of x. 计算x 的反余弦值。 sin(x)Compute arcsine of x. 计算x 的反正弦。 atan(x)Compute arctangent of x. 计算x 的反正切。 atan2(x, y)Compute principal value of the arc tangent of y/x. 计算y / x 的反正切的主值。 between(x, min, max)Return 1 if x is greater than or equal to min and lesser than or equal to max, 0 otherwise. 如果x大于或等于min且小于或等于max,则返回 1,否则返回0。 bitand(x, y)bitor(x, y)Compute bitwise and/or operation on x and y. 在x和y上计算按位和/或运算。 x和y的计算结果在执行按位运算之前转换为整数。 请注意,转换为整数和转换回浮点数都会失去精度。当心大数(通常为 2^53 及更大)的意外结果。 ceil(expr)Round the value of expression expr upwards to the nearest integer. For example, "ceil(1.5)" is "2.0". 将表达式expr的值向上舍入到最接近的整数。例如,“ceil(1.5)”是“2.0”。 clip(x, min, max)Return the value of x clipped between min and max. 返回裁剪在min和max之间的x值。 cos(x)Compute cosine of x. 计算x 的余弦。 cosh(x)Compute hyperbolic cosine of x. 计算x 的双曲余弦值。 eq(x, y)Return 1 if x and y are equivalent, 0 otherwise. 如果x和y相等,则返回 1 ,否则返回0。 exp(x)Compute exponential of x (with base e, the Euler’s number). 计算x 的指数(基数e为欧拉数) floor(expr)Round the value of expression expr downwards to the nearest integer. For example, "floor(-1.5)" is "-2.0". 将表达式expr的值向下舍入到最接近的整数。例如,“地板(-1.5)”是“-2.0”。 gauss(x)Compute Gauss function of x, corresponding to exp(-x*x/2) / sqrt(2*PI). 计算x 的高斯函数,对应于 exp(-x*x/2) / sqrt(2*PI)。 gcd(x, y)Return the greatest common divisor of x and y. If both x and y are 0 or either or both are less than zero then behavior is undefined. 返回x和y 的最大公约数。如果x和 y均为 0 或其中一个或两者都小于零,则行为未定义。 gt(x, y)Return 1 if x is greater than y, 0 otherwise. 如果x大于y则返回 1 ,否则返回0。 gte(x, y)Return 1 if x is greater than or equal to y, 0 otherwise. 如果x大于或等于y则返回 1 ,否则返回0。 hypot(x, y)This function is similar to the C function with the same name; it returns "sqrt(x*x + y*y)", the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin. 这个函数类似于同名的C函数;它返回“sqrt( x * x + y * y )”,即边长为x和y的直角三角形斜边的长度,或点 ( x , y ) 与原点的距离。 if(x, y)Evaluate x, and if the result is non-zero return the result of the evaluation of y, return 0 otherwise. 计算x,如果结果非零,则返回y的计算结果,否则返回 0。 if(x, y, z)Evaluate x, and if the result is non-zero return the evaluation result of y, otherwise the evaluation result of z. 计算x,如果结果非零返回y 的计算结果,否则返回z 的计算结果。 ifnot(x, y)Evaluate x, and if the result is zero return the result of the evaluation of y, return 0 otherwise. 计算x,如果结果为零,则返回y的计算结果,否则返回 0。 ifnot(x, y, z)Evaluate x, and if the result is zero return the evaluation result of y, otherwise the evaluation result of z. 计算x,如果结果为零则返回y 的计算结果,否则返回z 的计算结果。 isinf(x)Return 1.0 if x is +/-INFINITY, 0.0 otherwise. 如果x是 +/-INFINITY,则返回 1.0 ,否则返回0.0。 isnan(x)Return 1.0 if x is NAN, 0.0 otherwise. 如果x是 NAN,则返回 1.0 ,否则返回0.0。 ld(var)Load the value of the internal variable with number var, which was previously stored with st(var, expr). The function returns the loaded value. 加载编号为var的内部变量的值,该值 之前是用 st( var , expr )存储的。该函数返回加载的值。 lerp(x, y, z)Return linear interpolation between x and y by amount of z. 按z的量返回x和y之间的线性插值。 log(x)Compute natural logarithm of x. 计算x 的自然对数。 lt(x, y)Return 1 if x is lesser than y, 0 otherwise. 如果x小于y则返回 1 ,否则返回0。 lte(x, y)Return 1 if x is lesser than or equal to y, 0 otherwise. 如果x小于或等于y,则返回 1 ,否则返回0。 max(x, y)Return the maximum between x and y. 返回x和y之间的最大值。 min(x, y)Return the minimum between x and y. 返回x和y之间的最小值。 mod(x, y)Compute the remainder of division of x by y. 计算x除以y的余数。 not(expr)Return 1.0 if expr is zero, 0.0 otherwise. 如果expr为零,则返回 1.0 ,否则返回0.0。 pow(x, y)Compute the power of x elevated y, it is equivalent to "(x)^(y)". 计算x提升y的幂,它等价于“( x )^( y )”。 print(t)print(t, l)Print the value of expression t with loglevel l. If l is not specified then a default log level is used. Returns the value of the expression printed. 使用日志级别l打印表达式t的值。如果 未指定l则使用默认日志级别。返回打印的表达式的值。Prints t with loglevel l random(x)Return a pseudo random value between 0.0 and 1.0. x is the index of the internal variable which will be used to save the seed/state. 返回一个介于 0.0 和 1.0 之间的伪随机值。x是用于保存种子/状态的内部变量的索引。 root(expr, max)Find an input value for which the function represented by expr with argument ld(0) is 0 in the interval 0..max.  在区间 0.. max 中查找由expr表示的函数 和参数ld(0)为 0的输入值。 expr中的表达式必须表示连续函数,否则结果未定义。 ld(0)用于表示函数输入值,这意味着给定的表达式将使用表达式可以访问的各种输入值进行多次计算 ld(0)。当表达式的计算结果为 0 时,将返回相应的输入值。 round(expr)Round the value of expression expr to the nearest integer. For example, "round(1.5)" is "2.0". 将表达式expr的值四舍五入到最接近的整数。例如,“round(1.5)”是“2.0”。 sgn(x)Compute sign of x. 计算x 的符号。 sin(x)Compute sine of x. 计算x 的正弦值。 sinh(x)Compute hyperbolic sine of x. 计算x 的双曲正弦值。 sqrt(expr)Compute the square root of expr. This is equivalent to "(expr)^.5". 计算expr 的平方根。这相当于“( expr )^.5”。 squish(x)Compute expression 1/(1 + exp(4*x)). 计算表达式1/(1 + exp(4*x))。 st(var, expr)Store the value of the expression expr in an internal variable. var specifies the number of the variable where to store the value, and it is a value ranging from 0 to 9. The function returns the value stored in the internal variable. Note, Variables are currently not shared between expressions. 将表达式expr的值存储在内部变量中。var指定存储值的变量的编号,它是一个范围从 0 到 9 的值。该函数返回存储在内部变量中的值。请注意,变量当前不在表达式之间共享。 tan(x)Compute tangent of x. 计算x 的切线。 tanh(x)Compute hyperbolic tangent of x. 计算x 的双曲正切值。 taylor(expr, x)taylor(expr, x, id)Evaluate a Taylor series at x, given an expression representing the ld(id)-th derivative of a function at 0. 计算x处的泰勒级数,给定一个表达式,表示ld(id)函数在 0 处的-th 导数。 当级数不收敛时,结果是不确定的。 ld(id)用于表示expr 中的导数顺序,这意味着给定的表达式将使用表达式可以访问的各种输入值进行多次计算 ld(id)。如果未指定id,则假定为 0。 请注意,当您在 y 而不是 0 处有导数时, taylor(expr, x-y)可以使用。 time(0)Return the current (wallclock) time in seconds. 以秒为单位返回当前(挂钟)时间。 trunc(expr)Round the value of expression expr towards zero to the nearest integer. For example, "trunc(-1.5)" is "-1.0". 将表达式expr的值向零舍入到最接近的整数。例如,“trunc(-1​​.5)”是“-1.0”。 while(cond, expr)Evaluate expression expr while the expression cond is non-zero, and returns the value of the last expr evaluation, or NAN if cond was always false. 当表达式cond非零时计算表达式expr,并返回最后一次expr评估的值,如果cond始终为假,则返回NAN 。

3.2 constants 常数

The following constants are available: 以下常量可用: PIarea of the unit disc, approximately 3.14 圆周率 Eexp(1) (Euler’s number), approximately 2.718 自然常数 欧拉数 PHIgolden ratio (1+sqrt(5))/2, approximately 1.618 黄金比例 假设如果表达式具有非零值,则该表达式被视为“真”,请注意: * 像 AND 一样工作 + 像 OR 一样工作 例如构造: if (A AND B) then C  相当于: if(A*B, C) 在您的 C 代码中,您可以扩展一元和二元函数的列表,并定义可识别的常量,以便它们可用于您的表达式。 评估器还识别国际系统单位前缀。如果在前缀后附加“i”,则使用二进制前缀,其基于 1024 的幂而不是 1000 的幂。“B”后缀将值乘以 8,并且可以附加在单位前缀之后或单独使用. 这允许使用例如“KB”、“MiB”、“G”和“B”作为数字后缀。

3.3 International System prefixes 国际系统前缀

可用的国际系统前缀列表如下,并指示了 10 和 2 的相应幂。 y10^-24 / 2^-80 z10^-21 / 2^-70 a10^-18 / 2^-60 f10^-15 / 2^-50 p10^-12 / 2^-40 n10^-9 / 2^-30 u10^-6 / 2^-20 m10^-3 / 2^-10 c10^-2 d10^-1 h10^2 k10^3 / 2^10 K10^3 / 2^10 M10^6 / 2^20 G10^9 / 2^30 T10^12 / 2^40 P10^15 / 2^40 E10^18 / 2^50 Z10^21 / 2^60 Y10^24 / 2^70


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部