Filarius

ffmpeg python

Apr 20th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import  numpy as np
  2. from subprocess import Popen,PIPE
  3. import sys
  4. p = Popen('ffmpeg -y -f rawvideo -pix_fmt gray -s:v 1280x720 -r 25 -i - 1.mp4'.split(" "),
  5.           stdin=PIPE,
  6.           stderr=sys.stdout,
  7.           stdout=sys.stdout
  8.           )
  9. a = np.zeros((1280,720),np.uint8)
  10. for cnt in range(10000):
  11.     for x in range(1280):
  12.         for y in range(720):
  13.             if ((cnt + x%8)  %2)!=((y%8)%2):
  14.                     a[x,y] = 255
  15.     #a.tofile(sys.stdout)
  16.     #print(p.communicate(a.tobytes()))
  17.     p.stdin.write(a.tobytes())
  18. p.stdin.close()
Advertisement
Add Comment
Please, Sign In to add comment