I noticed quite a few people have trouble converting frames to video. This can actually be done quite easily with OpenCV.
You just need to:
Step 1. Install OpenCV-Python. The instructions can be found at https://pypi.org/project/opencv-python/
Step 2: Create an image folder to store all the swapped images.
Step 3: Create a Python script and copy and paste the following code:
########
Code: Select all
import cv2
import numpy as np
import glob
img_array = []
# note glob does not take absolute or relative path
for filename in glob.glob('images/*.png'):
img = cv2.imread(filename)
height, width, layers = img.shape
# cv2.imshow('img', img)
print("processing..." + filename)
size = (width, height)
img_array.append(img)
print("Outputting file...")
out = cv2.VideoWriter('ouput.avi', cv2.VideoWriter_fourcc(*'DIVX'),30, size)
for i in range(len(img_array)):
print("writing img " + str(i) + "/" + str(len(img_array)))
out.write(img_array[i])
out.release()
#########
Notes: Make sure your python script is at the same subdirectory level as the image folder.
Step 4:Run the script and be patient.
Hope it helps. My gratitude towards the developers of Faceswap .