ffmpeg - Apply padding to input images while combining multiple images and audio track I am using below command to create a slideshow using ffmpeg:

ffmpeg -r 1 -i IMG_%04d.jpeg -i audio.mp3 -c:v libx264 -c:a aac -pix_fmt yuv420p -r 24 -y output.mp4 -vf pad=ceil(iw/2)*2:ceil(ih/2)*2


I had to add pad=ceil(iw/2)*2:ceil(ih/2)*2 to make width or height even number because if one of the input image width/height is odd, ffmpeg throws error. Now my problem is; input images can be of different resolution and aspect ratio. I want to add padding (left/right or top/bottom) to all images to make them of equal size before they are converted into video frames. How can I achieve this in efficient way?

Edit:
It would be nice if I can specify output resolution and all images are either scaled down or up keeping their aspect ratio intact according to that resolution.
If your output resolution is AxB, then your filters would be

-vf "scale=A:B:force_original_aspect_ratio=decrease,pad=A:B:-1:-1"