The 4:3 version of center-png-overlay-square.sh: fill a 640×480 frame, composite a PNG mask or graphic in the middle, drop the audio, and squeeze the file small with the slowest preset.
The command
ffmpeg -i input.mp4 -i overlay.png \
-filter_complex "[0:v]scale=640:480:force_original_aspect_ratio=increase,crop=640:480[bg];[bg][1:v]overlay=(W-w)/2:(H-h)/2" \
-an \
-c:v libx264 -preset veryslow -crf 24 -pix_fmt yuv420p \
output.mov What each part does
[0:v]scale=…:force_original_aspect_ratio=increase,crop=640:480[bg]
fill 640×480 from the video
[bg][1:v]overlay=(W-w)/2:(H-h)/2
composite the PNG, centered
-an drop the audio
-c:v libx264 -preset veryslow -crf 24 -pix_fmt yuv420p
smallest file at quality 24 When to use it
Use this when you need a 4:3, 640×480 silent clip with a graphic or mask stamped in the middle, for example a circular vignette PNG over footage of any shape. For square output, use center-png-overlay-square.sh. For the same fill-and-crop without an overlay, see ../resize-crop/fill-crop-640x480.sh. The header explains each flag.
Skip it if you need the soundtrack, since the audio is dropped. Also skip it if the whole source frame must stay visible: widescreen input loses its left and right edges to fill 4:3.
To change the frame size, edit 640:480 in both the scale and crop parts. Raise the -crf value for a smaller file, or lower it for better quality.
If the output looks wrong:
- The graphic is clipped or off-center. The PNG isn't resized, so make it 640×480 or smaller.
- A solid block covers the picture. The PNG has no transparency.
- Subjects are cut off at the sides. That's the crop. Reframe the source first.
Notes
- Source
- ffmpeg-utilities/overlay4-3.sh (originally with large-circle-50.png)
- Changed
- explicit stream labels; -vcodec → -c:v