Tuesday, May 10, 2022

Playing Video and Audio in HTML

<Video controls> <source src="1961 Asterix the Gaul.mp4"> </Video>

<Audio controls> <source src="Kalimba.mp3"> </Audio>


Saturday, May 7, 2022

Screen Recorder in Python (NeuralNine)

# https://www.youtube.com/watch?v=08a3PikBSl8

import cv2, pyautogui, time

import numpy as np


SCREEN_SIZE = (1366, 768)

fourcc = cv2.VideoWriter_fourcc(*"XVID")

out = cv2.VideoWriter("output.avi", fourcc, 20.0, (SCREEN_SIZE))

fps, prev = 120, 0


while True:

  time_elapsed = time.time() - prev

  img = pyautogui.screenshot()

  if time_elapsed > 1.0 / fps:

    prev = time.time()

    frame = np.array(img)

    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

    out.write(frame)


  cv2.waitKey(5) # Changed 100 to 5 for proper capture


cv2.destroyAllWindows()

out.release()


Windows Notification in Python (NeuralNine)

# https://www.youtube.com/watch?v=5EHEG4gMCNs


from win10toast import ToastNotifier


toaster = ToastNotifier()

toaster.show_toast("Notification", "This is a message", duration=5)