Changing video playback speed

I was using iMovie ’08 to do some video editing and I wanted to turn a one hour long video into something shorter.

It turns out iMovie ’08 doesn’t support a slow/fast motion effect even though previous versions supported this. I struggled to find a good alternative that allowed me to speed up playback of my video.

I ended up using two command line tools. FFmpeg and MJPEG Tools.

I installed both using MacPorts:

sudo port install ffmpeg
sudo port install mjpegtools

The command to create a fast motion video was:

ffmpeg -i [input_file] -f yuv4mpegpipe - | yuvfps -s [frame_rate] -r [frame_rate]  | ffmpeg -f yuv4mpegpipe -i - -b 57600k -y [output_file]

where

  • input_file – the original source file
  • frame_rate – the resulting frame rate (X:Y)
  • output_file – the output file

The key here is the frame_rate value. Assuming your original video file is X and you want your video to play N times faster, you should sent your new frame rate to be (X*N):1 For example, if your video has a frame rate of 25 fps and you want to increase playback by 4 times, you should use 100:1 for your frame_rate value. You can use the same command to create a slow motion movie. If you wanted to slow the video down to about half speed, you would use 12fps or 13fps for a 25 fps movie. You can find the current fps of your video by running

ffmpeg -i [input_file]

What I did to turn a 50 min movie to a ~12 min video:

ffmpeg -i video.m4v -f yuv4mpegpipe - | yuvfps -s 100:1 -r 100:1  | ffmpeg -f yuv4mpegpipe -i - -b 57600k -y result.avi

It’s been awhile since I played around with video editing. I forgot how long video processing takes. I need a new computer.

Changing video playback speed