In this lesson we learn to make a streaming IP camera with a Raspberry Pi Zero W, and Raspberry Pi camera. The Pi will create a RTP stream, which can then be read by a Jetson Nano on the same network. We use OpenCV to read the frames on the NVIDIA Jetson Nano side.
This is the command to launch the Raspberry Pi camera, and start the RTP stream. This command works well for the Raspberry Pi Camera, version 1.
1 | raspivid -t 0 -w 1296 -h 730 -fps 30 -b 2000000 -awb auto -n -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=0.0.0.0 port=8554 |
For the Version 2 Camera, I recommend:
1 | raspivid -t 0 -w 1280 -h 720 -fps 30 -b 2000000 -awb auto -n -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=0.0.0.0 port=8554 |
This is the Gstreamer code on the Jetson Nano side to grab the RTP Frames. On host= below, be sure to use the IP address of your Raspberry Pi.
1 | camSet2=' tcpclientsrc host=10.1.37.28 port=8554 ! gdpdepay ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv flip-method='+str(flip)+' ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw, width='+str(dispW)+', height='+str(dispH)+',format=BGR ! appsink drop=true sync=false ' |