Crops the video to a 720×720 square, then composites a PNG (with transparency) dead center. Run it once per logo color to make light and dark versions, as the original did with white and black logos.
Also in notes/commands2.txt: the minimal form with no resize, just -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -c:a copy.
The command
ffmpeg -i input.mp4 -i overlay.png \
-filter_complex "[0:v]scale=720:720:force_original_aspect_ratio=increase,crop=720:720[bg];[bg][1:v]overlay=(W-w)/2:(H-h)/2" \
-c:a copy \
-c:v libx264 -preset slow -crf 17 -pix_fmt yuv420p \
-movflags +faststart \
output.mp4 What each part does
[0:v]scale=…:force_original_aspect_ratio=increase,crop=720:720[bg]
fill the square from the first input (the video)
[bg][1:v]overlay=(W-w)/2:(H-h)/2
put the second input (the PNG) on top, centered;
W/H = video size, w/h = PNG size
-c:a copy keep the audio untouched
-c:v libx264 -preset slow -crf 17 -pix_fmt yuv420p
high-quality H.264
-movflags +faststart web playback starts sooner When to use it
Use this when you need a square clip with a logo or watermark sitting exactly in the middle. It fills a 720×720 frame from the video, cropping whatever doesn't fit, and lays the PNG over it at the PNG's own size. The header explains each flag.
Don't use it if you need to keep the whole frame, because wider or taller footage loses its edges to the crop. For 4:3 output, use center-png-overlay-4x3.sh. To take a logo out rather than add one, see remove-logo-delogo.sh.
Variations:
- Different size: change all four 720s together.
- Light and dark versions: run it twice, once with a white PNG and once with a black one, using a different output name each time.
- Video already the right size: the header's minimal form skips the scale and crop.
If the output looks wrong, check the PNG first. The logo isn't scaled, so one larger than 720×720 runs off the edges. A PNG without transparency shows up as a solid box.
Notes
- Source
- ffmpeg-utilities/overlay.sh (identical to png-overlay.sh)
- Changed
- explicit [0:v]/[1:v] stream labels; W/H shorthand for main_w/ main_h; -acodec/-vcodec → -c:a/-c:v