Thursday, October 10, 2019

A video alternative to animated GIFs

I wanted to do something like my previous post, but using a video format instead of the ancient .gif format. Here's what I ended up using:

ffmpeg -ss 00:04.20 -i in.mp4 -t 00:06.30 -an -vf "crop=1668:1668:1292:10, scale=480:-1" out.mp4

Options:
  • -ss 00:04.20
    Start 4.2 seconds into the input file
  • -i in.mp4
    Specifies the input file
  • -t 00:06.30
    Limit duration to 6.3 seconds
  • -an
    No audio
  • -vf " ... "
    Specify the filter chain to operate on the video
    • crop=1668:1668:1292:10
      Crop out a 1668 (width) x 1668 (height) window, with the top-left corner located at x=1292, y=10
    • scale=480,-1
      Rescale to width=480, height=auto (preserving aspect ratio)
  • out.mp4
    Specifies the output file