When it comes to encode some videos with ffmpeg, some libraries are needed, but not all provided inside the ffmpeg package.
To encode avi videos to mp4 with ffmpeg, you will need libfaac, and this library is hard to run.
FAAC is an MPEG-4 and MPEG-2 AAC encoder (http://www.audiocoding.com/faac.html).
So, if you have libfaac, this instruction will help you:
ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a libfaac -b:a 192k -ac 2 out.mp4
But, if you don’t have libfaac, this instruction will save you time:
ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a aac -strict experimental -b:a 192k -ac 2 out.mp4
Have a great day.