第一种:
from moviepy.editor import *
def add_logo():
LOGO_PATH = "image.png"
video_path = r'video.mp4'
video = VideoFileClip(video_path).subclip(t_start=3, t_end=(100))
logo = (ImageClip(LOGO_PATH).set_duration(30)
.resize(height=80)
.margin(right=8, top=8,opacity=1)
.set_pos(("right", "top")))
final = CompositeVideoClip([video, logo])
final.write_videofile("./logo.mp4", codec="libx264", bitrate="10000000")
add_logo()
第二种:
import cv2
import numpy as np
#importing the main image
image = cv2.imread('0.png')
oH,oW = image.shape[:2]
image = np.dstack([image, np.ones((oH,oW), dtype="uint8") * 255])
#importing the logo image
<