/usr/lib/python3/dist-packages/ginga/util/videosink.py is in python3-ginga 2.6.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Uses Voki Codder's solution
# http://vokicodder.blogspot.in/2011/02/numpy-arrays-to-video.html
import subprocess
class VideoSink(object):
def __init__(self, size, filename="output", rate=2, byteorder="Y8"):
self.size = size
self.cmdstring = ('mencoder', '/dev/stdin', '-demuxer', 'rawvideo',
'-rawvideo', 'w=%i:h=%i' % size[::-1] + ":fps=%i:format=%s" % (rate, byteorder),
'-o', filename, '-ovc', 'lavc')
def open(self):
self.p = subprocess.Popen(self.cmdstring, stdin=subprocess.PIPE, shell=False)
def write(self, image):
assert image.shape == self.size
self.p.stdin.write(image.tostring())
def close(self):
self.p.stdin.close()
|