How can I stream video stream to Linux or OS X using raspivid and either VLC, GStreamer or Netcat?

  • Netcat (nc) seems to be the one with the smallest delay.
  • In my experience, VLC has the biggest delay. On the other hand, there is a VLC client for Android, which is convenient.

  • <IP-OF-THE-CLIENT> is the IP of the computer that should receive the video stream.

  • <IP-OF-THE-RPI> is the IP of the Raspberry Pi.

Using Netcat:

On the client

(Run the command on the client first, and then on the server (RPi)).


nc -l 2222 | mplayer -fps 200 -demuxer h264es -


nc -l 2222 | mplayer -fps 200 -demuxer h264es -

On the RPi

/opt/vc/bin/raspivid -t 0 -w 300 -h 300 -hf -fps 20 -o - | nc <IP-OF-THE-CLIENT> 2222

Using GStreamer:

On the client


gst-launch-1.0 -v tcpclientsrc host=<IP-OF-THE-RPI> port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false


gst-launch-1.0 -v tcpclientsrc host=<IP-OF-THE-RPI> port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! osxvideosink sync=false

On the RPi

/opt/vc/bin/raspivid -t 0 -hf -fps 20 -w 300 -h 300 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=<IP-OF-THE-RPI> port=5000

Using VLC

On the client

The client might even be on a mobile phone (I tried on Android).

Simply open from the network in the VLC client:


On the RPi

/opt/vc/bin/raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
  • Pi version doesn't work. I mean it doesn't work how it should. Client ip? – Flash Thunder Jul 3 '15 at 9:56
  • I agree, netcat has the lowest latency. But why do you use 200fps? My stream is 30fps, but setting mplayer to 60 looks best, I don't know why. If I set mplayer to 30 then it adds 1-2 seconds latency – Elliott B Aug 3 '18 at 6:08


on the rpi:

raspivid -t 0 -w 1280 -h 720 -hf -ih -fps 20 -o - | nc -k -l 2222

on your computer:

mplayer -fps 200 -demuxer h264es ffmpeg://tcp://

supports reconnecting

  • 3
    On the raspberry pi, I had to use the -p parameter to set the port: raspivid -t 0 -w 1280 -h 720 -hf -ih -fps 20 -o - | nc -k -l -p 2222 – johnboiles Mar 25 '16 at 17:27
  • 2
    Thanks for the mplayer command. It works also with the newer raspivid which can stream to TCP without using netcat, like that: raspivid -fps 20 -w 1280 -h 720 -t 0 -l -o tcp:// - and the play command is the same. I'm still looking for the correct URL for VLC streaming. It was something like h264+tcp://example.org:2222 – Tomasz Gandor Dec 11 '17 at 23:14
  • 1
    Command is tcp/h264://example.org:2222. I am wondering how to play this type of stream on Android. Mobile phones have such poor apps. – Valentin Radu Mar 11 '18 at 15:26
  • On macOS: brew install mplayer. – creimers Jan 31 at 17:10

protected by Ghanima Feb 18 '17 at 18:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.