ffmpeg is an open source command-line tool for manipulating media files.
It is a example of a tool for command-line video editing.
Typically you will want to build ffmpeg from scratch to include the codec support you need (for instance to encode MPEG4).
Download a release of ffmpeg, unpack it and cd into the directory. Then:
sudo apt-get install yasm libvpx-dev libmp3lame-dev libx264-dev libfaac-dev
./configure --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libvpx --enable-gpl --enable-nonfree
This should take a while; if all works, you have successfully compiled ffmpeg with support for (in this case), mpeg4 (via libx264/libfaac), mp3 (via libmp3lame), and WebM (via libvpx).
You can run it directly with:
Or you can of course copy it somewhere more convenient (and in your path) or use make install to have it copied to someplace like /usr/local/bin:
sudo make install
You may need to logout/login again before ffmpeg is in your path.
Be sure to check out the presets that come with ffmpeg:
See An FFMpeg sniffer in python.