Skip to content

Instantly share code, notes, and snippets.

@figgis
Created April 23, 2012 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save figgis/2473389 to your computer and use it in GitHub Desktop.
Save figgis/2473389 to your computer and use it in GitHub Desktop.
YCbCr viewer
#!/usr/bin/env python
import pygame
W = 352
H = 288
WH = (W, H)
pygame.init()
screen = pygame.display.set_mode(WH)
overlay = pygame.Overlay(pygame.YV12_OVERLAY, WH)
fd = open('foreman.yuv', 'rb')
y = fd.read(W * H)
u = fd.read(W * H / 4)
v = fd.read(W * H / 4)
overlay = pygame.Overlay(pygame.YV12_OVERLAY, WH)
overlay.display((y, u, v))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment