Avidemux is a video editing application which uses ffmpeg libraries. It is very useful for doing 'lossless' or near lossless editing of xvid and divx in avi containers. It also contains many filters and can be scripted. From the avidemux web site:
"Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks. It supports many file types, including AVI, DVD compatible MPEG files, MP4 and ASF, using a variety of codecs. Tasks can be automated using projects, job queue and powerful scripting capabilities."