2

What I am trying to do is to concat wav files which contain short audios. I am able to concat them into one file, but I am trying to set each file at a specific time.

Currently, I can concat the files but I can't place each one at the specific time they need to be. I thought maybe I can just add the right amount of silence between them and solve the problem this way. I am new to ffmpeg

I have a text file with the file names i.e. text.txt

file a.wav
file b.wav
file c.wav

and I use this cmd:

ffmpeg -f concat -i text.txt out.mp3

This works, but is there a way to add a specified number of minutes of silence between them?

I tried to put this in the text file, but it didn't work:

file a.wav
inpoint 5
outpoint 10
file b.wav
inpoint 10
outpoint 20
file c.wav
inpoint 20
outpoint 25
Joe T. Boka
  • 6,554
  • 6
  • 29
  • 48
  • 1
    make a few 'silent' wav clips of varying length and build a function to add them to your series as required – Robert Rowntree Jul 12 '18 at 13:16
  • 1
    @RobertRowntree method is sound :/ but you don't need multiple silent WAVs. Just one will do - as long as its length is equal to the maximum silence that you need. Insert it in the concat text file as necessary. and set `outpoint` for silence. Note that `inpoint` and `outpoint` specify position within that input, not the output file. – Gyan Jul 12 '18 at 14:16
  • @Gyan thanks for your comments, great solution. I appreciate it. – Joe T. Boka Jul 13 '18 at 08:08
  • @RobertRowntree Thanks for your solution as well. I appreciate it. – Joe T. Boka Jul 13 '18 at 08:09

1 Answers1

4

You can use the aevalsrc filter to generate silence audio. Then use the concat filter to merge them all.

Here is a simple example:

E:\video\tmp>ffmpeg -i a.wav -i b.wav -filter_complex "aevalsrc=exprs=0:d=5[silence], [0:a] [silence] [1:a] concat=n=3:v=0:a=1[outa]" -map "[outa]" out.mp3

For aevalsrc filter, aevalsrc=exprs=0:d=5[silence]. exprs specifies the output value. d means the duration in seconds. [silence] is your output label. This filter also supports specifying the sample rate, number of samples and so on.

Check this page for detail:

http://www.ffmpeg.org/ffmpeg-filters.html

Dan Stowell
  • 4,618
  • 2
  • 20
  • 30
GalaDOS
  • 146
  • 7