Last active
February 17, 2021 00:24
-
-
Save Evan-Nishi/66123ef54bcfde3078aac6ee1120e840 to your computer and use it in GitHub Desktop.
a basic video player the 64x32 led rgb matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import sys | |
from rgbmatrix import RGBMatrix, RGBMatrixOptions | |
from PIL import Image | |
options = RGBMatrixOptions() | |
options.rows = 32 | |
options.cols = 64 | |
options.brightness = 40 | |
options.parallel = 1 | |
options.hardware_mapping = 'adafruit-hat-pwm' | |
matrix = RGBMatrix(options = options) | |
try: | |
cur_image = 100 | |
while True: | |
image = Image.open("./tmp{}.png".format(cur_image)) | |
image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS) | |
matrix.SetImage(image) | |
time.sleep(0.012) | |
cur_image += 1 | |
except FileNotFoundError: | |
print('finished!') | |
sys.exit(0) | |
except KeyboardInterrupt: | |
print('keyboard interrupted') | |
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i $1 -s 64x32 tmp%03d.png | |
sudo python3 main.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment