Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ffmpeg
- WIDTH = 1280
- HEIGHT = 720
- stream_decoder = (
- ffmpeg
- .input('pipe:', format='rawvideo', pix_fmt='rgb24', s='{}x{}'.format(WIDTH, HEIGHT))
- .output('pipe:', format='rawvideo', pix_fmt='rgb24', s='{}x{}'.format(WIDTH, HEIGHT))
- .run_async(pipe_stdout=True)
- )
- while True:
- # READ 1280*720*3 elements from socket
- stream_decoder.stdin.write(read_data)
- frame = stream_decoder.stdout.read(width * height * 3)
- if not frame:
- break
- in_frame = (
- np
- .frombuffer(frame, np.uint8)
- .reshape([height, width, 3])
- )
- # accelerate
- # send array
- process1.stdin.close()
- process1.wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement