Ask Your Question

Dandan's profile - activity

2017-10-06 08:00:53 -0600 received badge  Notable Question (source)
2016-12-04 16:46:16 -0600 received badge  Popular Question (source)
2015-01-28 03:32:58 -0600 received badge  Enthusiast
2015-01-21 03:00:47 -0600 asked a question Streaming video from Rpi to PC using gstreamer/netcat

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