我需要运行以下命令:
ffmpeg -i input.jpg -vf scale="'if(gt(a,4/3),320,-1)':'if(gt(a,4/3),-1,240)'" output_320x240_boxed.png
所以我执行:
cmd = exec.Command("ffmpeg", "-i", "input.jpg", "-vf", "scale=\"'if(gt(a,4/3),640,-1)':'if(gt(a,4/3),-1,300)'\"", "output_320x240_boxed.png")
它失败并出现以下错误:
Error when evaluating the expression 'if(gt(a,4/3),-1,300)"'. Maybe the expression for out_w:'"if(gt(a,4/3),640,-1)' or for out_h:'if(gt(a,4/3),-1,300)"' is self-referencing.
命令在命令行中执行时有效。为什么会发生这种情况,我该如何转义这些双引号以防止出现此错误?
慕田峪4524236
相关分类