#!/bin/sh

QUALITY="DSL"
QUALITY=${REMUX_PARAM_QUALITY}

case "$QUALITY" in
   DSL|dsl)
      VBR=640k
      ABR=64k
      VSIZE=320:240
   ;;
   WLAN|wlan)
      VBR=3072K
      ABR=128K
      VSIZE=720:576
   ;;
   *)
      error "Unknown quality '$QUALITY'"
   ;;
esac

echo -ne 'Content-type: video/mpeg\r\n'
echo -ne '\r\n'

ffmpeg -f mpegts -i - -vcodec mpeg4 -maxrate ${VBR} -vf scale=${VSIZE} -acodec libmp3lame -ab ${ABR} -ar 44100 -ac 2 -async 50 -f mpegts pipe:1
