How to resize images in a directory with ffmpeg ?

Card Puncher Data Processing

About

This article shows you how to scale image in a dirctory with ffmpeg and conserve the aspect ratio.

Because ffmpeg is a video management tool, it can also modify a frame, in other word, an image.

Steps

Create a directory to get all new images

In this tutorial, we create image of 1920 width. Therefore we create a new directory called 1920.

REM cd /directory/where/you/have/your/images
mkdir 1920

Call ffmpeg for each image

Test with one image if your transformation parameters give the expected result.

For example, in this case, we scale the image down to 1920 pixles

ffmpeg -i input.jpg -vf scale=1920:-1 1920/input.png

Loop over the images and call ffmpeg for each image

In your favorite shell, use the loop structure and call the ffmpeg command

Example:

for %v in (*.jpg) do ffmpeg -i %v -vf scale=1920:-1 1920/%v







Share this page:
Follow us:
Task Runner