#!/bin/sh

infile=$1

if [ "$infile" == "" ]; then
  echo "no input file given!"
  exit
fi

if [ -f $infile ]; then
  outfile=$2
  if [ "$outfile" == "" ]; then
    outfile="`basename $infile .ts`.mkv"
  fi
  ffmpeg -i $infile -vcodec copy -sameq -acodec copy -f matroska $outfile
else
  echo "file $infile not found!!"
fi