When AVI is the right output
AVI is Microsoft's legacy video container — largely superseded by MP4. Convert to AVI when you're archiving to older Windows-based systems, feeding into legacy editing software that doesn't accept MP4, or delivering to older projection / TV equipment that only handles AVI. For anything new, use MP4.