ffmpeg - Apply padding to input images while combining multiple images and audio track
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"