I want to use OPENCV to combine a set of PNG images with a transparent background and a WAV file into a webm format video with a transparent background, but the synthesized video background is not transparent, here is my code:
import cv2,os
import numpy as np
image_folder = 'd:/desktop/webm/'
images = [img for img in os.listdir(image_folder) if img.endswith(".png")]
frame = cv2.imread(os.path.join(image_folder, images[0]))
height,width, layers = frame.shape
fourcc = cv2.VideoWriter_fourcc(*'vp90')
video = cv2.VideoWriter('d:/desktop/output_video.webm', fourcc, 25, (width,height))
for image in images:
frame = cv2.imread(os.path.join(image_folder, image),cv2.IMREAD_UNCHANGED)
video.write(frame)
video.release()
Run this code and it generates a webm format image, but it is corrupt and cannot be played The prompt during running is:
OpenCV: FFMPEG: tag 0x30397076/'vp90' is not supported with codec id 167 and format 'webm / WebM'
What is the right code?