FFmpeg/Avconv:缩放过滤器“评估表达式时出错”

FFmpeg/Avconv:缩放过滤器“评估表达式时出错”

我正在尝试使用以下命令通过 FFmpeg 缩放视频:

ffmpeg -i input.jpg -vf scale="'if(gt(a,4/3),320,-1)':'if(gt(a,4/3),-1,240)'" output_320x240_boxed.png

这是从 FFmpeg wiki 中逐字摘录的https://trac.ffmpeg.org/wiki/Scaling%20%28resizing%29%20with%20ffmpeg

当我将其复制并粘贴到 bash 中时,收到以下错误:

[scale @ 0x23a0980] [Eval @ 0x7fff165851e0] Missing ')' or too many args in 'if(gt(a,4/3),320,-1)'
[scale @ 0x23a0980] [Eval @ 0x7fff165851e0] Missing ')' or too many args in 'if(gt(a,4/3),-1,240)'
Error when evaluating the expression 'if(gt(a,4/3),-1,240)'
Error opening filters!

我尝试了所有能想到的转义各种逗号、引号和括号的组合,结果各不相同,但最重要的是,无论我做什么,FFmpeg 都无法正确评估表达式并抛出错误。有人知道我做错了什么吗?

完整输出:

ffmpeg version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
  built on Feb  6 2014 20:53:28 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, image2, from 'input.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj420p, 535x346 [PAR 100:100 DAR 535:346], 25 tbr, 25 tbn, 25 tbc
Incompatible pixel format 'yuvj420p' for codec 'png', auto-selecting format 'rgb24'
[buffer @ 0x100b400] w:535 h:346 pixfmt:yuvj420p
[scale @ 0x100a980] [Eval @ 0x7fff33214ee0] Missing ')' or too many args in 'if(gt(a,4/3),320,-1)'
[scale @ 0x100a980] [Eval @ 0x7fff33214ee0] Missing ')' or too many args in 'if(gt(a,4/3),-1,240)'
Error when evaluating the expression 'if(gt(a,4/3),-1,240)'
Error opening filters!

相关内容