Snippets collected/distilled from gists/blog posts/etc. Combined here for fellow web-searchers -- goal is to have an easy/minimal sink for in-app use, and then forward that stream in another process.
Read camera, push to UDP sink (usually from appsrc, here v4l2 camera):
$ gst-launch-1.0 -vvvv v4l2src ! 'video/x-raw, width=640, height=480, framerate=30/1' ! videoconvert ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! udpsink port=1234
Visualize above:
$ gst-launch-1.0 -vvv udpsrc port=1234 ! "application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! rtph264depay ! h264parse ! decodebin ! videoconvert ! xvimagesink sync=false
Instead of preceding, read UDP stream and republish over network as RTSP stream, using https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-launch.c (build: libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0` -L/usr/lib/x86_64-linux-gnu -lgstrtspserver-1.0 test-launch.c -o gst-rtsp-launch
)
GST_DEBUG=1 ./bin/gst-rtsp-launch "udpsrc port=1234 ! application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264 ! rtph264depay ! h264parse ! decodebin ! videoconvert ! x264enc ! rtph264pay name=pay0 pt=96 "
Read RTSP stream:
$ gst-launch-1.0 -vvv rtspsrc location=rtsp://127.0.0.1:8554/test ! rtph264depay ! h264parse ! decodebin ! videoconvert ! xvimagesink sync=false
thank u very much ,now what i do:
first --(data from pipe )push to a rtsp stream to gst-rtsp-server by command =['ffmpeg',
'-y',
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
'-pix_fmt', 'bgr24',
'-s', '{}x{}'.format(opt['image']['width'],opt['image']['height']),
'-r', '{}'.format(opt['server']['fps']),
'-i', '-',
'-c:v', 'libx264',
'-pix_fmt', 'yuv422p',
'-preset:v', 'ultrafast',
'-tune:v','zerolatency',
'-f', video_format,
server_url]
second: what should i set the launch src . videotest src don't work. (perhaps i shouldn't push a rtsp stream by ffmpeg,can u give me som suggestion?)
third: what i need is gst-rtsp-server url,such as http://192.168.0.11/test.this url can play in vlc.