Let’s go through the script, _what is does ? How it does ?
_
This script accepts 3 parameters, the expected dims (HxW) and the path to the file in the local system. You can get the path to the file by simply dragging the file into the terminal and copy the path that appears.
The generate_ffmpeg_command() function generates the command for processing the image and specifies the output location of the file to the dame directory but changes the filename as out-<filename> .
The function returns the command requires and the os module in python executes the shell command in your terminal and gets you the requires image.
The scale parameter of the ffmpeg command scales your input image to the required dimensions.