Skip to content

Instantly share code, notes, and snippets.

@anselmobattisti
Created September 10, 2019 23:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anselmobattisti/de244db254c5bd8116543d01c6714222 to your computer and use it in GitHub Desktop.
Save anselmobattisti/de244db254c5bd8116543d01c6714222 to your computer and use it in GitHub Desktop.
Grab video from webcam and stream it using udpsink via x264
Pipeline to send video (simulating SRC) get the data from video0
gst-launch-1.0 v4l2src device=/dev/video0 \
! decodebin \
! x264enc \
! rtph264pay \
! udpsink host=localhost port=5000
// if you are running it inside a docker container be aware of the host ip in udpsink
gst-launch-1.0 v4l2src device=/dev/video0 \
! decodebin \
! x264enc \
! rtph264pay \
! udpsink host=172.17.0.1 port=5000
Pipeline to crop a video and send data to UDP dest (simulating de VMS)
gst-launch-1.0 \
udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" \
! rtph264depay \
! decodebin \
! videocrop top=200 left=100 right=4 bottom=0 \
! x264enc \
! rtph264pay \
! udpsink host=localhost port=5001
Pipeline to show video (simulating the application)
gst-launch-1.0 \
udpsrc port=5001 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" \
! rtph264depay \
! decodebin \
! videoconvert \
! autovideosink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment