I'm creating a video sample by combining cropped-faced images using Deepface python library.
I saved the cropped faces in a list called cropped_faces
. And it has saved all the frames successfully.
The list content of cropped_faces[]:
Finally, I am using cv2.write() method in a for loop to write the frames to the video. The code is as follows:
height,width,layers = cropped_faces[0].shape
print(height,width,layers)
fourcc = cv2.VideoWriter_fourcc(*'H264')
video = cv2.VideoWriter('/content/gdrive/MyDrive/Kaggle/Data/output.mp4', fourcc,1,(width,height))
for j in range(0,5):
video.write(cropped_faces[j])
video.release()
cv2.destroyAllWindows()
print("The video was successfully saved")
The output:
Although there are no errors in the code, the video saved in the location '/content/gdrive/MyDrive/Kaggle/Data/' is not playable. Only a size 258bytes video is created.
Can somebody please help me to find the reason and solve this issue, please?