#!/bin/bash
# runs ffmpeg/avconf with params
# video/audio file, in and out, are in current dir
# 1. pram: infile, 2. param optional: extension of outfile, default ext.: mpg
#
#
# 130227

#prg="/usr/bin/ffmpeg"
prg="/usr/bin/avconv"
infile=$1
if [ $# -lt 2 ]; then
    outfile_ext=mpeg
else
    outfile_ext=$2
fi
outfile="${infile%.*}.$outfile_ext"
#outfile_options="-b 300k -g 1"
#outfile_options=" -b 60k "
#outfile_options="-minrate 2000k -maxrate 6000k -bufsize 1835k"
#outfile_options="-g 1 -maxrate 800k -bufsize 5k"
echo "$prg -i $infile $outfile_options $outfile"

#exit

#$prg -i $infile -c mpeg2video $outfile		# Invalid encoder type 'mpeg2video'
$prg -i $infile $outfile_options $outfile > aaa


exit
--------------------------

#outfile-params=

#aspect="16:9"
#video_options=" -aspect $aspect $pad_options "

#outfile_options="-target dvd "
#default_options="-r 25" # -s:cif (= -s 352x288), -s:qvga (= -s 320x240),-s:hd1080,  -s 960x540" size usually the same as input
# -g 2 (gop-size), -b 2400k (kbits/s)

if test -f $newname.mpeg
then
   echo Err: $1.mpeg just exists
   exit
fi   

LOG_file="LOG.log"
DATUM=`/bin/date '+%Y%m%d-%H%M'`
echo Begin ---   $DATUM
echo Begin ---   $DATUM >> $LOG_file
echo avi to mpeg:   $1 >> $LOG_file

