[FFmpeg-user] Stretch/Scale only center of overlay image

Ted Park kumowoon1025 at gmail.com
Fri Feb 14 00:11:38 EET 2020


> Is it possible to stretch/scale only the center part of an overlay image?
> 
> I don't mean the middle section of a video, I mean only the center part of a single image (png) that will be overlayed onto a background, such that the left and right sides are relatively unchanged, but the center of the image is stretched to fit the new size.

You will need to have three sections (two if you mirror the left or right) and stretch only the center, and do the math for positioning each one. Conceivably you could do this with one overlay image and a combination of crop and split filters, but I feel that would be unnecessarily convoluted, the positioning calculations are a headache already, at least for me. I would create separate half-circle and parallel line overlay images. Of course this wouldn’t result in an oval, but I think the elongated “pill” shape is what you’re going for anyway. 


More information about the ffmpeg-user mailing list