bash - 如何在 FFMPEG 的同一命令中使用 -vf 和 -filter_complex
问题描述
我正在使用以下命令在 mac 上将视频转换为 FFMPEG 中的 gif:
ffmpeg -i screenAnimation2.mov -i palette.png -lavfi paletteuse -r "12" -s 300x200 -loop 2 screenAnimation2.gif
效果很好,但我只想指定宽度并保持纵横比,这可以使用缩放过滤器来完成:
ffmpeg -i screenAnimation2.mov -i palette.png -lavfi paletteuse -r "12" -vf "scale=300:-1" -loop 2 screenAnimation2.gif
但是,这会输出错误:
Filtergraph 'scale=300:-1' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph.
-vf/-af/-filter and -filter_complex cannot be used together for the same stream.
有没有办法结合2个过滤器?或者也许是一种获得正确高度值并避免使用比例过滤器的方法?
解决方案
您可以将它们组合在一个复杂的过滤器中:
-lavfi 'paletteuse,scale=300:-1'
推荐阅读
- java - 读取由分隔符分隔的 texfile 的内容
- android - Unity Build 不工作 UriFormatException
- python - Python:FPDF 中的着色单元格不起作用?
- spring - Spring JMS / 集成线程路由
- java - 将 Log4J 与 JUnit 和 Gradle 一起使用
- glassfish - 如何在 glassfish 服务器上集成 bootsfaces 和 jsf?
- java - Java线程不改变静态值
- python - Tensorflow 中的神经网络的准确度为 0
- node.js - 节点和 GraphQL 身份验证
- javascript - Javascript 无法在 ClientScriptManager 内触发