Advertisement
Guest User

Untitled

a guest
Aug 6th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.81 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # form table of frame RMS sound levels
  4. listfile=$(mktemp)
  5. ffmpeg -i "$1" -af astats=metadata=1:reset=10,ametadata=print:key=lavfi.astats.Overall.RMS_level:file=$listfile -f null -
  6.  
  7. # convert list to csv file
  8. data_file=$(mktemp)
  9. 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
  10.  
  11. # form output file
  12. outfile="${1}.soundchart.png"
  13.  
  14. gnuplot <<-EOFMarker
  15. reset
  16. set datafile separator ","
  17. set title "Memory"
  18. set xlabel "Time"
  19. set ylabel "Level, dB"
  20. set xdata time
  21. set timefmt "%s"
  22. set format x "%H:%M:%S"
  23. set key left top
  24. set grid
  25. set term png size 3840,2160
  26. set output "$outfile"
  27. plot "$data_file" using 1:2 title "1" with lines
  28. EOFMarker
  29.  
  30. rm -v $listfile
  31. rm -v $data_file
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement