import subprocess import socket bufferSize = 1000 serverAddr = ("127.0.0.1",12000) connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connection.settimeout(15) connection.connect(serverAddr) proc = subprocess.Popen([ "ffplay","-f","mpegts", "-i","-", "-fflags","nobuffer", "-flags","low_delay", "-infbuf","-fast","-framedrop" ],stdin=subprocess.PIPE) while True: data = connection.recv(bufferSize) proc.stdin.write(data)