在看ffmpeg命令的時候經常會看到有些地方使用--vcodec
指定視頻解碼器,而有些地方使用-c:v
指定視頻解碼器,那這兩個有沒有區別呢?
ffmpeg的官方文檔:
-vcodec codec (output)
Set the video codec. This is an alias for -codec:v.
也就是說-vcodec
和-codec:v
等價。但是並沒有說和-c:v
等價啊。看一下-codec:v
的文檔:
-c[:stream_specifier] codec (input/output,per-stream)
-codec[:stream_specifier] codec (input/output,per-stream)
Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. codec is the name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded.
For example
ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
encodes all video streams with libx264 and copies all audio streams.
For each stream, the last matching c option is applied, so
ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
will copy all the streams except the second video, which will be encoded with libx264, and the 138th audio, which will be encoded with libvorbis.
也就是說-codec
和-c
是等價的。所以--vcodec
和-c:v
是等價的。
文檔說明-codec可以爲指定的流設置編碼器,具體通過stream_specifier
來指定。
-ab和-b參數去哪裏了?
在看資料的時候發現有些文字中用到了-ab
和-b
參數,但是官網文檔沒有這兩個參數。。
後來通過ffmpeg- h
發現了這兩個參數:
-ab bitrate audio bitrate (please use -b:a)
-b bitrate video bitrate (please use -b:v)
可以看出這兩個參數分別設定音頻比特率和視頻比特率,但是已經不推薦使用這種寫法了,改爲使用-b:a
和-b:v
。