Skip to content

Instantly share code, notes, and snippets.

@lordjabez
Created October 21, 2023 01:39
Show Gist options
  • Save lordjabez/bf8b55238121cb80d19261baa7f98ac8 to your computer and use it in GitHub Desktop.
Save lordjabez/bf8b55238121cb80d19261baa7f98ac8 to your computer and use it in GitHub Desktop.
Detect silence in audio files
#!/usr/bin/env bash
set -e
audio_filename="${1}"
silence_length="${2}"
ffmpeg -i "${audio_filename}" -af "silencedetect=d=${silence_length}" -f null - |& awk '/silence_end/ {print $4,$5}' | awk '{S=$2;printf "%d:%02d:%02d\n",S/(60*60),S%(60*60)/60,S%60}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment