Skip to content

Instantly share code, notes, and snippets.

@elhigu
Created November 12, 2016 14:53
Show Gist options
  • Select an option

  • Save elhigu/b50cb756bee1666fc7cdb5cecce18c55 to your computer and use it in GitHub Desktop.

Select an option

Save elhigu/b50cb756bee1666fc7cdb5cecce18c55 to your computer and use it in GitHub Desktop.
Record Raspberry PI camera module stream and vector data directly with remote computer (a.k.a I <3 Netcat! a.k.a. Netcat te amo!)
nc yourrpi-address.duckdns.org 3000 > video.h264 &
nc yourrpi-address.duckdns.org 3001 > vectors.out &
/opt/vc/bin/raspivid -t 0 -hf -b 1000000 -n -md 4 -ex night -awb off -awbg 1.0,2.5 -o sendvideo.fifo -x sendvectors.fifo
mkfifo videodata.fifo || true
mkfifo vectordata.fifo || true
cat videodata.fifo | nc -l -p 3000 &
cat vectordata.fifo | nc -l -p 3001 &
@elhigu
Copy link
Author

elhigu commented Nov 12, 2016

So first start listening 3000 and 3001 ports on RPI by running

./rpi_start_listening.sh

Then connect to RPI from remote machine with

# run this on remote machine
./connect_rpi.sh

Finally start capturing video and piping it directly to TCP connections on RaspberryPI

# stop capturing with ctrl-c it should actually also send EOF to netcat processes closing TCP connections too
./rpi_capture.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment