Useful ffmpeg Recipes

Posted January 31st, 2022 in tools

A few ffmpeg commands I find useful, so I don't need to keep reading the documentation.


  1. Convert to mp4
  2. Concatenate
  3. Speed Up
  4. Seek and Crop
  5. Resize

Convert to mp4

Converts the input to mp4 using libx264, using a quality of 35 (0-51, where o is lossless) and 256k audio compression (high quality). This video should be compatible with most devices.

ffmpeg -i "input.ext" -c:v libx264 -crf 35 -b:a 256k "output.mp4"


Concatenates the videos specified in file.txt

ffmpeg -f concat -safe 0 -i "file.txt" -c copy "output.ext"

The contents of file.txt (must be single quotes)

file 'path/to/file1.ext'
file 'path/to/file2.ext'
file 'path/to/file3.ext'

Speed Up

Speeds up the input video 256 times, and strips the audio with -an

ffmpeg -i "input.ext" -an -filter:v "setpts=PTS/256" "output.ext"

Seek and Crop

Do the following:

  • -ss 10 seek to 10 seconds
  • -t take 4 seconds of video
  • crop=w=1280:h=500:x=0:y=110 take a 1280×500 box at coordinate 0,110
ffmpeg -ss 10 -t 4 -i "input.ext" -filter:v "crop=w=1280:h=500:x=0:y=110" "output.ext"


Resize the video to 640 pixels wide, making ffmpeg calculate the height based on the aspect ratio of the input video.

ffmpeg -i "input.ext" -vf scale=640:-1 "output.ext"

Tagged video mp4 seek resize input convert concatenate speed crop audio


Please click here to load comments.