Reputation: 495
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?
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.
Upvotes: 1
Views: 1920
Reputation: 495
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
Upvotes: 0