Computing HowTo Linux Ubuntu

How to convert .MTS files to .AVI in Ubuntu using ffmpeg

Just a quick post. If you want to bulk convert .MTS files (from JVC or Sony HD camcorders) then you can use the below script:

You’ll need csh and ffmpeg installed:

sudo apt-get install csh ffmpeg

Make a new file called convert (I use joe but you can use nano or whatever you prefer)

joe convert

Copy and paste the below:

# For NTSC change -fps 50 tp -fps 60000/1001 below
foreach f ($*)
ffmpeg -i $f -threads 4 -deinterlace -f avi  -r 25 -vcodec libxvid -vtag XVID  -s 1920×1080  -aspect 16:9 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2 -o ${f:r}.avi
Make the file executable:
chmod +x convert
Convert your .MTS files:
./convert *.MTS