Evan Rust
Published © GPL3+

High Resolution YouTube Player with Raspberry Pi

Sometimes a 1920x1080p screen just doesn't have enough pixels for you, so I created a way to watch YouTube videos with stunning clarity.

IntermediateFull instructions provided2 hours9,413

Things used in this project

Hardware components

DFRobot 64x64 RGB LED Matrix
×1
Raspberry Pi 3 Model B+
Raspberry Pi 3 Model B+
×1
Adafruit Matrix Driver HAT
×1

Software apps and online services

Python IDE

Story

Read more

Schematics

Wiring

Code

Python Code

Python
import pafy
import time
import sys
import numpy as np
from rgbmatrix import RGBMatrix, RGBMatrixOptions, graphics
from PIL import Image, ImageDraw
url = sys.argv[1]
video = pafy.new(url)
best = video.getbest(preftype="mp4")
options = RGBMatrixOptions()
options.rows = 64
options.cols = 64
options.chain_length = 1
options.parallel = 1
options.hardware_mapping = 'adafruit-hat'
matrix = RGBMatrix(options=options)
matrix.Clear()
import cv2
capture = cv2.VideoCapture()
capture.open(best.url)
success,image = capture.read()

FRAMERATE = 120

while success:
	image_resized = cv2.resize(image, (64,64), interpolation = cv2.INTER_AREA)
	image_resized = cv2.cvtColor(image_resized, cv2.COLOR_BRG2RGB)
	display_img = Image.fromarray(image_resized)
	matrix.SetImage(display_img.convert('RGB'))
	#cv2.imshow('frame',image_resized)
	#time.sleep(1/FRAMERATE)
	success, image = capture.read()

cap.release()
cv2.destroyAllWindows()

Credits

Evan Rust

Evan Rust

120 projects • 1049 followers
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.

Comments