Linux?
sudo apt-get install autoconf automake build-essential git libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
mkdir ~/temp
cd ~/temp/ tar xzvf yasm-1.2.0.tar.gz cd yasm-1.2.0 ./configure make sudo make install
cd ~/temp/ git clone --depth 1 git://git.videolan.org/x264.git cd x264 && ./configure --enable-static make sudo make install
cd ~/temp/ git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac cd fdk-aac autoreconf -fiv ./configure --disable-shared make sudo make install
sudo apt-get install libmp3lame-dev
sudo apt-get install nasm cd ~/temp/ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar xzvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure --enable-nasm --disable-shared make sudo make install
cd ~/temp/ wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz tar xzvf opus-1.1.tar.gz cd opus-1.1 ./configure --disable-shared make sudo make install
cd ~/temp/ wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2 tar -xjvf libvpx-v1.3.0.tar.bz2 cd libvpx-v1.3.0 ./configure --disable-examples make sudo make install
cd ~/temp/ git clone --depth 1 git://source.ffmpeg.org/ffmpeg cd ffmpeg ./configure --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab make sudo make install
/usr/bin/ffmpeg -y -i inputfile.m2ts -f mp4 -vcodec libx264 -s 1280x720 -aspect 16:9 -acodec libmp3lame -ac 2 -ar 48000 -ab 128k -async 1 -threads 4 -coder 1 -deinterlace -qmin 10 outputfile.mp4
/usr/bin/ffmpeg -y -i inputfile.m2ts -f mp4 -vcodec libx264 -s 1280x720 -aspect 16:9 -threads 4 -coder 1 -deinterlace -qmin 10 outputfile.mp4