Advertisement
Guest User

Untitled

a guest
May 19th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3. import random
  4.  
  5. def babushkin(output_file="future_movie.avi", width=320, height=240, frames=120):
  6. a = random.randint(10**5, 10**9)
  7. b = random.randint(1, 9999)
  8. remainder = a % b
  9.  
  10. fourcc = cv2.VideoWriter_fourcc(*'XVID')
  11. video = cv2.VideoWriter(output_file, fourcc, 24.0, (width, height))
  12.  
  13. random.seed(remainder)
  14.  
  15. for i in range(frames):
  16. frame = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
  17. cv2.putText(frame, f"Frame {i+1}", (10, height - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255), 1)
  18. video.write(frame)
  19.  
  20. video.release()
  21.  
  22. if __name__ == "__main__":
  23. babushkin()
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement