Pages

Saturday, November 28, 2009

Convert MTS/M2TS(AVCHD) to AVI

Yesterday, I used a Sony camera to record  some our video demos.  Unfortunately, output videos are in AHCHD format. So, I have to find a way to export them to avi or other format before putting to our R&D press.
Actually, there are many commercial softwares to do this. However, I don't like them. He he, I love things  free and open source. FFMPEG is the best one in the open source world for conversion video/audio format. Anyway, I found some bad things with FFMPEG:
+ Difficult for compilation in Windows. It was developed for best use in Linux world. To compile it in Windows, we need Cygwin or MSYS.

+ Loss documentation in practice. It takes me more than 1 hour to find the best command to convert MTS file to avi.



Finally, I compile FFMPEG successfully in Windows and my Ubuntu. I also run it successfully for my conversion need. However, let me show you some shortest ways to work with FFMPEG for conversion from MTS to AVI.

Install FFMPEG

In Ubuntu, it's very easy. Just open Synaptic package manager to find and install ffmpeg.
In windows, you need to compile ffmpeg before using. However, there a site contains some distribution binary package. You can download the final package to use in http://ffmpeg.arrozcru.org/builds/

Command to convert your MTS file to avi



ffmpeg -i your-mts-file.MTS -vcodec libxvid -b 18000k -acodec libmp3lame -ac 2 -ab 320k -ar 44100 -deinterlace -s 1440x1080 your-output.avi


If you run this in Ubuntu and found the error: Unknown encoder 'libxvid', please install libavcodec-unstripped (you can find this in synaptic package manager).

To understand more about above command, you should read the ffmpeg documentation here