video - 如何使用ffmpeg将多个音频文件添加到视频中的特定时间?

标签 video ffmpeg

我尝试在视频播放后 10 秒和 15 秒分别添加 2 个音频文件。

我使用了以下命令,但输出视频在 10 秒后同时播放两个音频文件:

ffmpeg -y -i video.mp4 \ 
-itsoffset 10 -i audio1.mp3 \
-itsoffset 15 -i audio2.mp3 \
-filter_complex amix -map 0:v -map 1:a -map 2:a \
-c:v copy -c:a aac -strict experimental output.mp4

如何让这两个文件在视频播放后分别播放 10 秒和 15 秒?

最佳答案

是的,解决方案是使用-async 1 我在向视频添加N个音频时添加了一个通用公式 使用输入为 N+1 的 amix 过滤器

示例: 我已将 4 个音频添加到一个视频

ffmpeg -y -i video.mp4 -itsoffset 10 -i note1.mp3 -itsoffset 15 -i note2.mp3 -itsoffset 90.7 -i note3.mp3 -itsoffset 120.58 -i note4.mp3 -filter_complex amix=inputs=5[a] -map 0:v -map [a] -c:v copy -async 1 -c:a aac output.mp4

关于video - 如何使用ffmpeg将多个音频文件添加到视频中的特定时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64494513/

相关文章:

javascript - HTML5 视频 : Are there any benefits to using a source element over the src attribute

c - 以编程方式连接 mp4 文件

android - JavaCV从图像生成视频崩溃

unix - 通过 ffmpeg 命令将文件的扩展名转换为不同的目录

FFmpeg 过滤器围绕点旋转图像

ios - 在 iOS 上的 HTTP Live Streaming 客户端中拦截视频帧

html - 在 XPages 中使用 html5 视频标签

安卓 MediaCodec 解码器 : Slow Down Video Playback

docker - 在 nvidia docker 中使用 nvenc 运行 ffmpeg

video - ffmpeg 状态和质量/cuda (CPU/GPU)