lewis-crawler/companion_software/superpipe.py

32 lines
793 B
Python

import time
import subprocess
from PIL import Image, ImageDraw, ImageFont
fnt = ImageFont.truetype('/usr/share/fonts/noto/NotoSans-Regular.ttf', 40)
my_ffmpeg_process = subprocess.Popen("ffmpeg -y -i pipe: -r 30 -pix_fmt yuv420p video.webm".split(), stdin=subprocess.PIPE)
for i in range(100):
img = Image.new('RGB', (1280, 720), color=(73, 109, 137))
d = ImageDraw.Draw(img)
d.text((10, 10), str(i), font=fnt, fill=(255, 255, 0))
img.save(my_ffmpeg_process.stdin, format='png')
print(i)
for i in range(100):
img = Image.new('RGB', (1280, 720), color=(73, 109, 137))
d = ImageDraw.Draw(img)
d.text((10, 10), str("Done with python!"), font=fnt, fill=(255, 255, 0))
img.save(my_ffmpeg_process.stdin, format='png')
print(i)
#time.sleep(1)