Převod MTS (AVCHD) do AVI

FFmpeg Tutorial: Convert MTS/M2TS(AVCHD) to AVI

This tutorial will enable you to install ffmpeg and the libraries that will give ffmpeg support for the codecs required to convert AVCHD videos.

It is faster to install ffmpeg than m2tstoavi and works with Sony HDR-SR7 camera. Another subscriber sent me an email and told me he got it working with his Sony HDR-SR12E camcorder using this method. Please comment if you were able to covert videos from your camera with these instructions.

Install the necessary libraries for ffmpeg and subversion if you don't already have them.

sudo apt-get install libxvidcore4-dev libfaad-dev libfaac-dev libmp3lame-dev subversion

Download the latest SVN FFmpeg

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg

Once FFmpeg has downloaded, you need to configure it with these switches enabled.

cd ffmpeg
./configure --enable-gpl --enable-libmp3lame --enable-libxvid --enable-libfaac --enable-nonfree
make
sudo make install

Investigate the video/audio bitrate, resolution,PAR(pixel aspect ratio),DAR(display aspect ratio) with the ffmpeg -i input.mts command.

$ ffmpeg -i input.mts
Input #0, mpegts, from 'input.mts':
   Duration: 00:00:37.56, start: 1.000067, bitrate: 9440 kb/s
   Program 1
   Stream #0.0[0x1011]: Video: h264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
  • video bitrate = 9440 kb/s
  • pixel aspect ratio[PAR]: 4:3
  • display aspect ration[DAR]: 16:9
  • audio bitrate = 448kb/s

From the above output we can fill in the ffmpeg switches. My Sony HDR-SR7 uses interlaced frames, so I added deinterlace switch.

ffmpeg -i input.mts -vcodec libxvid -b 18000k -acodec libmp3lame -ac 2
-ab 320k -deinterlace -s 1440x1080 output.avi

The resulting file looks like this

$ ffmpeg -i ouput.avi
Input #0, avi, from 'output.avi':
  Duration: 00:00:19.08, start: 0.000000, bitrate: 9564 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 59.94 tbr, 59.94 tbn, 59.94 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 320 kb/s