I'm looking for a way to resize videos by adding a white background instead of changing its proportions.
(A video with proportions 250x300px would transform to 300x300px by adding white band on each side of the video)
I've tried implementing the code I found on this thread to no result using ffmpeg, I'm very noob with image/video processing: Thread
def Reformat_Image(ImageFilePath):
from PIL import Image
image = Image.open(ImageFilePath, 'r')
image_size = image.size
width = image_size[0]
height = image_size[1]
if(width != height):
bigside = width if width > height else height
background = Image.new('RGBA', (bigside, bigside), (255, 255, 255, 255))
offset = (int(round(((bigside - width) / 2), 0)), int(round(((bigside - height) / 2),0)))
background.paste(image, offset)
background.save('out.png')
print("Image has been resized !")
else:
print("Image is already a square, it has not been resized !")
Essentially I would love to be able to do what is done in that thread, but with videos.
Any help is extremely appreciated