Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 28 lines (19 sloc) 581 Bytes
#!/usr/bin/env bash
# ffspectrum: Create a spectrograph video from an audio clip
set -eo pipefail
SCALE="${SCALE:-sqrt}"
DIM="${DIM:-1920x1080}"
function help {
echo "Usage: ffspectrum <input> <output>"
exit
}
function installed {
cmd=$(command -v "${1}")
[[ -n "${cmd}" ]] && [[ -f "${cmd}" ]]
return ${?}
}
[[ $# -eq 2 && -f $1 && ! -f $2 ]] || help
installed ffmpeg || { >&2 echo "Missing ffmpeg."; exit 1; }
ffmpeg -i "${1}" -filter_complex \
"[0:a]showspectrum=s=${DIM}:mode=combined:color=intensity:scale=${SCALE}[v]" \
-map "[v]" -map 0:a "${2}"