summaryrefslogtreecommitdiff
path: root/2flac
blob: 3000f4ccfaac0aeeae5c2ca4361835f0aec7945d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# Convert APE (Monkey Audio Format) to FLAC using ffmpeg.

set -euo pipefail

usage() {
  echo "Usage: $(basename "$0") [input file]..."
  echo "Converts input files into FLAC format."
  exit 0
}

main() {
  if [ $# = 0 ]; then
    usage
  fi
  for input in "$@"; do
    if [ -f "$input" ]; then
      output="${input%.*}.flac"
      ffmpeg -loglevel error -hide_banner -i "$input" -acodec flac "$output"
    fi
  done
}

main "$@"