Viewing h264 stream over TCP
<p>I have a small wifi based FPV camera for a drone. I've managed to get it to the point where I can download and save an h264 file using python.</p>

<pre><code>TCP_IP = '193.168.0.1'
TCP_PORT = 6200
BUFFER_SIZE = 2056

f = open('stream.h264', 'wb')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((TCP_IP,TCP_PORT))
while True:
    data = sock.recv(BUFFER_SIZE)
    f.write(data)
    print("Writing")
sock.close()
f.close()
</code></pre>

<p>What I've been trying to do for a while now is play the stream. I've found the stream, I can download it and save it, but now I want to open it live.
I've tried using VLC's 'open network stream' with a variety of options, but none of them seemed to work.</p>

<p>I successfully output to mplayer using  </p>

<p><code>data = sock.recv(BUFFER_SIZE)
 sys.stdout.buffer.write(data)</code></p>

<p>and then having mplayer pipe the input</p>

<p><code>python cam.py - | mplayer -fps 20 -nosound -vc ffh264 -noidx -mc 0 -</code></p>

python stream video-streaming h.264