Streaming video from Rpi to PC using gstreamer/netcat

asked 2015-01-21 02:47:23 -0600

Dandan gravatar image

updated 2015-01-28 04:10:58 -0600

HI all,

Updated: I solved this issue so Im documenting for future generations :) It took me a week or two of search and study of gst-launch!

I was trying to stream the video of the raspberry pi camera to my PC (running ubuntu) and process in OpenCV.

Stream with netcat produces alot of lag (3-5sec) Pi:

raspivid -n -t 0 -w 1280 -h 720 -fps 49 -o - | nc 10.x.x.x 5000

PC:

nc -l -p 5000 | ./VidCap

and in my program

videocapture cap("/dev/stdin")

Next I tried Gstreamer:

Pi:

raspivid -n  -t 0 -b 5000000 -w 1280 -h 720 -fps 49 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=10.x.x.x port=5000

PC: this time I run my opencv program directly from command line. In the program I use videocapture with the following string

"tcpclientsrc host=10.x.x.x port=5000 ! gdpdepay ! rtph264depay ! video/x-h264, width=1280, height=720, format=YUY2, framerate=49/1 ! ffdec_h264 ! autoconvert ! appsink sync=false"

Note that OpenCV must receive ffdec_h264 and not avdec_h264 (opening the video in command line it is the other way around).

Good Luck, Dan

edit retag flag offensive close merge delete

Comments

Interesting ! How much delay you achieve with this set-up ?

R.Saracchini gravatar imageR.Saracchini ( 2015-01-28 04:26:32 -0600 )edit