You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
887 B
31 lines
887 B
import time
|
|
from datetime import datetime
|
|
from threading import Thread
|
|
|
|
from PIL import Image
|
|
from PIL import ImageDraw, ImageFont
|
|
|
|
from VideoFile import VideoFile
|
|
|
|
|
|
class StreamMerger(Thread):
|
|
img = None
|
|
|
|
def run(self) -> None:
|
|
video = VideoFile("yiv3.webm")
|
|
video2 = VideoFile("supernatural.webm")
|
|
video.open()
|
|
video2.open()
|
|
start_time = time.time()
|
|
while True:
|
|
img = Image.new('RGB', (1920, 1080), color='black')
|
|
|
|
if video.frame is not None:
|
|
img.paste(video.frame)
|
|
if video2.frame is not None:
|
|
img.paste(video2.frame, (0, 600))
|
|
fnt = ImageFont.truetype("antonio.ttf", 40)
|
|
d = ImageDraw.Draw(img)
|
|
d.text((0, 1000), str(int(time.time() - start_time)), font=fnt)
|
|
self.img = img
|
|
time.sleep(1.0 / 1000.0)
|
|
|