Skip to content

Instantly share code, notes, and snippets.

@lamoboos223
Forked from muellermartin/rpicam-gstreamer.txt
Created June 27, 2023 10:44
Show Gist options
  • Save lamoboos223/17699d724601b6345ae509a9efd88a39 to your computer and use it in GitHub Desktop.
Save lamoboos223/17699d724601b6345ae509a9efd88a39 to your computer and use it in GitHub Desktop.
Stream video from Raspberry Pi with camera attached to CSI port via RTP (UDP) using GStreamer
Useful Links:
- http://stackoverflow.com/questions/25941171/how-to-get-gstreamer1-0-working-with-v4l2-raspicam-driver
- http://raspberrypi.stackexchange.com/questions/26675/modern-way-to-stream-h-264-from-the-raspberry-cam
- http://stackoverflow.com/questions/13154983/gstreamer-rtp-stream-to-vlc
- http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README
- http://archpi.dabase.com/#sending-and-receiving-pi-camera-video-over-the-network
- http://emmanuelgranatello.blogspot.de/2013/10/raspberry-pi-gstreamer-streaming-h264.html
- http://stackoverflow.com/questions/15712983/why-rtp-streaming-of-a-avi-video-file-fails-to-be-received
# Needed to fix bug in kernel module for loading v4l2 driver
sudo modprobe -r bcm2835_v4l2
sudo modprobe bcm2835_v4l2 gst_v4l2src_is_broken=1
# Raw
## Server
gst-launch-1.0 -e -v v4l2src device=/dev/video0 do-timestamp=true ! video/x-raw,format=RGB,width=640,height=480,framerate=10/1 ! rtpvrawpay ! udpsink host=127.0.0.1 port=9000 sync=false
## Client
gst-launch-1.0 -v udpsrc port=9000 caps=application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, framerate=(fraction)10/1, sampling=(string)RGB, depth=(string)8, width=(string)640, height=(string)480, colorimetry=(string)SMPTE240M, playload=(int)96 ! rtpjitterbuffer ! rtpvrawdepay ! autovideosink sync=false
# H264
## Server
gst-launch-1.0 -e -v v4l2src device=/dev/video0 do-timestamp=true ! videorate ! video/x-raw,width=1280,height=720,framerate=5/1 ! omxh264enc target-bitrate=1000000 control-rate=variable ! video/x-h264,profile=high ! h264parse ! rtph264pay config-interval=1 ! udpsink host=192.168.1.1 port=9000
## Client
gst-launch-1.0 -v udpsrc port=9000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, framerate=(fraction)30/1, width=(string)1280, height=(string)720, playload=(int)96' ! rtpjitterbuffer drop-on-latency=true ! rtph264depay ! avdec_h264 ! videoflip method=vertical-flip ! autovideosink sync=false async=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment