Sunday, August 30, 2009

Re-encoding AVCHD video using FFMpeg

There's been some changes to how ffmpeg operates starting from revision 19459 and simply pointing out the input and output files with libx264 will not do the trick anymore. This is due to the fact that ffmpeg now recognizes the subtitles track and doesn't know how to deal with it in the resulting MKV file. To overcome this issue add the -sn to the parameters and you're done.

Also some of the x264 options don't have working default values so one must specify the preset for video encoding. Here's an example:

ffmpeg.bat -i 00001.MTS -acodec aac -ac 2 -ab 128k -sn -vcodec libx264 -deinterlace -s 1280x720 -vpre ./libx264-hq.ffpreset -crf 23 -threads 2 00001.mkv

To make it work make sure you've copied the libx264-hq.ffpreset file from ffmpeg archive into the folder with your MTS file to be re-encoded.

Also you can adjust the -crf 23 parameter to steer the final size and quality of the resulting MKV file.

Enjoy!

1 comment:

cheney said...

Wow, really fantastic software~
I've used many converters. Most of them are just so so.
But there is an application impressed me very much:
http://www.auncam.com/aunsoft-imedia-converter-for-mac
Aunsoft iMedia Converter for Mac!
You may go and have a try!