gpt4 book ai didi

linux - ffmpeg 错误 : "Missing ' )' or too many args in ' if(gt(a, 1),650,-1 )'"

转载 作者:太空宇宙 更新时间:2023-11-04 04:41:03 27 4
gpt4 key购买 nike

我正在尝试在 Linux shell 中运行此 ffmpeg 命令,以缩小视频(如果是纵向,则最大高度为 650,同时调整宽度。如果是横向,则最大宽度为 650,并根据宽高比调整高度):

ffmpeg -i 1.mp4 -r 30 -vf scale="'if(gt(a,1),650,-1)':'if(gt(a,1),-1,650)'"-vcodec libx264 output_file1.mp4

但我收到以下错误:

[scale @ 0x1d48a40] [Eval @ 0x7fff53a49340] Missing ')' or too many args in 'if(gt(a,1),650,-1)' [scale @ 0x1d48a40] [Eval @ 0x7fff53a49340] Missing ')' or too many args in 'if(gt(a,1),-1,650)' Error when evaluating the expression 'if(gt(a,1),-1,650)'

**编辑:我尝试使用新的 @slhck 语法:

-vf "scale=if(gt(a\,1)\,650\,-2):if(gt(a\,1)\,-2\,650)"

我得到的结果是:

ffmpeg version 0.8.16-4:0.8.16-0ubuntu0.12.04.1, Copyright (c) 2000-2014 the Libav developers built on Sep 16 2014 18:33:49 with gcc 4.6.3 The ffmpeg program is only provided for script compatibility and will be removed in a future release. It has been deprecated in the Libav project to allow for incompatible command line syntax improvements in its replacement called avconv (see Changelog for details). Please use avconv instead.

Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4': Metadata: major_brand : isom minor_version : 0 compatible_brands: isom3gp4 creation_time : 2015-02-05 14:54:24 Duration: 00:00:45.30, start: 0.000000, bitrate: 17058 kb/s Stream #0.0(eng): Video: h264 (High), yuv420p, 1920x1080, 17021 kb/s, 30.01 fps, 90k tbr, 90k tbn, 180k tbc Metadata: creation_time : 2015-02-05 14:54:24 Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 124 kb/s Metadata: creation_time : 2015-02-05 14:54:24 File 'output_file1.mp4' already exists. Overwrite ? [y/N] y

[buffer @ 0x747ec0] w:1920 h:1080 pixfmt:yuv420p [scale @ 0x745a40] [Eval @ 0x7fffac94b220] Missing ')' or too many args in 'if(gt(a,1),650,-2)' [scale @ 0x745a40] [Eval @ 0x7fffac94b220] Missing ')' or too many args in 'if(gt(a,1),-2,650)' Error when evaluating the expression 'if(gt(a,1),-2,650)' Error opening filters!

我应该做什么?

最佳答案

首先,这不起作用,因为 libx264 的高度/宽度必须能被 2 整除,因此您需要将 -2 而不是 -1 作为高度/宽度参数。请参阅scale video filter documentation了解更多相关信息。

另一个问题:您的 ffmpeg 已经过时了,可能不支持您尝试使用的过滤器表达式。 Download a recent static buildcompile it yourself

要使表达式起作用,您必须 escape逗号:

-vf "scale=if(gt(a\,1)\,650\,-2):if(gt(a\,1)\,-2\,650)"

或者将其放在单引号中:

-vf scale="'if(gt(a,1),650,-2)':'if(gt(a,1),-2,650)'"

由于您已经在使用后者,因此也许可以尝试使用转义的第一个变体。

关于linux - ffmpeg 错误 : "Missing ' )' or too many args in ' if(gt(a, 1),650,-1 )'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28669925/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com