ffmpeg混音(将多个声音合成一个)命令

本文介绍如何使用FFmpeg的amix滤镜来混合多个音频输入为单一输出。详细解释了amix滤镜的参数配置,包括输入数量、输出时长确定方式及音量归一化过渡时间等,并提供了具体的命令实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ffmpeg命令中可以使用filter amix实现这个功能。

官方文档

http://ffmpeg.org/ffmpeg-filters.html 
6.8 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.

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:

inputs 
The number of inputs. If unspecified, it defaults to 2.

duration 
How to determine the end-of-stream.

longest 
The duration of the longest input. (default)

shortest 
The duration of the shortest input.

first 
The duration of the first input.

dropout_transition 
The transition time, in seconds, for volume renormalization when an input stream ends. The default value is 2 seconds.

例子

把当前电脑播放的声音混合到文件中的例子(”audio=”后面是音频设备名,ffmpeg -f dshow -list_devices 1 -i dummy可以在win下获取音频设备名):

ffmpeg.exe -re -i 1234.mp4 -f dshow -i audio=”立体声混音 (Realtek High Definition ” -filter_complex amix=inputs=2:duration=first:dropout_transition=0 -t 10 out.mp4 -y

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值