ffmpeg: How to speed up video AND audio.

You need ffmpeg version 2.x – download from here if you don’t have it: http://johnvansickle.com/ffmpeg/ or compile the latest version from source: http://trac.ffmpeg.org/wiki/CompilationGuide

Here’s a script I use to resize my GoPro videos and speed them up by 4 times:

The max value for ‘atempo’ is 2, so you have to string two of them together in order to get 4 times speed increase.

BITRATE=7000k
SIZE=960x540
SOURCE=back/
DEST=small/
FFMPEG=~/bin/ffmpeg-2.0.1-64bit-static/ffmpeg
for i in $SOURCE*.MP4; do
 echo "Processing $i";
 $FFMPEG -i $i -vcodec mpeg4 -vtag XVID -b:v $BITRATE -bf 2 -s $SIZE -pass 1 -passlogfile $i -an -threads 0 -f rawvideo -y /dev/null;
 #$FFMPEG -i $i -vcodec mpeg4 -vtag XVID -b:v $BITRATE -bf 2 -s $SIZE -vf setpts=0.15*PTS -pass 2 -passlogfile $i -an -threads 0 -f avi -y $DEST$i.avi;
 $FFMPEG -i $i -vcodec mpeg4 -vtag XVID -b:v $BITRATE -bf 2 -s $SIZE  -filter_complex "[0:v]setpts=0.125*PTS[v];[0:a]atempo=2.0,atempo=2.0,atempo=2.0[a]" -map "[v]" -map "[a]" -pass 2 -passlogfile $i -an -threads 0 -f avi -y $DEST$i.avi;
done;

Leave a Reply

Your email address will not be published. Required fields are marked *