summaryrefslogtreecommitdiff
path: root/aencode.sh
blob: af101be84dea6e8bb9957f67e8a8691df4074690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

# configure ffmpeg location if not in PATH
FFMPEG=ffmpeg
# configure flags
FFMPEG_FLAGS=""

set -e

ffmpeg() {
  set -x
  command ${FFMPEG} -threads ${THREADS} ${FFMPEG_FLAGS} "$@"
  set +x
}

for d in bgm sfx; do
  pushd $(dirname $0)/www/dump/${d}
  for f in *.ogg; do
    OUT=${f%.ogg}
    ffmpeg -y -i $f -c:a pcm_s16le ${OUT}.wav
    opusenc --bitrate 64 ${OUT}.wav ${OUT}.opus
    ffmpeg -n -i ${OUT}.wav -c:a libfdk_aac -vbr 2 ${OUT}.m4a || true
  done
  popd
done