Wednesday, May 4, 2011

FFMPEG: Convert AVCHD (*.mts, *.m2ts) files to AVI files

Most Camcorders including the "Canon LEGRIA HF R16" record Digital High Definition Video in full HD resolution at 50 frames (interlaced) in mts/m2ts-format.

To create more a transportable Standard definition DVD quality progressive avi file,
you can convert them with ffmpeg.

Assuming you have installed ffmpeg and all the libraries you might need,
use the following command to get the job done relatively fast.


1. Euro format: (PAL)

ffmpeg -i inputfile.m2ts -deinterlace -target pal-dvd outputfile.avi

2.American Format: (NTSC) 
ffmpeg -i inputfile.m2ts -deinterlace -target ntsc-dvd outputfile.avi

3. XVID (Computer Format @ Max Resoution / same as source)
  
ffmpeg -i inputfile.m2ts -threads 0 -deinterlace -f avi -r 25 -vcodec libxvid -vtag XVID  -aspect 16:9 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2 outputfile.avi 


4. XVID (Computer Format @ Reasonable Web Resolution) 

ffmpeg -i inputfile.m2ts -threads 0 -deinterlace -f avi -r 25 -vcodec libxvid -vtag XVID -s 480x360 -aspect 16:9 -maxrate 1000k -b 700k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2 outputfile.avi



* Note: the setting -threads 0 will use all cores available.

If you want to convert the recorded files at full HD resolution,
use the following command:

ffmpeg -i inputfile.m2ts -deinterlace -sameq outputfile.avi


For full FFmpeg manual visit: ffmpeg.org
For installation instruction on the Latest version for Ubuntu visit this forum article.

1 comment:

  1. thank you very match, man!
    you make positive job... yes

    ReplyDelete

Please be courteous, even if you do not share the same view.