ffmpeg - 如何将具有时间偏移的多个音频合并到视频中? [英] ffmpeg - how to merge multiple audio with time offset into a video?

查看:41
本文介绍了ffmpeg - 如何将具有时间偏移的多个音频合并到视频中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 FFMPEG 来合并多个音频和一个视频.

I want to use FFMPEG to merege multiple audios and one video.

材料是:

  1. 两个短音频剪辑(short-clip-1.3gp、short-clip-2.3gp),
  2. 一个带声音的视频剪辑 (1.mp4),
  3. 以及一个与视频剪辑时长相同的音频剪辑 (1.mp3).

要求是:

  1. 删除视频剪辑的声音
  2. 添加 1.mp3
  3. 在 0 秒时间戳处添加 short-clip-1.3gp,在 10 秒时间戳处添加 short-clip-2.3gp.

要求如下所示.

<--short-clip-1.3gp持续时间--> <--short-clip-2.3gp持续时间-->

<--short-clip-1.3gp time duration--> <--short-clip-2.3gp time duration-->

<-------------------------------------- 1.mp3 ----------------------------------------------------->

<-------------------------------------- 1.mp3 ----------------------------------------------------->

<-------------------------------------- 1.mp4 ----------------------------------------------------->

<-------------------------------------- 1.mp4 ----------------------------------------------------->

我使用的命令如下,但它没有按预期工作.<代码>ffmpeg -i 1.mp4 -i 1.3gp -itsoffset 00:00:10 -i 2.3gp -i 1.mp3 -map 0:v -map 1:a -map 2:a -map 3:a -c:vcopy -c:a copy result.mp4

The command I use is as below, but it does not work as expected. ffmpeg -i 1.mp4 -i 1.3gp -itsoffset 00:00:10 -i 2.3gp -i 1.mp3 -map 0:v -map 1:a -map 2:a -map 3:a -c:v copy -c:a copy result.mp4

感谢任何提示!

推荐答案

您必须混合音频流:

ffmpeg -i 1.mp4 -i 1.3gp -i 2.3gp -i 1.mp3
  -filter_complex "[2]adelay=10000|10000[s2];[3:a][1:a][s2]amix=3[a]"
  -map 0:v -map "[a]" -c:v copy result.mp4

这篇关于ffmpeg - 如何将具有时间偏移的多个音频合并到视频中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆