如何在 FFMPEG 中的同一命令中使用 -vf 和 -filter_complex
How to use -vf and -filter_complex in same command in FFMPEG
我正在 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.
有没有办法合并这两个过滤器?或者也许是一种获得正确高度值并避免使用比例过滤器的方法?
您可以将它们合并到一个复杂的过滤器中:
-lavfi 'paletteuse,scale=300:-1'
我正在 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.
有没有办法合并这两个过滤器?或者也许是一种获得正确高度值并避免使用比例过滤器的方法?
您可以将它们合并到一个复杂的过滤器中:
-lavfi 'paletteuse,scale=300:-1'