summaryrefslogtreecommitdiffstats
path: root/convert2ogg
blob: 1dc32d3c0d67f8ff8725d772f0f43cfac2f977ef (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
26
27
#!/bin/bash
#----------------------------------------------------
# Version:      0.1.0
# Author:       Florian "Bluewind" Pritz <flo@xssn.at>
#
# Licensed under WTFPL v2
#   (see COPYING for full license text)
#
#----------------------------------------------------
# Converts a file to an OGG
#----------------------------------------------------

for i in "$@"; do
  pushd . &> /dev/null
  cd "$(dirname "$i")"

  file="$(basename "$i")"
  file_ogg="$(echo ${file} | sed 's/\(.*\)\..*/\1/').ogg"
  tmpfile="$(echo ${file} | sed 's/\(.*\)\..*/\1/').wav"

  mplayer -ao pcm:fast -novideo -vc null -vo null -ao pcm:file="$tmpfile" "$file"
  oggenc -q 5 "$tmpfile"
  
  rm "$tmpfile"

  popd &> /dev/null
done