简体   繁体   中英

FFmpeg tile cropping

This image is splitted to 12 equal pieces. Is there any way to do such a work with ffmpeg?

该图片已上传至Instagram

Use

ffmpeg -loop 1 -i image.png -vf "crop=iw/3:ih/4:mod(n,3)*iw/3:trunc(n/3)*ih/4" -vframes 12 out%d.png

For full coverage of image, the image width has to be divisible by 3, and height by 4.


For square output, set crop height to crop width. The vertical crop leaves some space at top and bottom.

ffmpeg -loop 1 -i image.png -vf "crop=iw/3:iw/3:mod(n,3)*iw/3:trunc(n/3)*iw/3+(ih-iw)/2" -vframes 12 out%d.png

(This method requires that ih/4 > iw/3 for desired output)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM