AVI is a container. M2v is a Transport stream (TS) raw video file (without audio). They are not the same and you cannot, in most cases convert it to m2v.
For example, if I took an mpeg program file (as opposed to TS) and demux the audio and video, I'd get two files: 1) raw video in the form of m2v/mpv and 2) audio file in the form of PCM/WAV or MPA. However, this m2v is an mpeg2 raw video. The raw videos inside avi's, in most cases, are divx, xvid, 3vix or some form of mp4-part2/asp.
It would help you explain what you're trying to achieve.