Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # form table of frame RMS sound levels
- listfile=$(mktemp)
- ffmpeg -i "$1" -af astats=metadata=1:reset=10,ametadata=print:key=lavfi.astats.Overall.RMS_level:file=$listfile -f null -
- # convert list to csv file
- data_file=$(mktemp)
- cat $listfile | tr -d '\n' | tr 'O' '\n' | tr 'f' ' ' | tr 'l' ' ' | tr -d '=' | tr ':' ' ' | awk '{print $10 "," $4}' | head -n -4 | tail +4 > $data_file
- # form output file
- outfile="${1}.soundchart.png"
- gnuplot <<-EOFMarker
- reset
- set datafile separator ","
- set title "Memory"
- set xlabel "Time"
- set ylabel "Level, dB"
- set xdata time
- set timefmt "%s"
- set format x "%H:%M:%S"
- set key left top
- set grid
- set term png size 3840,2160
- set output "$outfile"
- plot "$data_file" using 1:2 title "1" with lines
- EOFMarker
- rm -v $listfile
- rm -v $data_file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement