Some quick samples of ffmpeg commands I frequently use.

Quick Overview

If you’re not familiar with ffmpeg, here’s the basic command structure:

ffmpeg -i path/to/original/file.mp4 ... filters and settings ... path/to/output/file.mp4

Common Settings

Resize a Video

Use the scale video filter (-vf). The arguments to the scale filter are width:height. You can use -1 in place of either value to set only one value and maintain the current aspect ratio.

For example, to scale the video to a frame height of 720 pixels:

ffmpeg -i path/to/original/file.mp4 -vf "scale=-1:720" path/to/output/file.mp4

Speed Up or Slow Down a Video

Use the setpts (set presentation timestamp) video filter (-vf). The argument to the setpts filter is a formula for how to set the timestamp. Some example values:

For example, to double the speed of a video:

ffmpeg -i path/to/original/file.mp4 -vf "setpts=0.5*PTS" path/to/output/file.mp4

Combining Video Filters

Filters are combined using a comma to separate them. For example, to scale a video and change its speed, you could use this command:

ffmpeg -i path/to/original/file.mp4 -vf "scale=-1:720,setpts=0.5*PTS" path/to/output/file.mp4

Removing Audio

Simply add the -an flag, which means “no audio”.

ffmpeg -i path/to/original/file.mp4 -an path/to/output/file.mp4

Changing the Video Codec

Sometimes you receive a video with a non-standard codec, or you want to convert from one format to another. The most common format today is mp4, and the most common codec is h.264. You can use a command like this to ensure that it’s h.264 and change the video format from .mov (for example, if you exported from Apple Photo Booth) to .mp4:

ffmpeg -i path/to/original/ -c:v libx264 path/to/output/file.mp4

Changing the Quality

I often receive files that have astronomically-high bitrates, especially if they used an Apple product (i.e. iOS screen recording, or Apple Photo Booth) to record the video. You can generally significantly drop the bitrate and not suffer any perceivable reduction in quality. Here’s an example of how to do that:

ffmpeg -i path/to/original/file.mp4 -b:v 2M -maxrate 2M -bufsize 1M path/to/output/file.mp4

ffmpeg Recipes

My most common use of ffmpeg combines many of the settings above into one of these commands.

Scale to 720p, Format, and Reduce Bitrate

ffmpeg -i path/to/original/file.mp4 -c:v libx264 -b:v 2M -maxrate 2M -bufsize 1M -vf "scale=-1:720" path/to/output/file.mp4

Same, but Also Remove Audio and Speed Up (Good for ASL Videos)

ffmpeg -i ~/Downloads/ -c:v libx264 -b:v 2M -maxrate 2M -bufsize 1M -vf "setpts=0.66*PTS,scale=-1:720" -an ~/Downloads/output.mp4