User Tools

Site Tools


ffmpeg

tl;dr

ffmpeg -i input.mp4 -vf scale=320:240,setsar=1:1 output.mp4

variables

ffmpeg -i input.jpg -vf scale=iw*2:ih input_double_width.png

(works on images btw)

fit a rectangle, with padding

ffmpeg -i input.jpg -vf "scale=320:240:force_original_aspect_ratio=decrease,pad=320:240:(ow-iw)/2:(oh-ih)/2" output_320_padding.png

text over video, found in ancient text file (might not work)

ffmpeg -i ordeal.mkv -ss 55 -t 5 -vf drawtext="textfile=slap.txt: fontcolor=white: fontsize=96: x=(w-text_w)/2: y=(h-text_h)/2" out1.mp4; ffmpeg -i out1.mp4 -vf scale=320:180 out2.gif

strip audio

ffmpeg -i footage_with_adamvoice.MOV -an footage.mp4

rotate

ffmepg -i footage.mp4 -vf "transpose=2,transpose=2" rotated180.mp4

  0 = 90° counterclockwise and vertical flip (default)
  1 = 90° clockwise
  2 = 90° counterclockwise
  3 = 90° clockwise and vertical flip
 

crop

To crop a 80×60 section, starting from position (200, 100):

ffmpeg -i in.mp4 -vf "crop=80:60:200:100" -c:a copy out.mp4

you can use in_h and in_w, and even things like in_h/2-100

ffmpeg.txt · Last modified: 2024/03/18 17:56 by adam