Skip to content

Instantly share code, notes, and snippets.

@jaxxzer
Last active December 12, 2023 22:54
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaxxzer/aa908b0f38ed4d76bb8b7738d67c01bd to your computer and use it in GitHub Desktop.
Save jaxxzer/aa908b0f38ed4d76bb8b7738d67c01bd to your computer and use it in GitHub Desktop.
gstreamer pipelines
// rtsp receivers:
gst-launch-1.0 rtspsrc location="rtsp://192.168.0.102:8554/test" protocols=GST_RTSP_LOWER_TRANS_TCP latency=0 ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false
gst-launch-1.0 rtspsrc location=rtsp://192.168.1.156:8554/test ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink
// Stream video to window and record it to file
gst-launch-1.0 -e -v udpsrc port=5600 ! tee name=VIDEOWINDOW ! queue ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! mp4mux ! filesink location=myvideo.mp4 VIDEOWINDOW. ! queue ! application/x-rtp, payload=96 ! rtph264depay ! avdec_h264 ! autovideosink
// Stream video to window and save with text overlay (empty file?!)
gst-launch-1.0 -e -v udpsrc port=5600 ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! tee name=VIDEOWINDOW ! queue ! textoverlay text="Room A" valignment=top halignment=left font-desc="Sans, 72" ! x264enc ! mp4mux ! filesink location=myvideo.mp4 VIDEOWINDOW. ! queue ! autovideosink
// Save video with text overlay
gst-launch-1.0 -e -v udpsrc port=5600 ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! textoverlay text="Room A" valignment=top halignment=left font-desc="Sans, 72" ! x264enc ! mp4mux ! filesink location=myvideo.mp4
// Take a snapshot
gst-launch-1.0 v4l2src num-buffers=1 ! jpegenc ! filesink location=file.jpg
// standard usbvid pipleline
gst-launch-1.0 -v v4l2src device=/dev/video1 ! queue ! "video/x-h264, width=1920, height=1080, pixel-aspect-ratio=1/1, framerate=30/1" ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.2.1 port=5600
// standard viewer
gst-launch-1.0 udpsrc port=5600 ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink
// 180 rotated viewer
gst-launch-1.0 udpsrc port=5600 ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoflip method=rotate-180 ! autovideosink
gst-launch-1.0 -v v4l2src device=/dev/video1 do-timestamp=true ! queue ! "video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1" ! h264parse ! videoconvert ! videoflip method=clockwise ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.2.1 port=5600
//standard send/view
gst-launch-1.0 -ev v4l2src device=/dev/video1 do-timestamp=true ! video/x-h264, width=1920, height=1080, framerate=30/1 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.2.1 port=5600
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=YVYU, width=1920, height=1080, framerate=30/1 ! videoconvert ! queue ! rtpvrawpay pt=96 ! udpsink host=192.168.2.1 port=5600
gst-launch-1.0 -ev udpsrc port=5600 ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink
// web video streaming
gst-launch-1.0 -v videotestsrc ! theoraenc ! oggmux ! tcpserversink host=192.168.2.2 port=8080
gst-launch-1.0 -v v4l2src device=/dev/video0 ! queue ! theoraenc ! oggmux ! queue ! tcpserversink host=192.168.2.2 port=8080
gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw, format=YUY2, width=800, height=600 ! queue leaky=2 ! videoconvert ! queue ! theoraenc quality=1 drop-frames=true ! oggmux ! queue ! tcpserversink host=192.168.2.2 port=9092
gst-launch-1.0 -v v4l2src device=/dev/video0 do-timestamp=true ! video/x-raw, format=YUY2, width=800, height=600 ! queue ! videoconvert ! queue ! theoraenc quality=1 drop-frames=true ! queue leaky=2 ! oggmux ! queue ! tcpserversink host=192.168.2.2 port=9096
gst-launch-1.0 -v v4l2src device=/dev/video0 do-timestamp=true ! video/x-raw, format=YUY2, width=320, height=240, framerate=15/1 ! queue ! videoconvert ! queue ! theoraenc quality=1 drop-frames=true ! queue leaky=2 ! oggmux ! queue ! tcpserversink host=0.0.0.0 port=9099
// QGC PIPELINE
gst-launch-1.0 -ev udpsrc port=5600 do-timestamp=true ! application/x-rtp, media=video, clock-rate=90000, encoding-name=H264 ! rtph264depay ! h264parse ! tee ! queue ! h264parse ! matroskamux ! filesink location="test.mkv"
// Creates raw-video format, uncompressed, no dts on any of them!
gst-launch-1.0 -v videotestsrc num-buffers=100 ! matroskamux ! filesink location="test.mkv"
// this stream results in non-monotonically increasing dts
gst-launch-1.0 -ev udpsrc port=5600 ! application/x-rtp ! rtph264depay ! h264parse ! matroskamux ! filesink location="test.mkv"
gst-launch-1.0 -ev udpsrc port=5600 ! application/x-rtp ! rtph264depay ! h264parse ! mp4mux ! filesink location="test.mp4"
// play video from pipeline
gst-launch-1.0 filesrc location=2017-11-05_16.32.10.mkv ! matroskademux ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=0.0.0.0 port=5600
// stream video from picam, record to sd card too
raspivid -vf \
-hf \
--nopreview \
--mode 5 \
--bitrate 15000000 \
--awb auto \
--brightness 55 \
--saturation 10 \
--sharpness 50 \
--contrast 15 \
--drc medium \
-fl \
--timeout 0 \
--output - | \
gst-launch-1.0 -ev fdsrc do-timestamp=true ! h264parse ! tee name=t ! queue ! mp4mux ! filesink location=test.mp4 t. ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.2.1 port=5600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment