GStreamer
GStreamer is a library for constructing graphs of media-handling components.
Index
General
Launch a test pipeline.
gst-launch audiotestsrc ! audioconvert ! autoaudiosink
gst-launch videotestsrc ! videoconvert ! autovideosink
Print info about a plugin or element.
gst-inspect
gst-inspect -a
gst-inspect <plugin>
gst-inspect <element>
Detect the media format of a file.
gst-typefind <file>
Play audio or video.
gst-launch playbin uri=<file://path/to/file>
Use element properties.
gst-launch audiotestsrc wave=saw freq=880 ! audioconvert ! autoaudiosink
Streaming
This section has examples of the supported transport protocols.
RTMP
Publish a test stream.
gst-launch \
flvmux name=mux streamable=true ! rtmp2sink location="rtmp://<ip>:1935/<application>/<stream_name>/<stream_key>" \
audiotestsrc wave=sine-table ! audioconvert ! faac ! queue ! mux. \
videotestsrc is-live=true ! video/x-raw,width=1280,height=720 ! videoconvert ! x264enc speed-preset=3 tune=zerolatency ! queue ! mux.
flvmuxcollects both audio and video and multiplexes them into a format suitable for RTMP.streamable=trueensures the muxed stream can be sent immediately without requiring the whole file.queueavoid blocking when muxing parallel streams.videoconvertandaudioconvertensure compatible formats are fed into encoders.
Publish microphone and camera (Windows).
gst-launch \
flvmux name=mux streamable=true ! rtmp2sink location="rtmp://<ip>:1935/<application>/<stream_name>/<stream_key>" \
wasapisrc ! audioconvert ! audioresample ! faac ! queue ! mux. \
ksvideosrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! queue ! mux.
wasapisrcordirectsoundsrcfor audio.
Publish microphone and camera (Linux).
gst-launch \
flvmux name=mux streamable=true ! rtmp2sink location="rtmp://<ip>:1935/<application>/<stream_name>/<stream_key>" \
pulsesrc device=default ! audioconvert ! audioresample ! faac ! queue ! mux. \
v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! queue ! mux.
pulsesrc device=defaultcaptures from the default PulseAudio input (typically microphone).v4l2src device=/dev/video0captures from the first webcam device.
Publish microphone and camera (MacOS).
gst-launch \
flvmux name=mux streamable=true ! rtmp2sink location="rtmp://<ip>:1935/<application>/<stream_name>/<stream_key>" \
osxaudiosrc ! audioconvert ! audioresample ! faac ! queue ! mux. \
avfvideosrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! queue ! mux.