美文网首页音视频开发经验之路
FFMpeg命令行学习笔记(3)命令行使用ffmpeg AVfi

FFMpeg命令行学习笔记(3)命令行使用ffmpeg AVfi

作者: WSGNSLog | 来源:发表于2016-10-18 15:04 被阅读2867次

官方文档:
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输入具有整数样本,那么将自动插入 aresample以执行向浮点样本的转换。

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.//输入的数量,如果没有指明,默认为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.
//输入流结束时(音频)容量重整化的转换时间(以秒为单位)。 默认值为2秒。

使用ffmpeg实现合并多个音频为一个音频的方法

可以使用ffmpeg的filter功能来进行这个操作,而且效果很好

amerge也可以实现,但是这里就介绍一下使用amix来做的方法
ffmpeg的filter功能强大的功能能够满足几乎所有的音视频操作,包括合并音频
ffmpeg可以支持多输入通道,也可以支持多输出通道,合并多音频的功能就使用多输入通道,单输出通道,所以大概的形式如下:

ffmpeg -i INPUT -i INPUT -i INPUT output

如果想用amix,这个参数是-filter_complex中的参数,可以这么用:

-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文件,整个过程如下:


屏幕快照.png

(后文参考:http://blog.chinaunix.net/uid-11344913-id-3934279.html)

相关文章

  • FFMpeg命令行学习笔记(3)命令行使用ffmpeg AVfi

    官方文档:6.16 amixMixes multiple audio inputs into a single o...

  • nodejs+ffmpeg

    Mac或linux环境下使用ffmpeg工具+ffmpeg库 本地下载ffmpeg命令行程序 安装node ffm...

  • FFmpeg 命令行程序简介

    FFmpeg 提供了三个主要的命令行应用程序,在 bin 目录中: 1、ffmpeg 命令使用简介 ffmpeg ...

  • 使用SDL播放PCM音频数据

    一、使用 ffplay 命令行程序播放 首先使用 ffmpeg 命令行程序抽出 pcm 数据: 使用 ffplay...

  • FFmpeg初识

    目录 参考 FFmpeg简介 FFmpeg命令行工具介绍 FFmepg类库介绍 1. 参考 [1] FFmpeg官...

  • FFmpeg解码MP4文件为YUV文件

    前言 前面我学了编译FFmpeg的Android库,写了一个命令行使用FFmpeg的Android Demo,C文...

  • 在mac os下使用FFmpeg

    1、在mac os下使用ffmpeg比较简单,可以直接使用命令行来操作。首先安装ffmpeg,这里默认系统已经安装...

  • FFmpeg视频录制

    一、Mac 平台 FFmpeg 命令行视频录制 FFmpeg 命令行视频录制的步骤和音频录制步骤类似,首先查看 M...

  • FFMPEG命令行收集

    平时使用FFmpeg的时候可以通过命令行使用各种功能。但是很多命令行,我们容易忘记,通过本文章记录日常常用的命令行...

  • FFMpeg与mPaaS小程序模块冲突

    mPaaS项目集成小程序模块,同时集成了FFMpeg的视频压缩功能, ffmpeg使用了fftools命令行操作方...

网友评论

    本文标题:FFMpeg命令行学习笔记(3)命令行使用ffmpeg AVfi

    本文链接:https://www.haomeiwen.com/subject/dmzzyttx.html