Add Black background to a vertical video
You can use ffmpeg*, a command-line tool, to do this.

Let's say your source video is 360x640, then to make it 4:3, use

ffmpeg -i input.mp4 -vf pad=854:640:247:0 -c:v libx264 -crf 20 -c:a copy output.mp4


where 854 is used because it's 4/3 of 640, and 247 places the video in the center of the padded canvas. See details for the pad filter here.

Similarly for 16:9, use

ffmpeg -i input.mp4 -vf pad=1138:640:389:0 -c:v libx264 -crf 20 -c:a copy output.mp4


where 1138 is used because it's 16/9 of 640, and 389 for centering.

The width value you specify should be an even integer, so you may have to round up/down your calculated width.

*get the latest nightly or snapshot binary for your platform.