concat 2迷你音频文件并循环播放并添加背景音乐 [英] concat 2 mini audio files and make a loop and add a background music

查看:58
本文介绍了concat 2迷你音频文件并循环播放并添加背景音乐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用循环连接2个小音频文件,并在单个命令中添加背景音乐.

I Need to concatenate 2 small audio files with loop and add background music in a single command.

我能够将两个音频文件与背景音乐连接在一起.我上面给出的代码正在工作.

I am capable to concatenate two audio files with a background music. My above given code is working.

ffmpeg -i 1.mp3 -i 2.mp3 -i background.mp3 
-filter_complex "[0:0][1:0]concat=n=2:v=0:a=1,volume=1dB,aformat=fltp, pan=stereo|c0=c0|c1=c0[a0]; 
[2]volume=0.5dB,aformat=fltp,pan=stereo|c0=c0|c1=c1[a1];[a0][a1]amix=inputs=2:duration=longest,aformat=fltp[a]"
-map "[a]" -strict -2 -y output.mp3

但是我想循环播放连接的文件,直到背景音乐结束为止.串联文件的背景音乐长于大约5倍.

but i want to a make a loop of the concatenated files till the end of the background music. background music is longer than approx 5 times from concatenated files.

如果有人可以建议一个命令解决方案.

If someone can suggest a single command solution.

我了解amovie标签,但不幸的是,在这里无法使用它,因为据我所知,amovie要求文件名是串联文件无法实现的.

I know about amovie tag but unfortunately its not possible to use in here because amovie requires file name which is not possible with concatenated files as per my knowledge.

谁能帮我实现我的目标!

Can anyone help me how can i achieve my goal!

谢谢

推荐答案

使用concat多路分配器.

Use the concat demuxer.

创建文本文件

file 1.mp3
file 2.mp3

然后

ffmpeg -f concat -stream_loop -1 -i list.txt -i background.mp3 
-filter_complex "[0]volume=1dB,aformat=fltp,pan=stereo|c0=c0|c1=c0[a0]; 
                 [1]volume=0.5dB,aformat=fltp,pan=stereo|c0=c0|c1=c1[a1];
                 [a0][a1]amix=inputs=2:duration=shortest,aformat=fltp[a]"
-map "[a]" -strict -2 -y output.mp3

1.mp3和2.mp3应该具有相同的属性-采样率,频道布局等.

Both 1.mp3 and 2.mp3 should have the same properties - sampling rate, channel layout..etc

这篇关于concat 2迷你音频文件并循环播放并添加背景音乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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