官方文檔:
6.16 amix
Mixes multiple audio inputs into a single output.
Note that this filter only supports float samples (the amerge and pan audio filters support many formats). If the amix input has integer samples then aresample will be automatically inserted to perform the conversion to float samples.
譯:將多個音頻輸入混合為單個輸出。
請注意甚牲,此過濾器僅支持浮點型(amerge和pan音頻過濾器支持多種格式)义郑。 如果amix輸入具有整數(shù)樣本,那么將自動插入 aresample以執(zhí)行向浮點樣本的轉(zhuǎn)換丈钙。
For example
ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
will mix 3 input audio streams to a single output with the same duration as the first input and a dropout transition time of 3 seconds.
It accepts the following parameters:
參數(shù):
inputs
The number of inputs. If unspecified, it defaults to 2.//輸入的數(shù)量非驮,如果沒有指明,默認(rèn)為2.
duration
How to determine the end-of-stream.//決定了流的結(jié)束
longest
The duration of the longest input. (default)//最長輸入的持續(xù)時間
shortest
The duration of the shortest input.//最短輸入的持續(xù)時間
first
The duration of the first input.//第一個輸入的持續(xù)時間
dropout_transition
The transition time, in seconds, for volume renormalization when an input stream ends. The default value is 2 seconds.
//輸入流結(jié)束時(音頻)容量重整化的轉(zhuǎn)換時間(以秒為單位)雏赦。 默認(rèn)值為2秒劫笙。
使用ffmpeg實現(xiàn)合并多個音頻為一個音頻的方法
可以使用ffmpeg的filter功能來進(jìn)行這個操作芙扎,而且效果很好
amerge也可以實現(xiàn),但是這里就介紹一下使用amix來做的方法
ffmpeg的filter功能強(qiáng)大的功能能夠滿足幾乎所有的音視頻操作填大,包括合并音頻
ffmpeg可以支持多輸入通道戒洼,也可以支持多輸出通道,合并多音頻的功能就使用多輸入通道允华,單輸出通道圈浇,所以大概的形式如下:
ffmpeg -i INPUT -i INPUT -i INPUT output
如果想用amix,這個參數(shù)是-filter_complex中的參數(shù)靴寂,可以這么用:
-filter_complex amix=inputs=2:duration=first:dropout_transition=2
整條合并多音頻的的命令行即如下
ffmpeg -i take.mp3 -i pingfan.mp3 -filter_complex amix=inputs=2:duration=first:dropout_transition=2 outputnew2.mp3
上面的命令為將平凡之路與take me to your heart合并成一個a.mp3文件磷蜀,整個過程如下:
(后文參考:http://blog.chinaunix.net/uid-11344913-id-3934279.html)