The newest version of Handbrake supports XviD/AVI files.
Select source video file and point it at the desired avi file, however that bad news is that Handbrake doesnt support AVCHD (M2TS) it will encode to x264 in MP4/MKV only.
I dont know of any other x264 encoders on the Mac but what you could do in a round about way is encode the video using Hanbrake into x264/MKV. Then if you can find an OSX MKV to M2TS muxer that way works Google says there are some command line tools out there.
If you have access to windows running on your Mac through Parallels or some other system like bootcamp you can use
Ripbot264 and
XviD4PSP to encode x264 into M2TS.
Just select x264 CQ18 as your profile to keep image quality of original file and select AC3 as audio and lastly M2TS as container output.
Lastly if streaming from a Mac you can use PMS DLNA server it will transcode the video into another format on the fly so it should play on the TV, you will probably have to use the
latest beta version to get it working with the TV.