Tuesday, March 17, 2009

HD video, yay!

Finally figured out how to transcode MTS format to something that YouTube will take. One of the big problems I had before was the audio-out-of-sync issue, and it has been solved after getting the latest development version of ffmpeg (from reading this post http://ubuntuforums.org/showthread.php?t=529871&page=2). I compiled with the --enable-pthread option and installed it in /usr/local, and created a quick bash script called 'my-encode' as follows:


#!/bin/bash
INPUT=$1
SIZE=hd720
OUTPUT=`echo $INPUT | perl -pe 's/\.MTS/\.avi/'`
/usr/local/bin/ffmpeg -i $INPUT \
-s $SIZE \
-acodec libmp3lame \
-ab 256k \
-ac 2 \
-vcodec libxvid \
-sameq \
-aspect 16:9 \
-b 3000k \
$OUTPUT


Then, it's as easy as running a one-liner to start transcoding all MTS files:

$ for i in *.MTS ; do echo "--Working on $i--" && my-encode $i ; done


Here is one of the many HD720 videos that I an uploading to YouTube:

No comments: