MP4Box is what you need for that. It might actually handle the AVI content too, especially if you want to output to MP4.
Here's a thread on it at Doom9, with links to builds of MP4Box and some nice GUIs:
http://forum.doom9.org/showthread.php?t=94874Here's the page for MP4Box on the GPAC project's SourceForge page. This includes documentation for MP4Box (which is command line only):
http://gpac.sourceforge.net/doc_mp4box.phpI'd probably check out YAMB, as it includes a compiled version of MP4Box with the installer, and looks to contain all the features you'd need.
http://forum.doom9.org/showthread.php?s=&threadid=93927EDIT:
Be aware though, since MP4Box doesn't re-encode the video (just remuxes it) when joining two or more clips together, this very important caveat applies:
for joining to work the same features have to be used in both streams.
This means that the original encoding settings have to be essentially identical on all of the source clips. Otherwise, it won't work!