For example with avconv
avconv -i inputfile.avi -c:v libx264 outputfile.mp4 # to change video coding avconv -i InFile.avi -ss 00:12:34 -t 00:02:45.6 -c:v copy -c:a mp3 Out.avi
With the 1st you change only the video encoding, with the second you change only the audio encoding (and you extract a piece of 2m45.6s starting from 12m34s...).
You need to have installed the encoders library that you want to use.