1

I'd like to trim silence from the end of audio1.wav and beginning of audio2.wav and concatenate them by adding silence of predefined duration?


UPDATE


Following ffmpeg command add silence in between two wav files (from answer):

ffmpeg -y -i $in_wav_0 -i $in_wav_1 -filter_complex "aevalsrc=exprs=0:d=$pause[silence], [0:a] [silence] [1:a] concat=n=3:v=0:a=1[outa]" -map [outa] $out_wav

This command trims silence from the end (from answer):

ffmpeg -i input.wav -af silenceremove=1:0:-50dB input.wav

How to combine those two to commands so that concatenation would produce fixed duration silence interval in between regardless of silence present at the end and beginning of original audio files respectively? And preferably in one command.

alex
  • 425
  • 4
  • 21
  • you really should put your shoulder into this and show your work ... what have you done so far to solve this – Scott Stensland Oct 17 '18 at 03:48
  • What @ScottStensland recommended. As a bonus, have a look at SoX (http://sox.sourceforge.net/sox.html). Everything you need is there. If you stumble on a specific problem, do shoot. – Lukasz Tracewski Oct 17 '18 at 10:44
  • Updated description. @ScottStensland didn't want to post the result of what i've found this far, as I suspect it can be a wrong solution. I'm new to ffmpeg and it's command-line syntax, which looks very alien to me. – alex Oct 21 '18 at 07:42

1 Answers1

0

Command takes in_a_0.wav and in_a_1.wav as input and out.wav as output. Following command trims silence at the end and beginning from input files respectively and adds 1.5 seconds silence in between.

ffmpeg -loglevel verbose -y -i in_a_0.wav -i in_a_1.wav -filter_complex "[0:a] silenceremove=stop_periods=1:stop_duration=1:stop_threshold=-50dB [first], [1:a] silenceremove=start_periods=1:start_duration=0:start_threshold=-50dB [second],aevalsrc=exprs=0:d=1.5[silence],[first] [silence] [second] concat=n=3:v=0:a=1[outa]" -map [outa] out.wav
alex
  • 425
  • 4
  • 21