convert_to_mono.sh 559 B

12345678910111213
  1. # Copyright (c) 2022 A. Semphris <semphris@protonmail.com>
  2. # Released under Creative Commons Zero (CC0)
  3. # https://creativecommons.org/publicdomain/zero/1.0/legalcode
  4. # Sounds MUST be mono (1 channel only) for positional sounds to work with OpenAL
  5. # Requires ffmpeg and ffprobe (the former almost always comes with the former)
  6. for file in `ls`; do
  7. if [[ ! "$file" =~ .sh$ ]] && [ "$(ffprobe -i $file -show_streams -select_streams a:0 2>&1 | grep channels=1)" = "" ]; then
  8. ffmpeg -i $file -map_channel 0.0.0 temp.$file && mv temp.$file $file;
  9. fi
  10. done