ffmpeg commands
Resize and crop
The scripts in this folder fit existing footage into a fixed output frame: most scale the source until it covers the target size and then crop the overflow, while the vertical Canvas script rotates landscape footage on its side and scales it to a 9:16 portrait frame. They're used when a player, projector, monitor or platform expects an exact resolution and you'd rather lose the edges of the picture than add black bars. Each re-encodes to widely compatible H.264, and the target size, frame rate and crop position are plain numbers in the command, so adapting one to another resolution is usually a matter of editing those values; the header explains each flag.
Fill a 4:3 640×480 frame at 30 fps (scale up, then center-crop)
fill-crop-640x480.sh
The ffmpeg equivalent of CSS "object-fit: cover": scale the source until it covers 640×480 on both axes, keeping its aspect ratio, then crop the overflow from the center. No letterboxing, no distortion; the edges of wider sources are cut off instead.
Fill a 720×480 (NTSC-sized) frame, silent, small file
fill-crop-720x480.sh
Same scale-then-crop "cover" technique as fill-crop-640x480.sh, at the 720×480 NTSC raster. The pixels stay square: for true NTSC DV/DVD output you'd also set the 10:11 sample aspect ratio (setsar=10/11) or use -target ntsc-dvd.
Crop a near-4:3 1434×1080 window from 1080p footage, at 29.97 fps
scale-offset-crop-1434x1080.sh
Scales the source to cover 1728×1080 (16:10), then cuts a 1434×1080 window (about 4:3) at an explicit x offset. 147 = (1728 − 1434) / 2, so this window is centered; change the x value to slide it left or right. Useful for framing widescreen footage for 4:3 projection or monitors.
Vertical 8-second loop from landscape footage (Spotify Canvas–style)
vertical-canvas-414x736.sh
Takes 7.9 s starting one minute in, turns landscape footage on its side, and scales it into a 9:16 414×736 frame with no audio. Canvas-style loops need to be short, vertical and silent.
Source: lucidbeaming/ffmpeg-utilities/resize-crop at v1.0.1