Last active
December 15, 2021 20:15
-
-
Save aleksas/19e7513acbb6e94bc2ddaa0247d9c179 to your computer and use it in GitHub Desktop.
FFMPEG trim silence from audio files and concatenate them with specified lengh silence interval.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
in_1_fname=./wavefile1.wav | |
in_2_fname=./wavefile2.wav | |
out_fname=./out.wav | |
threshold=-50dB | |
pause=1.5 # seconds | |
ffmpeg -loglevel verbose -y \ | |
-i $in_1_fname -i $in_2_fname -filter_complex \ | |
"\ | |
[0:a] silenceremove=stop_periods=1:stop_duration=1:stop_threshold=$threshold [first],\ | |
[1:a] silenceremove=start_periods=1:start_duration=0:start_threshold=$threshold [second],\ | |
aevalsrc=exprs=0:d=$pause[silence],\ | |
[first] [silence] [second] concat=n=3:v=0:a=1[outa]\ | |
" \ | |
-map [outa] $out_fname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment