for fname in $(ls *.avi);
do
	echo $fname
	fbase=${fname:0:-4}
	fmp=$fbase".mp4"
	fmpold=$fbase_old".mp4"
	if [ -e $fmp ]
	then
		echo " '$fmp' exists and is moved"
		mv $fmp $fmpold
	else
		echo "no '$fmp' "
	fi
	ffmpeg -i $fname -codec:v libx264  -crf 23 -bf 2  -flags +cgop -pix_fmt yuv420p -movflags faststart $fmp

done
