import ffmpeg import numpy as np from dora import Node import pyarrow as pa import cv2 node = Node() in_filename = "tcp://192.168.2.1:40921" # Global variables, change it to adapt your needs CAMERA_WIDTH = 960 CAMERA_HEIGHT = 540 process1 = ( ffmpeg.input(in_filename) .output("pipe:", format="rawvideo", pix_fmt="rgb24") .run_async(pipe_stdout=True) ) audio = ffmpeg.input(in_filename).audio while True: in_bytes = process1.stdout.read(1280 * 720 * 3) if not in_bytes: break in_frame = np.frombuffer(in_bytes, np.uint8).reshape([720, 1280, 3]) ## RGB to BGR in_frame = in_frame[..., ::-1] in_frame = cv2.resize(in_frame, (CAMERA_WIDTH, CAMERA_HEIGHT)) # out_frame = in_frame * 0.5 # do some processing node.send_output("image", pa.array(in_frame.ravel())) node.send_output("audio", pa.array(in_frame.ravel())) process1.wait()