Daily Archives: April 21, 2009

FFmpeg Change Video Speed

One possible solution is to use FFmpeg in conjunction with yuvfps:

ffmpeg -i input.dv -f yuv4mpegpipe – | yuvfps -s 50:1 -r 50:1 | ffmpeg -f yuv4mpegpipe -i – -b 28800k -y output.avi


It can also be done using a pipe,

framerate2 =framerate1 / stretch_factor

Script (fish syntax):
set width (ffprobe -show_streams movie.mpeg | grep width= 2>/dev/null | cut -f2 -d=)
set height (ffprobe -show_streams movie.mpeg | grep height= 2>/dev/null | cut -f2 -d=)
set framerate1 (ffprobe -show_streams movie.mpeg | grep r_frame_rate= | cut -f2 -d=)
set framerate2 (echo "$framerate1 / $stretch_factor" | bc -l)

ffmpeg -i movie.mpeg -pix_fmt yuv420p -an -f rawvideo - |\

Or a raw or image intermediate format:

Assume starting from a 25fps avi (UNTESTED!)

ffmpeg -i 25.avi -pix_fmt yuv420p -f raw raw.dat
ffmpeg -s -r 50 -f yuv420p -i raw.dat -r 25 doublespeed.mpg

ffmpeg -f rawvideo -pix_fmt yuv420p -s {$width}x{$height} -r $framerate2 -i - -y movie-stretched.mpg