Skip to content

Instantly share code, notes, and snippets.

@junjuew
Last active November 17, 2017 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junjuew/34161574ee04fc661ee52e0725c37ff8 to your computer and use it in GitHub Desktop.
Save junjuew/34161574ee04fc661ee52e0725c37ff8 to your computer and use it in GitHub Desktop.
gstreamer
# Use gstreamer with mpv
## source
gstreamer rtp source over udp:
gst-launch-0.10 v4l2src ! ffenc_mpeg4 ! rtpmp4vpay send-config=true ! udpsink host=127.0.0.1 port=5000
## sink
mpv play a sdp file: mpv --untimed /tmp/video.sdp
/tmp/video.sdp's content:
v=0
m=video 5000 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 MP4V-ES/90000
# Send and receive x264 stream from camera:
## Send
gst-launch-1.0 -v v4l2src ! video/x-raw,framerate=20/1 ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=127.0.0.1 port=9000
## Receive
gst-launch-1.0 -v udpsrc port=9000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! autovideosink
# Send and receive MJPEG stream from camera:
## Send
gst-launch-1.0 -v v4l2src ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=9000
## Receive (jpegdec can be replaced with decodebin)
gst-launch-1.0 -v udpsrc port=9000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96" ! rtpjpegdepay ! jpegdec ! autovideosink
# Send and receive screen shots:
gst-launch-1.0 -v ximagesrc ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=127.0.0.1 port=5000
gst-launch-1.0 -v udpsrc port=5000 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