#/bin/sh
FFM=$HOME/src/ffmpeg/ffmpeg
BR=3000 # kbit
OUT="${1}.mkv"
[ -f "$OUT" ] && exit 1;
echo $1
# old ffmpeg versions (2008):
nice $FFM -r 50 -i "$1" -s 1280x540 -ilme mpeg4 -acodec copy -aspect 16:9 -b ${BR}k "$OUT"
# new ffmpeg versions (January 2009): -r 50 might still be necessary.
nice $FFM -i "$1" -s 1280x540 -flags ilme -flags ildct -vcodec mpeg4 -acodec copy -aspect 16:9 -b ${BR}k "$OUT"
The only problem is that the current ffmpeg checkout does not listen to the -r parameter. So you have to manually override the frames per second when playing the file, e.g. mplayer -fps 50. I use
mplayer -fps 50 -fs -af volnorm -vf pp=fd.
You need might need to adjust the path to ffmpeg in the script obviously, e.g. to $HOME/ffmpeg/ffmpeg.
Of course if you have a camera that records 29.97 frames per second you have to change the numbers accordingly. (-r 59.94)
If you've got several cores you may want to experiment with the -threads option and make sure you have compiled with --enable-pthreads, see below.
The great thing is that the video is encoded quickly - I get 23 fps on my celeron m530 notebook - and the video is perfectly in sync, and you only need ffmpeg, nothing else.
You should install a fresh ffmpeg from SVN:
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-nonfree --enable-gpl --enable-pthreads && make && sudo make install.
Be careful where you put every ffmpeg parameter, as ffmpeg interprets them differently depending on the order you give them. E.g. ffmpeg -r 50 -i ... differs from ffmpeg -i ... -r 50.
Enjoy fast and sync video transformation!
If it doesn't work for you, try out this script, which is the result of the long discussions below.
0 comments:
Post a Comment