shell - 为什么参数的顺序在这里很重要?

标签 shell ffmpeg

据我所知,命令参数的顺序无关紧要,但在这里我看到了其他东西:

ffmpeg -f avi -i "s02e01.mkv" vcodec mpeg4 -b 4000k -acodec libmp3lame -ab 320k "converted.avi" 

这是结果:
s02e01.mkv: Operation not permitted

但是在更改“-f”和“-i”的位置后一切正常:
ffmpeg -i "s02e01.mkv" -f avi vcodec mpeg4 -b 4000k -acodec libmp3lame -ab 320k "converted.avi" 

这里有什么问题?

最佳答案

由程序决定如何处理给定的命令行输入。大多数程序并不关心它们的顺序,因为它们在功能上是不同的。但是在某些标志可以选择性地影响其他标志的情况下,最简单的实现方法是通过输入排序。 ffmpeg 就是这样一个程序。它的手册页说:

As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times.



gcc 是另一个可以捕获你的程序;它的手册页说:

You can mix options and other arguments. For the most part, the order you use doesn't matter. Order does matter when you use several options of the same kind; for example, if you specify -L more than once, the directories are searched in the order specified. Also, the placement of the -l option is significant.

关于shell - 为什么参数的顺序在这里很重要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16981296/

相关文章:

linux - 使用 Linux 排序命令对多个键进行排序

ffmpeg - 使用 FFMPEG 从音频和调整大小的图像创建视频

FFMPEG 命令在 shell 中有效,但在 node.js 中无效

shell - 使用 If-Then-Else 将文件拆分为 3 个文件

java - 从 java 调用时 shell 脚本中的 Scrapy 命令不执行

php - 来自 BASH 的 Tcpdump

unix - 如何将 shell session 的所有控制台输出发送到日志文件

mp3 - 如何使用 ffmpeg 将 mp3 从 x 裁剪为 x+n?

ios - 使用 ffmpeg 提取的电视音频在 iOS 中不起作用(但在模拟器中起作用)

python - 在 python 中找不到可执行文件 'ffmpeg'