#!/bin/sh

if [ $# -lt 1 ] ; then
    echo "Usage: `basename $0` <mp4 video file>"
    exit 1
fi

webm="$1"
if [ ! -e "$webm" ] ; then
    echo "File $webm is missing"
    exit 1
fi

basenm=`basename "$webm" .mp4`
if [ "$basenm" = "$webm" ] ; then
  basenm=`basename $webm .mpg`
  if [ "$basenm" = "$webm" ] ; then
     echo "$webm does not feature extention .webm"
     exit 1
  fi
fi

set -x
##  -metadata TITLE="Futter.  Streng verdaulich"
ffmpeg -i "$webm" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$basenm".webm
