Skip to content

Instantly share code, notes, and snippets.

@artizirk
Last active March 24, 2022 12:13
Show Gist options
  • Save artizirk/af250062c4cdafd1c311c9194237a4ff to your computer and use it in GitHub Desktop.
Save artizirk/af250062c4cdafd1c311c9194237a4ff to your computer and use it in GitHub Desktop.
gstreamer experiments

Links

https://gist.github.com/strezh/9114204

cmds

Convert motec camera mjpg to h264 and stream it to localhost

gst-launch-1.0 -v rtspsrc location=rtsp://10.0.0.11:8554/MCDE3000 latency=0 ! decodebin ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5000

Playback h264 from locahost

gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! decodebin ! videoconvert ! autovideosink

Pipe udp h264 to jsmpeg

GST_DEBUG=3 gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! decodebin ! videoconvert ! videorate max-rate=25 ! avenc_mpeg1video dct_algo=1 gop-size=30 max-bframes=0 ! mpegtsmux ! curlhttpsink location=http://127.0.0.1:8081/yoursecret

intel vaapi h264 decode

GST_DEBUG=3 gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! vaapih264dec low-latency=true ! videorate ! video/x-raw,framerate=30/1 ! avenc_mpeg1video gop-size=15 max-bframes=0 bitrate=10000 ! mpegtsmux ! curlhttpsink location=http://127.0.0.1:8081/yoursecret

intel vaapi pipelines

camera rtsp mjpg > h264 udp rtp

gst-launch-1.0 rtspsrc location=rtsp://10.0.0.11:8554/MCDE3000 latency=0 ! decodebin ! vaapih264enc ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5000

udp rtp h264 > gldisplay: latency is about 100ms

gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! avdec_h264 ! videoconvert ! glimagesink

udp rtp h264 > mpeg1 > mpegts > http: latency is about 300ms

GST_DEBUG=3 gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,clock-rate=90000,payload=96 ! rtph264depay ! vaapih264dec low-latency=true ! videorate ! video/x-raw,framerate=30/1 ! avenc_mpeg1video gop-size=15 max-bframes=0 bitrate=10000 ! mpegtsmux ! curlhttpsink location=http://127.0.0.1:8081/yoursecret

namedpipe encode

not tested

gst-launch-1.0 -v filesrc location='video_fifo' ! videoparse width=640 height=480 format=GST_VIDEO_FORMAT_YUY2 ! videoconver ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment