fstream/ffmpstream-client.py

19 lines
441 B
Python
Raw Normal View History

2021-04-13 18:33:16 +00:00
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)